From 98802456b3b7573e0f76779c9ed4fb2007a8612d Mon Sep 17 00:00:00 2001 From: Roberto Raggi <roberto.raggi@nokia.com> Date: Tue, 10 Nov 2009 12:47:08 +0100 Subject: [PATCH] Removed ObjCPropertyAttributeListAST Done with Erik Verbruggen --- src/shared/cplusplus/AST.cpp | 28 +++-------------------- src/shared/cplusplus/AST.h | 16 ------------- src/shared/cplusplus/ASTVisit.cpp | 8 ------- src/shared/cplusplus/ASTfwd.h | 2 +- src/shared/cplusplus/CheckDeclaration.cpp | 2 +- src/shared/cplusplus/Parser.cpp | 4 ++-- 6 files changed, 7 insertions(+), 53 deletions(-) diff --git a/src/shared/cplusplus/AST.cpp b/src/shared/cplusplus/AST.cpp index 6aaf3527011..4d7deaafd88 100644 --- a/src/shared/cplusplus/AST.cpp +++ b/src/shared/cplusplus/AST.cpp @@ -2114,27 +2114,6 @@ unsigned ObjCPropertyAttributeAST::lastToken() const return attribute_identifier_token + 1; } -unsigned ObjCPropertyAttributeListAST::firstToken() const -{ - if (attr) - return attr->firstToken(); - else if (next) - return next->lastToken(); - else - // ### Assert? - return 0; -} - -unsigned ObjCPropertyAttributeListAST::lastToken() const -{ - for (const ObjCPropertyAttributeListAST *it = this; it; it = it->next) { - if (! it->next && it->attr) - return it->attr->lastToken(); - } - // ### assert? - return 0; -} - unsigned ObjCPropertyDeclarationAST::firstToken() const { if (attributes) @@ -2153,8 +2132,8 @@ unsigned ObjCPropertyDeclarationAST::lastToken() const return property_attributes->lastToken(); else if (lparen_token) return lparen_token + 1; - else - return property_token + 1; + + return property_token + 1; } unsigned ObjCMessageArgumentDeclarationAST::firstToken() const @@ -2213,8 +2192,7 @@ unsigned ObjCMethodPrototypeAST::lastToken() const return arguments->lastToken(); else if (type_name) return type_name->lastToken(); - else - return method_type_token + 1; + return method_type_token + 1; } unsigned ObjCMethodDeclarationAST::firstToken() const diff --git a/src/shared/cplusplus/AST.h b/src/shared/cplusplus/AST.h index 6a0e4d96cc3..c46fca5a501 100644 --- a/src/shared/cplusplus/AST.h +++ b/src/shared/cplusplus/AST.h @@ -2405,22 +2405,6 @@ protected: virtual void accept0(ASTVisitor *visitor); }; -class CPLUSPLUS_EXPORT ObjCPropertyAttributeListAST: public AST -{ -public: - ObjCPropertyAttributeAST *attr; - ObjCPropertyAttributeListAST *next; - -public: - virtual ObjCPropertyAttributeListAST *asObjCPropertyAttributeList() { return this; } - - virtual unsigned firstToken() const; - virtual unsigned lastToken() const; - -protected: - virtual void accept0(ASTVisitor *visitor); -}; - class CPLUSPLUS_EXPORT ObjCPropertyDeclarationAST: public DeclarationAST { public: diff --git a/src/shared/cplusplus/ASTVisit.cpp b/src/shared/cplusplus/ASTVisit.cpp index fe685c3111e..ff1a76b5cf7 100644 --- a/src/shared/cplusplus/ASTVisit.cpp +++ b/src/shared/cplusplus/ASTVisit.cpp @@ -1047,14 +1047,6 @@ void ObjCPropertyAttributeAST::accept0(ASTVisitor *visitor) visitor->endVisit(this); } -void ObjCPropertyAttributeListAST::accept0(ASTVisitor *visitor) -{ - if (visitor->visit(this)) { - accept(attr, visitor); - } - visitor->endVisit(this); -} - void ObjCPropertyDeclarationAST::accept0(ASTVisitor *visitor) { if (visitor->visit(this)) { diff --git a/src/shared/cplusplus/ASTfwd.h b/src/shared/cplusplus/ASTfwd.h index a03eabc1cd1..dc453748bed 100644 --- a/src/shared/cplusplus/ASTfwd.h +++ b/src/shared/cplusplus/ASTfwd.h @@ -136,7 +136,6 @@ class ObjCMessageExpressionAST; class ObjCMethodDeclarationAST; class ObjCMethodPrototypeAST; class ObjCPropertyAttributeAST; -class ObjCPropertyAttributeListAST; class ObjCPropertyDeclarationAST; class ObjCProtocolDeclarationAST; class ObjCProtocolExpressionAST; @@ -201,6 +200,7 @@ typedef List<DeclaratorAST *> DeclaratorListAST; typedef List<NameAST *> ObjCIdentifierListAST; typedef List<ObjCMessageArgumentAST *> ObjCMessageArgumentListAST; typedef List<ObjCSelectorArgumentAST *> ObjCSelectorArgumentListAST; +typedef List<ObjCPropertyAttributeAST *> ObjCPropertyAttributeListAST; typedef ExpressionListAST TemplateArgumentListAST; diff --git a/src/shared/cplusplus/CheckDeclaration.cpp b/src/shared/cplusplus/CheckDeclaration.cpp index 6dc9c9a75b9..eb67596a35d 100644 --- a/src/shared/cplusplus/CheckDeclaration.cpp +++ b/src/shared/cplusplus/CheckDeclaration.cpp @@ -719,7 +719,7 @@ bool CheckDeclaration::visit(ObjCPropertyDeclarationAST *ast) int propAttrs = None; for (ObjCPropertyAttributeListAST *iter= ast->property_attributes; iter; iter = iter->next) { - ObjCPropertyAttributeAST *attrAst = iter->attr; + ObjCPropertyAttributeAST *attrAst = iter->value; if (!attrAst) continue; diff --git a/src/shared/cplusplus/Parser.cpp b/src/shared/cplusplus/Parser.cpp index a1536608f68..4f31a9e07db 100644 --- a/src/shared/cplusplus/Parser.cpp +++ b/src/shared/cplusplus/Parser.cpp @@ -4845,14 +4845,14 @@ bool Parser::parseObjCPropertyDeclaration(DeclarationAST *&node, SpecifierAST *a ObjCPropertyAttributeAST *property_attribute = 0; if (parseObjCPropertyAttribute(property_attribute)) { ast->property_attributes = new (_pool) ObjCPropertyAttributeListAST; - ast->property_attributes->attr = property_attribute; + ast->property_attributes->value = property_attribute; ObjCPropertyAttributeListAST *last = ast->property_attributes; while (LA() == T_COMMA) { consumeToken(); // consume T_COMMA last->next = new (_pool) ObjCPropertyAttributeListAST; last = last->next; - if (!parseObjCPropertyAttribute(last->attr)) { + if (!parseObjCPropertyAttribute(last->value)) { _translationUnit->error(_tokenIndex, "expected token `%s' got `%s'", Token::name(T_IDENTIFIER), tok().spell()); while (LA() != T_RPAREN) -- GitLab