diff --git a/src/libs/cplusplus/FindUsages.cpp b/src/libs/cplusplus/FindUsages.cpp index d6ecca8cbf90f4c66e2cddec9a89b4172a7d9609..d58d17a9716487e8701b848f2caecabd8d72b426 100644 --- a/src/libs/cplusplus/FindUsages.cpp +++ b/src/libs/cplusplus/FindUsages.cpp @@ -301,7 +301,7 @@ bool FindUsages::visit(QualifiedNameAST *ast) if (template_id) { for (TemplateArgumentListAST *template_arguments = template_id->template_arguments; template_arguments; template_arguments = template_arguments->next) { - accept(template_arguments->template_argument); + accept(template_arguments->value); } } } @@ -335,7 +335,7 @@ bool FindUsages::visit(QualifiedNameAST *ast) for (TemplateArgumentListAST *template_arguments = template_id->template_arguments; template_arguments; template_arguments = template_arguments->next) { - accept(template_arguments->template_argument); + accept(template_arguments->value); } } } @@ -395,7 +395,7 @@ bool FindUsages::visit(TemplateIdAST *ast) for (TemplateArgumentListAST *template_arguments = ast->template_arguments; template_arguments; template_arguments = template_arguments->next) { - accept(template_arguments->template_argument); + accept(template_arguments->value); } return false; diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index 53a471bae0a6d5131f35df071abb3bd141195d5a..5925a50f5188351afff47ba9b40012a3479c5d00 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -240,7 +240,7 @@ protected: else if (TemplateIdAST *template_id = name->asTemplateId()) { for (TemplateArgumentListAST *it = template_id->template_arguments; it; it = it->next) { - accept(it->template_argument); + accept(it->value); } } } @@ -277,7 +277,7 @@ protected: virtual bool visit(TemplateIdAST *ast) { for (TemplateArgumentListAST *arg = ast->template_arguments; arg; arg = arg->next) - accept(arg->template_argument); + accept(arg->value); unsigned line, column; getTokenStartPosition(ast->firstToken(), &line, &column); diff --git a/src/shared/cplusplus/AST.cpp b/src/shared/cplusplus/AST.cpp index db6a31fe2a4070c5c5393416b2ed81dad2bd9ef5..f47158ce407e18edd90c0dd5a216451e2bbfb9dd 100644 --- a/src/shared/cplusplus/AST.cpp +++ b/src/shared/cplusplus/AST.cpp @@ -1504,22 +1504,6 @@ unsigned SwitchStatementAST::lastToken() const return switch_token + 1; } - -unsigned TemplateArgumentListAST::firstToken() const -{ - return template_argument->firstToken(); -} - -unsigned TemplateArgumentListAST::lastToken() const -{ - for (const TemplateArgumentListAST *it = this; it; it = it->next) { - if (! it->next && it->template_argument) - return it->template_argument->lastToken(); - } - return 0; -} - - unsigned TemplateDeclarationAST::firstToken() const { if (export_token) @@ -1561,8 +1545,8 @@ unsigned TemplateIdAST::lastToken() const return greater_token + 1; for (TemplateArgumentListAST *it = template_arguments; it; it = it->next) { - if (! it->next && it->template_argument) - return it->template_argument->lastToken(); + if (! it->next && it->value) + return it->value->lastToken(); } if (less_token) diff --git a/src/shared/cplusplus/AST.h b/src/shared/cplusplus/AST.h index 04709031add770995c080fb0d6ee791914bcbff5..10aa1a0c7bce313f71f40cea4371c15654d70efc 100644 --- a/src/shared/cplusplus/AST.h +++ b/src/shared/cplusplus/AST.h @@ -1851,22 +1851,6 @@ protected: virtual void accept0(ASTVisitor *visitor); }; -class CPLUSPLUS_EXPORT TemplateArgumentListAST: public AST -{ -public: - ExpressionAST *template_argument; - TemplateArgumentListAST *next; - -public: - virtual TemplateArgumentListAST *asTemplateArgumentList() { return this; } - - virtual unsigned firstToken() const; - virtual unsigned lastToken() const; - -protected: - virtual void accept0(ASTVisitor *visitor); -}; - class CPLUSPLUS_EXPORT TemplateDeclarationAST: public DeclarationAST { public: diff --git a/src/shared/cplusplus/ASTVisit.cpp b/src/shared/cplusplus/ASTVisit.cpp index 605e1538de438dda856cdd2c6a321fc818889799..f6b0bfb9b8ceb85d32f8f922813071df2b5d9203 100644 --- a/src/shared/cplusplus/ASTVisit.cpp +++ b/src/shared/cplusplus/ASTVisit.cpp @@ -781,14 +781,6 @@ void SwitchStatementAST::accept0(ASTVisitor *visitor) visitor->endVisit(this); } -void TemplateArgumentListAST::accept0(ASTVisitor *visitor) -{ - if (visitor->visit(this)) { - accept(template_argument, visitor); - } - visitor->endVisit(this); -} - void TemplateDeclarationAST::accept0(ASTVisitor *visitor) { if (visitor->visit(this)) { diff --git a/src/shared/cplusplus/ASTVisitor.h b/src/shared/cplusplus/ASTVisitor.h index 29703a44a7eb4e70d5c3aa957465ac2e6b340cf7..ed61ea2a142bf85334c412cf0270dbfed58227f7 100644 --- a/src/shared/cplusplus/ASTVisitor.h +++ b/src/shared/cplusplus/ASTVisitor.h @@ -172,7 +172,6 @@ public: virtual bool visit(SizeofExpressionAST *) { return true; } virtual bool visit(StringLiteralAST *) { return true; } virtual bool visit(SwitchStatementAST *) { return true; } - virtual bool visit(TemplateArgumentListAST *) { return true; } virtual bool visit(TemplateDeclarationAST *) { return true; } virtual bool visit(TemplateIdAST *) { return true; } virtual bool visit(TemplateTypeParameterAST *) { return true; } @@ -304,7 +303,6 @@ public: virtual void endVisit(SizeofExpressionAST *) { } virtual void endVisit(StringLiteralAST *) { } virtual void endVisit(SwitchStatementAST *) { } - virtual void endVisit(TemplateArgumentListAST *) { } virtual void endVisit(TemplateDeclarationAST *) { } virtual void endVisit(TemplateIdAST *) { } virtual void endVisit(TemplateTypeParameterAST *) { } diff --git a/src/shared/cplusplus/ASTfwd.h b/src/shared/cplusplus/ASTfwd.h index 906e188891d62826bb99713f1daf214356980fe9..50ab749ee5cf87d12b7f9be3b624fceb4013b0dc 100644 --- a/src/shared/cplusplus/ASTfwd.h +++ b/src/shared/cplusplus/ASTfwd.h @@ -179,7 +179,6 @@ class SpecifierAST; class StatementAST; class StringLiteralAST; class SwitchStatementAST; -class TemplateArgumentListAST; class TemplateDeclarationAST; class TemplateIdAST; class TemplateTypeParameterAST; @@ -202,6 +201,7 @@ typedef List<ExpressionAST *> ExpressionListAST; typedef List<DeclarationAST *> DeclarationListAST; typedef List<StatementAST *> StatementListAST; typedef List<DeclaratorAST *> DeclaratorListAST; +typedef ExpressionListAST TemplateArgumentListAST; } // end of namespace CPlusPlus diff --git a/src/shared/cplusplus/CheckName.cpp b/src/shared/cplusplus/CheckName.cpp index 19e2eedf98ccb4e6cd9f2ff0d1cabc3ebd4d8312..bcd8b3f180679fcb160716a4c2429ec8ea4063e5 100644 --- a/src/shared/cplusplus/CheckName.cpp +++ b/src/shared/cplusplus/CheckName.cpp @@ -361,7 +361,7 @@ bool CheckName::visit(TemplateIdAST *ast) std::vector<FullySpecifiedType> templateArguments; for (TemplateArgumentListAST *it = ast->template_arguments; it; it = it->next) { - ExpressionAST *arg = it->template_argument; + ExpressionAST *arg = it->value; FullySpecifiedType exprTy = semantic()->check(arg, _scope); templateArguments.push_back(exprTy); } diff --git a/src/shared/cplusplus/Parser.cpp b/src/shared/cplusplus/Parser.cpp index 6a4222024c185a4a680a3724abe5fc3800eb318f..d52431e01c040018834ab6d30c0ee96596d5bd76 100644 --- a/src/shared/cplusplus/Parser.cpp +++ b/src/shared/cplusplus/Parser.cpp @@ -716,14 +716,14 @@ bool Parser::parseTemplateArgumentList(TemplateArgumentListAST *&node) ExpressionAST *template_argument = 0; if (parseTemplateArgument(template_argument)) { *template_argument_ptr = new (_pool) TemplateArgumentListAST; - (*template_argument_ptr)->template_argument = template_argument; + (*template_argument_ptr)->value = template_argument; template_argument_ptr = &(*template_argument_ptr)->next; while (LA() == T_COMMA) { consumeToken(); // consume T_COMMA if (parseTemplateArgument(template_argument)) { *template_argument_ptr = new (_pool) TemplateArgumentListAST; - (*template_argument_ptr)->template_argument = template_argument; + (*template_argument_ptr)->value = template_argument; template_argument_ptr = &(*template_argument_ptr)->next; } } @@ -3365,8 +3365,8 @@ bool Parser::parseNameId(NameAST *&name) else if (LA() == T_LPAREN) { // a template-id followed by a T_LPAREN if (TemplateArgumentListAST *template_arguments = template_id->template_arguments) { - if (! template_arguments->next && template_arguments->template_argument && - template_arguments->template_argument->asBinaryExpression()) { + if (! template_arguments->next && template_arguments->value && + template_arguments->value->asBinaryExpression()) { unsigned saved = cursor(); ExpressionAST *expr = 0;