summaryrefslogtreecommitdiff
path: root/src/shared/cplusplus/Semantic.cpp
diff options
context:
space:
mode:
authorRoberto Raggi <roberto.raggi@nokia.com>2010-07-20 12:54:49 +0200
committerRoberto Raggi <roberto.raggi@nokia.com>2010-07-20 12:55:08 +0200
commit893e647306ab121567553d5fe1adbbdae041aed7 (patch)
treecfb2911183e5f167a1859954090c911b99d4ebdf /src/shared/cplusplus/Semantic.cpp
parenta97bede3416d1feaa2d9f07dd4d4ca1ba85cbdb7 (diff)
downloadqt-creator-893e647306ab121567553d5fe1adbbdae041aed7.tar.gz
Use the location of the unqualified name id.
Diffstat (limited to 'src/shared/cplusplus/Semantic.cpp')
-rw-r--r--src/shared/cplusplus/Semantic.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/shared/cplusplus/Semantic.cpp b/src/shared/cplusplus/Semantic.cpp
index be08ebdf7a..019852cc78 100644
--- a/src/shared/cplusplus/Semantic.cpp
+++ b/src/shared/cplusplus/Semantic.cpp
@@ -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();
+}