summaryrefslogtreecommitdiff
path: root/src/shared/cplusplus
diff options
context:
space:
mode:
authorRoberto Raggi <roberto.raggi@nokia.com>2010-08-13 12:36:47 +0200
committerRoberto Raggi <roberto.raggi@nokia.com>2010-08-13 12:36:47 +0200
commitbbae6f84db0041b3691bd7b2c645f31965df0327 (patch)
treeac5efec1ba525bb36c77e228e239d664de62e12a /src/shared/cplusplus
parent8e1e0bdefd7364126ead882bb17300fff8fcf6c6 (diff)
downloadqt-creator-bbae6f84db0041b3691bd7b2c645f31965df0327.tar.gz
Create symbols for the fwd class declarations
Diffstat (limited to 'src/shared/cplusplus')
-rw-r--r--src/shared/cplusplus/AST.h2
-rw-r--r--src/shared/cplusplus/Bind.cpp25
-rw-r--r--src/shared/cplusplus/CheckDeclaration.cpp6
3 files changed, 27 insertions, 6 deletions
diff --git a/src/shared/cplusplus/AST.h b/src/shared/cplusplus/AST.h
index 8db76fb459..0e1ba53eeb 100644
--- a/src/shared/cplusplus/AST.h
+++ b/src/shared/cplusplus/AST.h
@@ -609,7 +609,7 @@ public:
unsigned semicolon_token;
public:
- List<Declaration *> *symbols;
+ List<Symbol *> *symbols;
public:
SimpleDeclarationAST()
diff --git a/src/shared/cplusplus/Bind.cpp b/src/shared/cplusplus/Bind.cpp
index 66ec14f34c..350f5ae9f9 100644
--- a/src/shared/cplusplus/Bind.cpp
+++ b/src/shared/cplusplus/Bind.cpp
@@ -1569,7 +1569,28 @@ bool Bind::visit(SimpleDeclarationAST *ast)
type = this->specifier(it->value, type);
}
- List<Declaration *> **symbolTail = &ast->symbols;
+ List<Symbol *> **symbolTail = &ast->symbols;
+
+ if (! ast->declarator_list) {
+ ElaboratedTypeSpecifierAST *elabTypeSpec = 0;
+ for (SpecifierListAST *it = ast->decl_specifier_list; ! elabTypeSpec && it; it = it->next)
+ elabTypeSpec = it->value->asElaboratedTypeSpecifier();
+
+ if (elabTypeSpec && tokenKind(elabTypeSpec->classkey_token) != T_TYPENAME) {
+ unsigned sourceLocation = elabTypeSpec->firstToken();
+ const Name *name = 0;
+ if (elabTypeSpec->name) {
+ sourceLocation = elabTypeSpec->name->firstToken();
+ name = elabTypeSpec->name->name;
+ }
+
+ ForwardClassDeclaration *decl = control()->newForwardClassDeclaration(sourceLocation, name);
+ _scope->addMember(decl);
+
+ *symbolTail = new (translationUnit()->memoryPool()) List<Symbol *>(decl);
+ symbolTail = &(*symbolTail)->next;
+ }
+ }
for (DeclaratorListAST *it = ast->declarator_list; it; it = it->next) {
DeclaratorIdAST *declaratorId = 0;
@@ -1601,7 +1622,7 @@ bool Bind::visit(SimpleDeclarationAST *ast)
_scope->addMember(decl);
- *symbolTail = new (translationUnit()->memoryPool()) List<Declaration *>(decl);
+ *symbolTail = new (translationUnit()->memoryPool()) List<Symbol *>(decl);
symbolTail = &(*symbolTail)->next;
}
return false;
diff --git a/src/shared/cplusplus/CheckDeclaration.cpp b/src/shared/cplusplus/CheckDeclaration.cpp
index 39a98f6c2f..f2b1b2c391 100644
--- a/src/shared/cplusplus/CheckDeclaration.cpp
+++ b/src/shared/cplusplus/CheckDeclaration.cpp
@@ -187,7 +187,7 @@ bool CheckDeclaration::visit(SimpleDeclarationAST *ast)
const bool isQ_SIGNAL = ast->qt_invokable_token && tokenKind(ast->qt_invokable_token) == T_Q_SIGNAL;
const bool isQ_INVOKABLE = ast->qt_invokable_token && tokenKind(ast->qt_invokable_token) == T_Q_INVOKABLE;
- List<Declaration *> **decl_it = &ast->symbols;
+ List<Symbol *> **decl_it = &ast->symbols;
for (DeclaratorListAST *it = ast->declarator_list; it; it = it->next) {
const Name *name = 0;
FullySpecifiedType declTy = semantic()->check(it->value, qualTy,
@@ -230,7 +230,7 @@ bool CheckDeclaration::visit(SimpleDeclarationAST *ast)
FullySpecifiedType initTy = semantic()->check(it->value->initializer, _scope);
}
- *decl_it = new (translationUnit()->memoryPool()) List<Declaration *>();
+ *decl_it = new (translationUnit()->memoryPool()) List<Symbol *>();
(*decl_it)->value = symbol;
decl_it = &(*decl_it)->next;
@@ -841,7 +841,7 @@ bool CheckDeclaration::visit(ObjCPropertyDeclarationAST *ast)
}
List<ObjCPropertyDeclaration *> **lastSymbols = &ast->symbols;
- for (List<Declaration*> *iter = simpleDecl->symbols; iter; iter = iter->next) {
+ for (List<Symbol *> *iter = simpleDecl->symbols; iter; iter = iter->next) {
ObjCPropertyDeclaration *propDecl = control()->newObjCPropertyDeclaration(ast->firstToken(),
iter->value->name());
propDecl->setType(iter->value->type());