diff --git a/src/shared/cplusplus/AST.cpp b/src/shared/cplusplus/AST.cpp index d5b605116dc235bb091cfbf8565dd4c98a40fff5..785b8178d44f744479551e40f77fe5675a212cad 100644 --- a/src/shared/cplusplus/AST.cpp +++ b/src/shared/cplusplus/AST.cpp @@ -834,6 +834,8 @@ unsigned ElaboratedTypeSpecifierAST::lastToken() const { if (name) return name->lastToken(); + if (attribute_list) + return attribute_list->lastToken(); return classkey_token + 1; } diff --git a/src/shared/cplusplus/AST.h b/src/shared/cplusplus/AST.h index f0bbb04314bbdaa51855020451f0845a9c7c7bd1..11f038db5a68b683e8f470e524f63e3a01d71a5d 100644 --- a/src/shared/cplusplus/AST.h +++ b/src/shared/cplusplus/AST.h @@ -1559,11 +1559,13 @@ class CPLUSPLUS_EXPORT ElaboratedTypeSpecifierAST: public SpecifierAST { public: unsigned classkey_token; + SpecifierListAST *attribute_list; NameAST *name; public: ElaboratedTypeSpecifierAST() : classkey_token(0) + , attribute_list(0) , name(0) {} diff --git a/src/shared/cplusplus/ASTClone.cpp b/src/shared/cplusplus/ASTClone.cpp index 011d6ec230f1dc48dfbf1a538a3871050d412028..586d88e21a77d8df6a741d795a2c6561f6a8c81b 100644 --- a/src/shared/cplusplus/ASTClone.cpp +++ b/src/shared/cplusplus/ASTClone.cpp @@ -528,6 +528,9 @@ ElaboratedTypeSpecifierAST *ElaboratedTypeSpecifierAST::clone(MemoryPool *pool) { ElaboratedTypeSpecifierAST *ast = new (pool) ElaboratedTypeSpecifierAST; ast->classkey_token = classkey_token; + for (SpecifierListAST *iter = attribute_list, **ast_iter = &ast->attribute_list; + iter; iter = iter->next, ast_iter = &(*ast_iter)->next) + *ast_iter = new (pool) SpecifierListAST((iter->value) ? iter->value->clone(pool) : 0); if (name) ast->name = name->clone(pool); return ast; diff --git a/src/shared/cplusplus/ASTMatcher.cpp b/src/shared/cplusplus/ASTMatcher.cpp index 3fe3a8d410c63a4a7da8a506769147b561315e71..42cbadcbdbf0cc7582609e03314d5da2fa030cf6 100644 --- a/src/shared/cplusplus/ASTMatcher.cpp +++ b/src/shared/cplusplus/ASTMatcher.cpp @@ -874,6 +874,11 @@ bool ASTMatcher::match(ElaboratedTypeSpecifierAST *node, ElaboratedTypeSpecifier pattern->classkey_token = node->classkey_token; + if (! pattern->attribute_list) + pattern->attribute_list = node->attribute_list; + else if (! AST::match(node->attribute_list, pattern->attribute_list, this)) + return false; + if (! pattern->name) pattern->name = node->name; else if (! AST::match(node->name, pattern->name, this)) diff --git a/src/shared/cplusplus/ASTVisit.cpp b/src/shared/cplusplus/ASTVisit.cpp index 4c0a2e98d474cfc609654594e9e0cfac8786a3bd..8216f87b488407a463c2ca155f74c39e78414b61 100644 --- a/src/shared/cplusplus/ASTVisit.cpp +++ b/src/shared/cplusplus/ASTVisit.cpp @@ -391,6 +391,7 @@ void NamedTypeSpecifierAST::accept0(ASTVisitor *visitor) void ElaboratedTypeSpecifierAST::accept0(ASTVisitor *visitor) { if (visitor->visit(this)) { + accept(attribute_list, visitor); accept(name, visitor); } visitor->endVisit(this);