Index: include/clang-c/Index.h =================================================================== --- include/clang-c/Index.h +++ include/clang-c/Index.h @@ -2355,8 +2355,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. Index: lib/Sema/SemaCodeComplete.cpp =================================================================== --- lib/Sema/SemaCodeComplete.cpp +++ lib/Sema/SemaCodeComplete.cpp @@ -3046,6 +3046,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: tools/libclang/CIndex.cpp =================================================================== --- tools/libclang/CIndex.cpp +++ 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: @@ -4840,6 +4848,8 @@ return cxstring::createRef("OverloadCandidate"); case CXCursor_TypeAliasTemplateDecl: return cxstring::createRef("TypeAliasTemplateDecl"); + case CXCursor_StaticAssert: + return cxstring::createRef("StaticAssert"); } llvm_unreachable("Unhandled CXCursorKind"); Index: tools/libclang/CursorVisitor.h =================================================================== --- tools/libclang/CursorVisitor.h +++ 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);