forked from qt-creator/qt-creator
More annotations.
This commit is contained in:
@@ -60,6 +60,20 @@
|
||||
CPLUSPLUS_BEGIN_HEADER
|
||||
CPLUSPLUS_BEGIN_NAMESPACE
|
||||
|
||||
template <typename _Tp>
|
||||
class List: public Managed
|
||||
{
|
||||
List(const List &other);
|
||||
void operator =(const List &other);
|
||||
|
||||
public:
|
||||
List()
|
||||
{ }
|
||||
|
||||
_Tp value;
|
||||
List *next;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT AST: public Managed
|
||||
{
|
||||
AST(const AST &other);
|
||||
@@ -351,6 +365,9 @@ public:
|
||||
DeclaratorListAST *declarators;
|
||||
unsigned semicolon_token;
|
||||
|
||||
public:
|
||||
List<Declaration *> *symbols;
|
||||
|
||||
public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
@@ -423,7 +440,7 @@ public:
|
||||
BaseSpecifierAST *next;
|
||||
|
||||
public: // annotations
|
||||
BaseClass *base_class_symbol;
|
||||
BaseClass *symbol;
|
||||
|
||||
public:
|
||||
virtual unsigned firstToken() const;
|
||||
@@ -519,7 +536,7 @@ public:
|
||||
unsigned rbrace_token;
|
||||
|
||||
public: // annotations
|
||||
Class *class_symbol;
|
||||
Class *symbol;
|
||||
|
||||
public:
|
||||
virtual unsigned firstToken() const;
|
||||
@@ -921,6 +938,9 @@ public:
|
||||
CtorInitializerAST *ctor_initializer;
|
||||
StatementAST *function_body;
|
||||
|
||||
public: // annotations
|
||||
Function *symbol;
|
||||
|
||||
public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
@@ -1195,7 +1215,7 @@ public:
|
||||
DeclarationAST *linkage_body;
|
||||
|
||||
public: // annotations
|
||||
Namespace *namespace_symbol;
|
||||
Namespace *symbol;
|
||||
|
||||
public:
|
||||
virtual unsigned firstToken() const;
|
||||
@@ -1321,6 +1341,9 @@ public:
|
||||
unsigned equal_token;
|
||||
ExpressionAST *expression;
|
||||
|
||||
public: // annotations
|
||||
Argument *symbol;
|
||||
|
||||
public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
@@ -1858,6 +1881,9 @@ public:
|
||||
unsigned equal_token;
|
||||
ExpressionAST *type_id;
|
||||
|
||||
public: // annotations
|
||||
Argument *symbol;
|
||||
|
||||
public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
@@ -1880,6 +1906,9 @@ public:
|
||||
unsigned equal_token;
|
||||
ExpressionAST *type_id;
|
||||
|
||||
public:
|
||||
Argument *symbol;
|
||||
|
||||
public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
@@ -1914,6 +1943,9 @@ public:
|
||||
NameAST *name;
|
||||
unsigned semicolon_token;
|
||||
|
||||
public: // annotations
|
||||
UsingDeclaration *symbol;
|
||||
|
||||
public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
@@ -1932,6 +1964,9 @@ public:
|
||||
NameAST *name;
|
||||
unsigned semicolon_token;
|
||||
|
||||
public:
|
||||
UsingNamespaceDirective *symbol;
|
||||
|
||||
public:
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
@@ -136,6 +136,7 @@ bool CheckDeclaration::visit(SimpleDeclarationAST *ast)
|
||||
}
|
||||
}
|
||||
|
||||
List<Declaration *> **decl_it = &ast->symbols;
|
||||
for (DeclaratorListAST *it = ast->declarators; it; it = it->next) {
|
||||
Name *name = 0;
|
||||
FullySpecifiedType declTy = semantic()->check(it->declarator, qualTy,
|
||||
@@ -179,6 +180,10 @@ bool CheckDeclaration::visit(SimpleDeclarationAST *ast)
|
||||
else if (ty.isTypedef())
|
||||
symbol->setStorage(Symbol::Typedef);
|
||||
|
||||
*decl_it = new (translationUnit()->memoryPool()) List<Declaration *>();
|
||||
(*decl_it)->value = symbol;
|
||||
decl_it = &(*decl_it)->next;
|
||||
|
||||
_scope->enterSymbol(symbol);
|
||||
}
|
||||
return false;
|
||||
@@ -234,6 +239,7 @@ bool CheckDeclaration::visit(FunctionDefinitionAST *ast)
|
||||
|
||||
checkFunctionArguments(fun);
|
||||
|
||||
ast->symbol = fun;
|
||||
_scope->enterSymbol(fun);
|
||||
|
||||
if (ast->ctor_initializer) {
|
||||
@@ -286,7 +292,7 @@ bool CheckDeclaration::visit(NamespaceAST *ast)
|
||||
Identifier *id = identifier(ast->identifier_token);
|
||||
Name *namespaceName = control()->nameId(id);
|
||||
Namespace *ns = control()->newNamespace(ast->firstToken(), namespaceName);
|
||||
ast->namespace_symbol = ns;
|
||||
ast->symbol = ns;
|
||||
_scope->enterSymbol(ns);
|
||||
semantic()->check(ast->linkage_body, ns->members()); // ### we'll do the merge later.
|
||||
|
||||
@@ -311,6 +317,7 @@ bool CheckDeclaration::visit(ParameterDeclarationAST *ast)
|
||||
_scope, &argName);
|
||||
FullySpecifiedType exprTy = semantic()->check(ast->expression, _scope);
|
||||
Argument *arg = control()->newArgument(ast->firstToken(), argName);
|
||||
ast->symbol = arg;
|
||||
if (ast->expression)
|
||||
arg->setInitializer(true);
|
||||
arg->setType(argTy);
|
||||
@@ -320,15 +327,6 @@ bool CheckDeclaration::visit(ParameterDeclarationAST *ast)
|
||||
|
||||
bool CheckDeclaration::visit(TemplateDeclarationAST *ast)
|
||||
{
|
||||
/*
|
||||
Template *templ = control()->newTemplate(ast->firstToken());
|
||||
|
||||
for (DeclarationAST *param = ast->template_parameters; param;
|
||||
param = param->next) {
|
||||
semantic()->check(param, templ->members());
|
||||
}
|
||||
*/
|
||||
|
||||
Scope *previousScope = switchScope(new Scope(_scope->owner()));
|
||||
for (DeclarationAST *param = ast->template_parameters; param;
|
||||
param = param->next) {
|
||||
@@ -344,6 +342,7 @@ bool CheckDeclaration::visit(TypenameTypeParameterAST *ast)
|
||||
{
|
||||
Name *name = semantic()->check(ast->name, _scope);
|
||||
Argument *arg = control()->newArgument(ast->firstToken(), name); // ### new template type
|
||||
ast->symbol = arg;
|
||||
_scope->enterSymbol(arg);
|
||||
return false;
|
||||
}
|
||||
@@ -352,6 +351,7 @@ bool CheckDeclaration::visit(TemplateTypeParameterAST *ast)
|
||||
{
|
||||
Name *name = semantic()->check(ast->name, _scope);
|
||||
Argument *arg = control()->newArgument(ast->firstToken(), name); // ### new template type
|
||||
ast->symbol = arg;
|
||||
_scope->enterSymbol(arg);
|
||||
return false;
|
||||
}
|
||||
@@ -360,6 +360,7 @@ bool CheckDeclaration::visit(UsingAST *ast)
|
||||
{
|
||||
Name *name = semantic()->check(ast->name, _scope);
|
||||
UsingDeclaration *u = control()->newUsingDeclaration(ast->firstToken(), name);
|
||||
ast->symbol = u;
|
||||
_scope->enterSymbol(u);
|
||||
return false;
|
||||
}
|
||||
@@ -368,6 +369,7 @@ bool CheckDeclaration::visit(UsingDirectiveAST *ast)
|
||||
{
|
||||
Name *name = semantic()->check(ast->name, _scope);
|
||||
UsingNamespaceDirective *u = control()->newUsingNamespaceDirective(ast->firstToken(), name);
|
||||
ast->symbol = u;
|
||||
_scope->enterSymbol(u);
|
||||
return false;
|
||||
}
|
||||
|
@@ -300,7 +300,7 @@ bool CheckSpecifier::visit(ClassSpecifierAST *ast)
|
||||
{
|
||||
Name *className = semantic()->check(ast->name, _scope);
|
||||
Class *klass = control()->newClass(ast->firstToken(), className);
|
||||
ast->class_symbol = klass;
|
||||
ast->symbol = klass;
|
||||
unsigned classKey = tokenKind(ast->classkey_token);
|
||||
if (classKey == T_CLASS)
|
||||
klass->setClassKey(Class::ClassKey);
|
||||
@@ -315,7 +315,7 @@ bool CheckSpecifier::visit(ClassSpecifierAST *ast)
|
||||
for (BaseSpecifierAST *base = ast->base_clause; base; base = base->next) {
|
||||
Name *baseClassName = semantic()->check(base->name, _scope);
|
||||
BaseClass *baseClass = control()->newBaseClass(ast->firstToken(), baseClassName);
|
||||
base->base_class_symbol = baseClass;
|
||||
base->symbol = baseClass;
|
||||
if (base->token_virtual)
|
||||
baseClass->setVirtual(true);
|
||||
if (base->token_access_specifier) {
|
||||
|
@@ -51,7 +51,6 @@
|
||||
// THE SOFTWARE.
|
||||
|
||||
#include "Control.h"
|
||||
#include "MemoryPool.h"
|
||||
#include "Literals.h"
|
||||
#include "LiteralTable.h"
|
||||
#include "TranslationUnit.h"
|
||||
|
@@ -40,7 +40,7 @@ public:
|
||||
protected:
|
||||
virtual bool visit(ClassSpecifierAST *ast)
|
||||
{
|
||||
Class *classSymbol = ast->class_symbol;
|
||||
Class *classSymbol = ast->symbol;
|
||||
Q_ASSERT(classSymbol != 0);
|
||||
|
||||
insert(ast, classSymbol);
|
||||
|
Reference in New Issue
Block a user