forked from qt-creator/qt-creator
Removed DeclaratorListAST
Done with Erik Verbruggen
This commit is contained in:
@@ -608,25 +608,6 @@ unsigned DeclaratorIdAST::lastToken() const
|
||||
return name->lastToken();
|
||||
}
|
||||
|
||||
|
||||
unsigned DeclaratorListAST::firstToken() const
|
||||
{
|
||||
return declarator->firstToken();
|
||||
}
|
||||
|
||||
unsigned DeclaratorListAST::lastToken() const
|
||||
{
|
||||
for (const DeclaratorListAST *it = this; it; it = it->next) {
|
||||
if (! it->next) {
|
||||
if (it->declarator)
|
||||
return it->declarator->lastToken();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
unsigned DeleteExpressionAST::firstToken() const
|
||||
{
|
||||
if (scope_token)
|
||||
|
||||
@@ -786,22 +786,6 @@ protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT DeclaratorListAST: public AST
|
||||
{
|
||||
public:
|
||||
DeclaratorAST *declarator;
|
||||
DeclaratorListAST *next;
|
||||
|
||||
public:
|
||||
virtual DeclaratorListAST *asDeclaratorList() { return this; }
|
||||
|
||||
virtual unsigned firstToken() const;
|
||||
virtual unsigned lastToken() const;
|
||||
|
||||
protected:
|
||||
virtual void accept0(ASTVisitor *visitor);
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT DeleteExpressionAST: public ExpressionAST
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -271,14 +271,6 @@ void ArrayDeclaratorAST::accept0(ASTVisitor *visitor)
|
||||
visitor->endVisit(this);
|
||||
}
|
||||
|
||||
void DeclaratorListAST::accept0(ASTVisitor *visitor)
|
||||
{
|
||||
if (visitor->visit(this)) {
|
||||
accept(declarator, visitor);
|
||||
}
|
||||
visitor->endVisit(this);
|
||||
}
|
||||
|
||||
void DeleteExpressionAST::accept0(ASTVisitor *visitor)
|
||||
{
|
||||
if (visitor->visit(this)) {
|
||||
|
||||
@@ -121,7 +121,6 @@ public:
|
||||
virtual bool visit(DeclaratorAST *) { return true; }
|
||||
virtual bool visit(DeclarationStatementAST *) { return true; }
|
||||
virtual bool visit(DeclaratorIdAST *) { return true; }
|
||||
virtual bool visit(DeclaratorListAST *) { return true; }
|
||||
virtual bool visit(DeleteExpressionAST *) { return true; }
|
||||
virtual bool visit(DestructorNameAST *) { return true; }
|
||||
virtual bool visit(DoStatementAST *) { return true; }
|
||||
@@ -254,7 +253,6 @@ public:
|
||||
virtual void endVisit(DeclaratorAST *) { }
|
||||
virtual void endVisit(DeclarationStatementAST *) { }
|
||||
virtual void endVisit(DeclaratorIdAST *) { }
|
||||
virtual void endVisit(DeclaratorListAST *) { }
|
||||
virtual void endVisit(DeleteExpressionAST *) { }
|
||||
virtual void endVisit(DestructorNameAST *) { }
|
||||
virtual void endVisit(DoStatementAST *) { }
|
||||
|
||||
@@ -87,7 +87,6 @@ class DeclarationAST;
|
||||
class DeclarationStatementAST;
|
||||
class DeclaratorAST;
|
||||
class DeclaratorIdAST;
|
||||
class DeclaratorListAST;
|
||||
class DeleteExpressionAST;
|
||||
class DestructorNameAST;
|
||||
class DoStatementAST;
|
||||
@@ -202,6 +201,7 @@ class WhileStatementAST;
|
||||
typedef List<ExpressionAST *> ExpressionListAST;
|
||||
typedef List<DeclarationAST *> DeclarationListAST;
|
||||
typedef List<StatementAST *> StatementListAST;
|
||||
typedef List<DeclaratorAST *> DeclaratorListAST;
|
||||
|
||||
} // end of namespace CPlusPlus
|
||||
|
||||
|
||||
@@ -173,13 +173,13 @@ 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,
|
||||
FullySpecifiedType declTy = semantic()->check(it->value, qualTy,
|
||||
_scope, &name);
|
||||
|
||||
unsigned location = locationOfDeclaratorId(it->declarator);
|
||||
unsigned location = locationOfDeclaratorId(it->value);
|
||||
if (! location) {
|
||||
if (it->declarator)
|
||||
location = it->declarator->firstToken();
|
||||
if (it->value)
|
||||
location = it->value->firstToken();
|
||||
else
|
||||
location = ast->firstToken();
|
||||
}
|
||||
@@ -226,8 +226,8 @@ bool CheckDeclaration::visit(SimpleDeclarationAST *ast)
|
||||
else if (ty.isTypedef())
|
||||
symbol->setStorage(Symbol::Typedef);
|
||||
|
||||
if (it->declarator && it->declarator->initializer) {
|
||||
FullySpecifiedType initTy = semantic()->check(it->declarator->initializer, _scope);
|
||||
if (it->value && it->value->initializer) {
|
||||
FullySpecifiedType initTy = semantic()->check(it->value->initializer, _scope);
|
||||
}
|
||||
|
||||
*decl_it = new (translationUnit()->memoryPool()) List<Declaration *>();
|
||||
|
||||
@@ -2158,7 +2158,7 @@ bool Parser::isPointerDeclaration(DeclarationStatementAST *ast) const
|
||||
if (SpecifierAST *spec = declaration->decl_specifier_seq) {
|
||||
if (spec->asNamedTypeSpecifier() && ! spec->next) {
|
||||
if (DeclaratorListAST *declarators = declaration->declarators) {
|
||||
if (DeclaratorAST *declarator = declarators->declarator) {
|
||||
if (DeclaratorAST *declarator = declarators->value) {
|
||||
if (declarator->ptr_operators && declarator->equals_token && declarator->initializer) {
|
||||
return true;
|
||||
}
|
||||
@@ -2180,7 +2180,7 @@ bool Parser::maybeAmbiguousStatement(DeclarationStatementAST *ast) const
|
||||
if (SpecifierAST *spec = declaration->decl_specifier_seq) {
|
||||
if (spec->asNamedTypeSpecifier() && ! spec->next) {
|
||||
if (DeclaratorListAST *declarators = declaration->declarators) {
|
||||
if (DeclaratorAST *declarator = declarators->declarator) {
|
||||
if (DeclaratorAST *declarator = declarators->value) {
|
||||
if (declarator->core_declarator &&
|
||||
declarator->core_declarator->asNestedDeclarator()) {
|
||||
// recognized name(id-expression)
|
||||
@@ -2192,7 +2192,7 @@ bool Parser::maybeAmbiguousStatement(DeclarationStatementAST *ast) const
|
||||
|
||||
} else if (DeclaratorListAST *declarators = declaration->declarators) {
|
||||
// no decl_specifiers...
|
||||
if (DeclaratorAST *declarator = declarators->declarator) {
|
||||
if (DeclaratorAST *declarator = declarators->value) {
|
||||
if (declarator->postfix_declarators && declarator->postfix_declarators->asFunctionDeclarator()
|
||||
&& ! declarator->initializer) {
|
||||
return false;
|
||||
@@ -2849,7 +2849,7 @@ bool Parser::parseSimpleDeclaration(DeclarationAST *&node,
|
||||
|
||||
if (declarator) {
|
||||
*declarator_ptr = new (_pool) DeclaratorListAST;
|
||||
(*declarator_ptr)->declarator = declarator;
|
||||
(*declarator_ptr)->value = declarator;
|
||||
declarator_ptr = &(*declarator_ptr)->next;
|
||||
}
|
||||
|
||||
@@ -2860,7 +2860,7 @@ bool Parser::parseSimpleDeclaration(DeclarationAST *&node,
|
||||
declarator = 0;
|
||||
if (parseInitDeclarator(declarator, acceptStructDeclarator)) {
|
||||
*declarator_ptr = new (_pool) DeclaratorListAST;
|
||||
(*declarator_ptr)->declarator = declarator;
|
||||
(*declarator_ptr)->value = declarator;
|
||||
declarator_ptr = &(*declarator_ptr)->next;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user