r208846 - [libclang] Introduce clang_Module_isSystem(), which returns non-zero if the given CXModule is a system one.
Argyrios Kyrtzidis
akyrtzi at gmail.com
Wed May 14 21:44:26 PDT 2014
Author: akirtzidis
Date: Wed May 14 23:44:25 2014
New Revision: 208846
URL: http://llvm.org/viewvc/llvm-project?rev=208846&view=rev
Log:
[libclang] Introduce clang_Module_isSystem(), which returns non-zero if the given CXModule is a system one.
Modified:
cfe/trunk/include/clang-c/Index.h
cfe/trunk/test/Index/annotate-module.m
cfe/trunk/tools/c-index-test/c-index-test.c
cfe/trunk/tools/libclang/CIndex.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=208846&r1=208845&r2=208846&view=diff
==============================================================================
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Wed May 14 23:44:25 2014
@@ -3625,6 +3625,13 @@ CINDEX_LINKAGE CXString clang_Module_get
/**
* \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,
Modified: cfe/trunk/test/Index/annotate-module.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/annotate-module.m?rev=208846&r1=208845&r2=208846&view=diff
==============================================================================
--- cfe/trunk/test/Index/annotate-module.m (original)
+++ cfe/trunk/test/Index/annotate-module.m Wed May 14 23:44:25 2014
@@ -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
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=208846&r1=208845&r2=208846&view=diff
==============================================================================
--- cfe/trunk/tools/c-index-test/c-index-test.c (original)
+++ cfe/trunk/tools/c-index-test/c-index-test.c Wed May 14 23:44:25 2014
@@ -2251,9 +2251,9 @@ static int inspect_cursor_at(int argc, c
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) {
Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=208846&r1=208845&r2=208846&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Wed May 14 23:44:25 2014
@@ -6377,6 +6377,13 @@ CXString clang_Module_getFullName(CXModu
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)) {
Modified: cfe/trunk/tools/libclang/libclang.exports
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/libclang.exports?rev=208846&r1=208845&r2=208846&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/libclang.exports (original)
+++ cfe/trunk/tools/libclang/libclang.exports Wed May 14 23:44:25 2014
@@ -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
More information about the cfe-commits
mailing list