Commit 7a3fbf12 authored by Erik Verbruggen's avatar Erik Verbruggen
Browse files

Added attributes to the elaborate-type-specifier AST node.

parent 58f5b02d
......@@ -834,6 +834,8 @@ unsigned ElaboratedTypeSpecifierAST::lastToken() const
{
if (name)
return name->lastToken();
if (attribute_list)
return attribute_list->lastToken();
return classkey_token + 1;
}
......
......@@ -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)
{}
......
......@@ -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;
......
......@@ -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))
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment