Author: nik Date: Fri May 10 06:58:34 2019 New Revision: 360428 URL: http://llvm.org/viewvc/llvm-project?rev=360428&view=rev Log: [libclang] Forward isInline for NamespaceDecl to libclang
Modified: cfe/trunk/include/clang-c/Index.h cfe/trunk/test/Index/print-type.cpp cfe/trunk/tools/c-index-test/c-index-test.c cfe/trunk/tools/libclang/CXType.cpp cfe/trunk/tools/libclang/libclang.exports Modified: cfe/trunk/include/clang-c/Index.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=360428&r1=360427&r2=360428&view=diff ============================================================================== --- cfe/trunk/include/clang-c/Index.h (original) +++ cfe/trunk/include/clang-c/Index.h Fri May 10 06:58:34 2019 @@ -32,7 +32,7 @@ * compatible, thus CINDEX_VERSION_MAJOR is expected to remain stable. */ #define CINDEX_VERSION_MAJOR 0 -#define CINDEX_VERSION_MINOR 56 +#define CINDEX_VERSION_MINOR 57 #define CINDEX_VERSION_ENCODE(major, minor) ( \ ((major) * 10000) \ @@ -3932,6 +3932,12 @@ CINDEX_LINKAGE unsigned clang_Cursor_isA */ CINDEX_LINKAGE unsigned clang_Cursor_isAnonymousRecordDecl(CXCursor C); +/** + * Determine whether the given cursor represents an inline namespace + * declaration. + */ +CINDEX_LINKAGE unsigned clang_Cursor_isInlineNamespace(CXCursor C); + enum CXRefQualifierKind { /** No ref-qualifier was provided. */ CXRefQualifier_None = 0, Modified: cfe/trunk/test/Index/print-type.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/print-type.cpp?rev=360428&r1=360427&r2=360428&view=diff ============================================================================== --- cfe/trunk/test/Index/print-type.cpp (original) +++ cfe/trunk/test/Index/print-type.cpp Fri May 10 06:58:34 2019 @@ -90,6 +90,8 @@ class X { namespace { int a; } + +inline namespace InlineNS {} // RUN: c-index-test -test-print-type %s -std=c++14 | FileCheck %s // CHECK: Namespace=outer:1:11 (Definition) [type=] [typekind=Invalid] [isPOD=0] // CHECK: ClassTemplate=Foo:4:8 (Definition) [type=] [typekind=Invalid] [isPOD=0] @@ -204,3 +206,4 @@ namespace { // CHECK: UnionDecl=:86:3 (Definition) [type=X::(anonymous union at {{.*}}print-type.cpp:86:3)] [typekind=Record] [isPOD=1] [nbFields=2] [isAnon=1] // CHECK: EnumDecl=:87:3 (Definition) [type=X::(anonymous enum at {{.*}}print-type.cpp:87:3)] [typekind=Enum] [isPOD=1] [isAnon=1] // CHECK: Namespace=:90:11 (Definition) [type=] [typekind=Invalid] [isPOD=0] [isAnon=1] +// CHECK: Namespace=InlineNS:94:18 (Definition) [type=] [typekind=Invalid] [isPOD=0] [isAnonRecDecl=0] [isInlineNamespace=1] Modified: cfe/trunk/tools/c-index-test/c-index-test.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/c-index-test.c?rev=360428&r1=360427&r2=360428&view=diff ============================================================================== --- cfe/trunk/tools/c-index-test/c-index-test.c (original) +++ cfe/trunk/tools/c-index-test/c-index-test.c Fri May 10 06:58:34 2019 @@ -1671,6 +1671,13 @@ static enum CXChildVisitResult PrintType printf(" [isAnonRecDecl=%d]", isAnonRecDecl); } + /* Print if it is an inline namespace decl */ + { + unsigned isInlineNamespace = clang_Cursor_isInlineNamespace(cursor); + if (isInlineNamespace != 0) + printf(" [isInlineNamespace=%d]", isInlineNamespace); + } + printf("\n"); } return CXChildVisit_Recurse; Modified: cfe/trunk/tools/libclang/CXType.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CXType.cpp?rev=360428&r1=360427&r2=360428&view=diff ============================================================================== --- cfe/trunk/tools/libclang/CXType.cpp (original) +++ cfe/trunk/tools/libclang/CXType.cpp Fri May 10 06:58:34 2019 @@ -1271,6 +1271,14 @@ unsigned clang_Cursor_isAnonymousRecordD return 0; } +unsigned clang_Cursor_isInlineNamespace(CXCursor C) { + if (!clang_isDeclaration(C.kind)) + return 0; + const Decl *D = cxcursor::getCursorDecl(C); + const NamespaceDecl *ND = dyn_cast_or_null<NamespaceDecl>(D); + return ND ? ND->isInline() : 0; +} + CXType clang_Type_getNamedType(CXType CT){ QualType T = GetQualType(CT); const Type *TP = T.getTypePtrOrNull(); Modified: cfe/trunk/tools/libclang/libclang.exports URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/libclang.exports?rev=360428&r1=360427&r2=360428&view=diff ============================================================================== --- cfe/trunk/tools/libclang/libclang.exports (original) +++ cfe/trunk/tools/libclang/libclang.exports Fri May 10 06:58:34 2019 @@ -43,6 +43,7 @@ clang_Cursor_isAnonymousRecordDecl clang_Cursor_isBitField clang_Cursor_isDynamicCall clang_Cursor_isExternalSymbol +clang_Cursor_isInlineNamespace clang_Cursor_isNull clang_Cursor_isObjCOptional clang_Cursor_isVariadic _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits