Commit e9a5ab1b authored by Roberto Raggi's avatar Roberto Raggi

Added the `isVirtual' attribute to Function.

parent 54d60a77
......@@ -316,6 +316,7 @@ bool CheckDeclaration::visit(FunctionDefinitionAST *ast)
translationUnit()->error(ast->ctor_initializer->firstToken(),
"only constructors take base initializers");
}
accept(ast->ctor_initializer);
}
const int previousVisibility = semantic()->switchVisibility(Symbol::Public);
......
......@@ -168,6 +168,9 @@ bool CheckDeclarator::visit(FunctionDeclaratorAST *ast)
ast->symbol = fun;
fun->setReturnType(_fullySpecifiedType);
if (_fullySpecifiedType.isVirtual())
fun->setVirtual(true);
if (ast->parameters) {
DeclarationListAST *parameter_declarations = ast->parameters->parameter_declarations;
for (DeclarationListAST *decl = parameter_declarations; decl; decl = decl->next) {
......
......@@ -259,6 +259,12 @@ bool Function::hasArguments() const
(argumentCount() == 1 && argumentAt(0)->type()->isVoidType()));
}
bool Function::isVirtual() const
{ return f._isVirtual; }
void Function::setVirtual(bool isVirtual)
{ f._isVirtual = isVirtual; }
bool Function::isVariadic() const
{ return f._isVariadic; }
......
......@@ -307,6 +307,9 @@ public:
/** Convenience function that returns whether the function receives any arguments. */
bool hasArguments() const;
bool isVirtual() const;
void setVirtual(bool isVirtual);
bool isVariadic() const;
void setVariadic(bool isVariadic);
......@@ -348,6 +351,7 @@ private:
TemplateParameters *_templateParameters;
FullySpecifiedType _returnType;
struct Flags {
unsigned _isVirtual: 1;
unsigned _isVariadic: 1;
unsigned _isPureVirtual: 1;
unsigned _isConst: 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment