summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2016-06-09 16:15:55 +0000
committerOlivier Goffart <ogoffart@woboq.com>2016-06-09 16:15:55 +0000
commit81978014c5764ee50a41752cd2740e4f80fbdf6e (patch)
treec5c9c971c7609019d66cff6c81de41c90c16781c /clang
parent2da0cba5fb7321332903b90f5d9ace1cf024fa34 (diff)
downloadbcm5719-llvm-81978014c5764ee50a41752cd2740e4f80fbdf6e.tar.gz
bcm5719-llvm-81978014c5764ee50a41752cd2740e4f80fbdf6e.zip
CIndex: add support for static_assert
Differential Revision: http://reviews.llvm.org/D18080 llvm-svn: 272273
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang-c/Index.h6
-rw-r--r--clang/lib/Sema/SemaCodeComplete.cpp1
-rw-r--r--clang/tools/libclang/CIndex.cpp10
-rw-r--r--clang/tools/libclang/CursorVisitor.h1
4 files changed, 17 insertions, 1 deletions
diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h
index 4691af76b76..1762148dbc5 100644
--- a/clang/include/clang-c/Index.h
+++ b/clang/include/clang-c/Index.h
@@ -2359,8 +2359,12 @@ enum CXCursorKind {
*/
CXCursor_ModuleImportDecl = 600,
CXCursor_TypeAliasTemplateDecl = 601,
+ /**
+ * \brief A static_assert or _Static_assert node
+ */
+ CXCursor_StaticAssert = 602,
CXCursor_FirstExtraDecl = CXCursor_ModuleImportDecl,
- CXCursor_LastExtraDecl = CXCursor_TypeAliasTemplateDecl,
+ CXCursor_LastExtraDecl = CXCursor_StaticAssert,
/**
* \brief A code completion overload candidate.
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp
index ef14660135b..2b226b8e755 100644
--- a/clang/lib/Sema/SemaCodeComplete.cpp
+++ b/clang/lib/Sema/SemaCodeComplete.cpp
@@ -3044,6 +3044,7 @@ CXCursorKind clang::getCursorKindForDecl(const Decl *D) {
case Decl::ClassTemplatePartialSpecialization:
return CXCursor_ClassTemplatePartialSpecialization;
case Decl::UsingDirective: return CXCursor_UsingDirective;
+ case Decl::StaticAssert: return CXCursor_StaticAssert;
case Decl::TranslationUnit: return CXCursor_TranslationUnit;
case Decl::Using:
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index 23e50d6761b..4a1badb68d5 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -1230,6 +1230,14 @@ bool CursorVisitor::VisitUnresolvedUsingTypenameDecl(
return false;
}
+bool CursorVisitor::VisitStaticAssertDecl(StaticAssertDecl *D) {
+ if (Visit(MakeCXCursor(D->getAssertExpr(), StmtParent, TU, RegionOfInterest)))
+ return true;
+ if (Visit(MakeCXCursor(D->getMessage(), StmtParent, TU, RegionOfInterest)))
+ return true;
+ return false;
+}
+
bool CursorVisitor::VisitDeclarationNameInfo(DeclarationNameInfo Name) {
switch (Name.getName().getNameKind()) {
case clang::DeclarationName::Identifier:
@@ -4822,6 +4830,8 @@ CXString clang_getCursorKindSpelling(enum CXCursorKind Kind) {
return cxstring::createRef("OverloadCandidate");
case CXCursor_TypeAliasTemplateDecl:
return cxstring::createRef("TypeAliasTemplateDecl");
+ case CXCursor_StaticAssert:
+ return cxstring::createRef("StaticAssert");
}
llvm_unreachable("Unhandled CXCursorKind");
diff --git a/clang/tools/libclang/CursorVisitor.h b/clang/tools/libclang/CursorVisitor.h
index 3e5b0c9120c..356251d425c 100644
--- a/clang/tools/libclang/CursorVisitor.h
+++ b/clang/tools/libclang/CursorVisitor.h
@@ -238,6 +238,7 @@ public:
bool VisitUsingDecl(UsingDecl *D);
bool VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D);
bool VisitUnresolvedUsingTypenameDecl(UnresolvedUsingTypenameDecl *D);
+ bool VisitStaticAssertDecl(StaticAssertDecl *D);
// Name visitor
bool VisitDeclarationNameInfo(DeclarationNameInfo Name);
OpenPOWER on IntegriCloud