summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2014-05-15 04:44:25 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2014-05-15 04:44:25 +0000
commitbef5d7996387ce036872e8b0404126f6528a20b7 (patch)
treedde8cc30adcc5f0a5225a4622664e161a03675cd
parent537ec10ebce2ac701473e89cefff99a637b22c6c (diff)
downloadclang-bef5d7996387ce036872e8b0404126f6528a20b7.tar.gz
clang-bef5d7996387ce036872e8b0404126f6528a20b7.tar.bz2
clang-bef5d7996387ce036872e8b0404126f6528a20b7.tar.xz
[libclang] Introduce clang_Module_isSystem(), which returns non-zero if the given CXModule is a system one.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208846 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang-c/Index.h7
-rw-r--r--test/Index/annotate-module.m2
-rw-r--r--tools/c-index-test/c-index-test.c4
-rw-r--r--tools/libclang/CIndex.cpp7
-rw-r--r--tools/libclang/libclang.exports1
5 files changed, 18 insertions, 3 deletions
diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h
index f8cbb9be6c..3d4a229d28 100644
--- a/include/clang-c/Index.h
+++ b/include/clang-c/Index.h
@@ -3625,6 +3625,13 @@ CINDEX_LINKAGE CXString clang_Module_getFullName(CXModule Module);
/**
* \param Module a module object.
*
+ * \returns non-zero if the module is a system one.
+ */
+CINDEX_LINKAGE int clang_Module_isSystem(CXModule Module);
+
+/**
+ * \param Module a module object.
+ *
* \returns the number of top level headers associated with this module.
*/
CINDEX_LINKAGE unsigned clang_Module_getNumTopLevelHeaders(CXTranslationUnit,
diff --git a/test/Index/annotate-module.m b/test/Index/annotate-module.m
index 3082e21086..456a192f42 100644
--- a/test/Index/annotate-module.m
+++ b/test/Index/annotate-module.m
@@ -44,6 +44,6 @@ int glob;
// RUN: c-index-test -cursor-at=%s:3:11 %s -fmodules-cache-path=%t.cache -fmodules -F %S/../Modules/Inputs \
// RUN: | FileCheck %s -check-prefix=CHECK-CURSOR
-// CHECK-CURSOR: 3:1 ModuleImport=DependsOnModule:3:1 (Definition) Extent=[3:1 - 3:24] Spelling=DependsOnModule ([3:9 - 3:24]) ModuleName=DependsOnModule ({{.*}}DependsOnModule-{{[^.]*}}.pcm) Headers(2):
+// CHECK-CURSOR: 3:1 ModuleImport=DependsOnModule:3:1 (Definition) Extent=[3:1 - 3:24] Spelling=DependsOnModule ([3:9 - 3:24]) ModuleName=DependsOnModule ({{.*}}DependsOnModule-{{[^.]*}}.pcm) system=0 Headers(2):
// CHECK-CURSOR-NEXT: {{.*}}other.h
// CHECK-CURSOR-NEXT: {{.*}}DependsOnModule.h
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c
index 9192b3a38b..dcae670591 100644
--- a/tools/c-index-test/c-index-test.c
+++ b/tools/c-index-test/c-index-test.c
@@ -2251,9 +2251,9 @@ static int inspect_cursor_at(int argc, const char **argv) {
astFilename = clang_getFileName(astFile);
name = clang_Module_getFullName(mod);
numHeaders = clang_Module_getNumTopLevelHeaders(TU, mod);
- printf(" ModuleName=%s (%s) Headers(%d):",
+ printf(" ModuleName=%s (%s) system=%d Headers(%d):",
clang_getCString(name), clang_getCString(astFilename),
- numHeaders);
+ clang_Module_isSystem(mod), numHeaders);
clang_disposeString(name);
clang_disposeString(astFilename);
for (i = 0; i < numHeaders; ++i) {
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index f38d4c2bc8..91205602c9 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -6377,6 +6377,13 @@ CXString clang_Module_getFullName(CXModule CXMod) {
return cxstring::createDup(Mod->getFullModuleName());
}
+int clang_Module_isSystem(CXModule CXMod) {
+ if (!CXMod)
+ return 0;
+ Module *Mod = static_cast<Module*>(CXMod);
+ return Mod->IsSystem;
+}
+
unsigned clang_Module_getNumTopLevelHeaders(CXTranslationUnit TU,
CXModule CXMod) {
if (isNotUsableTU(TU)) {
diff --git a/tools/libclang/libclang.exports b/tools/libclang/libclang.exports
index f761c044c2..48eec25767 100644
--- a/tools/libclang/libclang.exports
+++ b/tools/libclang/libclang.exports
@@ -30,6 +30,7 @@ clang_Module_getName
clang_Module_getFullName
clang_Module_getNumTopLevelHeaders
clang_Module_getTopLevelHeader
+clang_Module_isSystem
clang_IndexAction_create
clang_IndexAction_dispose
clang_Range_isNull