summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@qt.io>2019-05-10 13:58:34 +0000
committerNikolai Kosjar <nikolai.kosjar@qt.io>2019-05-10 13:58:34 +0000
commitcfe1ab97d60321ad78ce6f655e1340148bb1a83e (patch)
tree6c2cc5e195df2a74862809700dfb9e223cf68bc9
parentdf12933d918e005e338594d5e21af026c596c6d0 (diff)
downloadbcm5719-llvm-cfe1ab97d60321ad78ce6f655e1340148bb1a83e.tar.gz
bcm5719-llvm-cfe1ab97d60321ad78ce6f655e1340148bb1a83e.zip
[libclang] Forward isInline for NamespaceDecl to libclang
llvm-svn: 360428
-rw-r--r--clang/include/clang-c/Index.h8
-rw-r--r--clang/test/Index/print-type.cpp3
-rw-r--r--clang/tools/c-index-test/c-index-test.c7
-rw-r--r--clang/tools/libclang/CXType.cpp8
-rw-r--r--clang/tools/libclang/libclang.exports1
5 files changed, 26 insertions, 1 deletions
diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h
index 24b865cbaf3..7982d65bf23 100644
--- a/clang/include/clang-c/Index.h
+++ b/clang/include/clang-c/Index.h
@@ -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_isAnonymous(CXCursor C);
*/
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,
diff --git a/clang/test/Index/print-type.cpp b/clang/test/Index/print-type.cpp
index 17bae2e9c30..32d1185eecb 100644
--- a/clang/test/Index/print-type.cpp
+++ b/clang/test/Index/print-type.cpp
@@ -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]
diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c
index 17b773c6366..42fd0bbef09 100644
--- a/clang/tools/c-index-test/c-index-test.c
+++ b/clang/tools/c-index-test/c-index-test.c
@@ -1671,6 +1671,13 @@ static enum CXChildVisitResult PrintType(CXCursor cursor, CXCursor p,
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;
diff --git a/clang/tools/libclang/CXType.cpp b/clang/tools/libclang/CXType.cpp
index 47a9bb9c1d2..c7ac5723822 100644
--- a/clang/tools/libclang/CXType.cpp
+++ b/clang/tools/libclang/CXType.cpp
@@ -1271,6 +1271,14 @@ unsigned clang_Cursor_isAnonymousRecordDecl(CXCursor C){
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();
diff --git a/clang/tools/libclang/libclang.exports b/clang/tools/libclang/libclang.exports
index 1d3cd5cd145..3c76090d64f 100644
--- a/clang/tools/libclang/libclang.exports
+++ b/clang/tools/libclang/libclang.exports
@@ -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
OpenPOWER on IntegriCloud