summaryrefslogtreecommitdiff
path: root/src/shared/cplusplus/Semantic.cpp
diff options
context:
space:
mode:
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();
+}