Use the location of the unqualified name id.

This commit is contained in:
Roberto Raggi
2010-07-20 12:54:49 +02:00
parent a97bede341
commit 893e647306
4 changed files with 47 additions and 19 deletions

View File

@@ -316,4 +316,38 @@ int Semantic::visibilityForClassKey(int tokenKind) const
}
}
unsigned Semantic::location(DeclaratorAST *ast) const
{
if (! ast)
return 0;
else if (CPlusPlus::CoreDeclaratorAST *core = ast->core_declarator)
return location(core);
return ast->firstToken();
}
unsigned Semantic::location(CoreDeclaratorAST *ast) const
{
if (! ast)
return 0;
else if (CPlusPlus::DeclaratorIdAST *declaratorId = ast->asDeclaratorId())
return location(declaratorId->name);
else if (CPlusPlus::NestedDeclaratorAST *nested = ast->asNestedDeclarator())
return location(nested->declarator);
return ast->firstToken();
}
unsigned Semantic::location(NameAST *ast) const
{
if (! ast)
return 0;
else if (CPlusPlus::QualifiedNameAST *qualifiedName = ast->asQualifiedName())
return location(qualifiedName->unqualified_name);
return ast->firstToken();
}