diff options
author | Roberto Raggi <roberto.raggi@nokia.com> | 2010-08-13 11:56:21 +0200 |
---|---|---|
committer | Roberto Raggi <roberto.raggi@nokia.com> | 2010-08-13 12:00:46 +0200 |
commit | a592df029af2f5a735e1b722b5b5172b69e82a57 (patch) | |
tree | bf54a6578b0b73c544166483e0a1616396fa182e /src/shared/cplusplus | |
parent | b44e19574c65c49ad87f720c00ea8742f011b1a6 (diff) | |
download | qt-creator-a592df029af2f5a735e1b722b5b5172b69e82a57.tar.gz |
Apply the decl specifiers.
Diffstat (limited to 'src/shared/cplusplus')
-rw-r--r-- | src/shared/cplusplus/Bind.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/shared/cplusplus/Bind.cpp b/src/shared/cplusplus/Bind.cpp index e57a62bfaf..bca93e3dc0 100644 --- a/src/shared/cplusplus/Bind.cpp +++ b/src/shared/cplusplus/Bind.cpp @@ -84,6 +84,42 @@ void Bind::setSkipFunctionBodies(bool skipFunctionBodies) _skipFunctionBodies = skipFunctionBodies; } +void Bind::setDeclSpecifiers(Symbol *symbol, const FullySpecifiedType &declSpecifiers) +{ + if (! symbol) + return; + + int storage = Symbol::NoStorage; + + if (declSpecifiers.isFriend()) + storage = Symbol::Friend; + else if (declSpecifiers.isAuto()) + storage = Symbol::Auto; + else if (declSpecifiers.isRegister()) + storage = Symbol::Register; + else if (declSpecifiers.isStatic()) + storage = Symbol::Static; + else if (declSpecifiers.isExtern()) + storage = Symbol::Extern; + else if (declSpecifiers.isMutable()) + storage = Symbol::Mutable; + else if (declSpecifiers.isTypedef()) + storage = Symbol::Typedef; + + symbol->setStorage(storage); + + if (Function *funTy = symbol->asFunction()) { + if (declSpecifiers.isVirtual()) + funTy->setVirtual(true); + } + + if (declSpecifiers.isDeprecated()) + symbol->setDeprecated(true); + + if (declSpecifiers.isUnavailable()) + symbol->setUnavailable(true); +} + Scope *Bind::switchScope(Scope *scope) { if (! scope) @@ -1546,6 +1582,7 @@ bool Bind::visit(SimpleDeclarationAST *ast) Declaration *decl = control()->newDeclaration(sourceLocation, declName); decl->setType(declTy); + setDeclSpecifiers(decl, type); if (Function *fun = decl->type()->asFunctionType()) { if (declaratorId && declaratorId->name) @@ -1559,6 +1596,7 @@ bool Bind::visit(SimpleDeclarationAST *ast) funTy->setMethodKey(_methodKey); } } + _scope->addMember(decl); *symbolTail = new (translationUnit()->memoryPool()) List<Declaration *>(decl); @@ -1692,10 +1730,13 @@ bool Bind::visit(FunctionDefinitionAST *ast) } DeclaratorIdAST *declaratorId = 0; type = this->declarator(ast->declarator, type, &declaratorId); + Function *fun = type->asFunctionType(); ast->symbol = fun; if (fun) { + setDeclSpecifiers(fun, type); + if (_scope->isClass()) { fun->setVisibility(_visibility); fun->setMethodKey(_methodKey); |