[PATCH] D18080: CIndex: add support for static_assert
Olivier Goffart via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 9 09:22:41 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL272273: CIndex: add support for static_assert (authored by ogoffart).
Changed prior to commit:
http://reviews.llvm.org/D18080?vs=50407&id=60186#toc
Repository:
rL LLVM
http://reviews.llvm.org/D18080
Files:
cfe/trunk/include/clang-c/Index.h
cfe/trunk/lib/Sema/SemaCodeComplete.cpp
cfe/trunk/tools/libclang/CIndex.cpp
cfe/trunk/tools/libclang/CursorVisitor.h
Index: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
===================================================================
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp
@@ -3044,6 +3044,7 @@
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:
Index: cfe/trunk/tools/libclang/CursorVisitor.h
===================================================================
--- cfe/trunk/tools/libclang/CursorVisitor.h
+++ cfe/trunk/tools/libclang/CursorVisitor.h
@@ -238,6 +238,7 @@
bool VisitUsingDecl(UsingDecl *D);
bool VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D);
bool VisitUnresolvedUsingTypenameDecl(UnresolvedUsingTypenameDecl *D);
+ bool VisitStaticAssertDecl(StaticAssertDecl *D);
// Name visitor
bool VisitDeclarationNameInfo(DeclarationNameInfo Name);
Index: cfe/trunk/tools/libclang/CIndex.cpp
===================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp
+++ cfe/trunk/tools/libclang/CIndex.cpp
@@ -1230,6 +1230,14 @@
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 @@
return cxstring::createRef("OverloadCandidate");
case CXCursor_TypeAliasTemplateDecl:
return cxstring::createRef("TypeAliasTemplateDecl");
+ case CXCursor_StaticAssert:
+ return cxstring::createRef("StaticAssert");
}
llvm_unreachable("Unhandled CXCursorKind");
Index: cfe/trunk/include/clang-c/Index.h
===================================================================
--- cfe/trunk/include/clang-c/Index.h
+++ cfe/trunk/include/clang-c/Index.h
@@ -2359,8 +2359,12 @@
*/
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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18080.60186.patch
Type: text/x-patch
Size: 2809 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160609/ad4ee66c/attachment.bin>
More information about the cfe-commits
mailing list