Improved compatibility with the gcc extensions.

This commit is contained in:
Roberto Raggi
2009-06-18 17:48:55 +02:00
parent c3c98cca78
commit 9c038180d8
7 changed files with 38 additions and 5 deletions

View File

@@ -570,6 +570,8 @@ unsigned DeclarationListAST::lastToken() const
unsigned DeclaratorAST::firstToken() const
{
if (attributes)
return attributes->firstToken();
if (ptr_operators)
return ptr_operators->firstToken();
else if (core_declarator)
@@ -589,7 +591,7 @@ unsigned DeclaratorAST::lastToken() const
if (initializer)
return initializer->lastToken();
for (SpecifierAST *it = attributes; it; it = it->next) {
for (SpecifierAST *it = post_attributes; it; it = it->next) {
if (! it->next)
return it->lastToken();
}
@@ -607,6 +609,11 @@ unsigned DeclaratorAST::lastToken() const
return it->lastToken();
}
for (SpecifierAST *it = attributes; it; it = it->next) {
if (! it->next)
return it->lastToken();
}
// ### assert?
return 0;
}