summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang-c/Index.h16
-rw-r--r--tools/c-index-test/c-index-test.c13
-rw-r--r--tools/libclang/IndexingContext.cpp10
3 files changed, 17 insertions, 22 deletions
diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h
index f7a319b5f2..1b350d8770 100644
--- a/include/clang-c/Index.h
+++ b/include/clang-c/Index.h
@@ -4992,24 +4992,18 @@ typedef struct {
*/
CXFile file;
/**
- * \brief Location where the file is imported. Applicable only for modules.
+ * \brief The imported module or NULL if the AST file is a PCH.
*/
- CXIdxLoc loc;
+ CXModule module;
/**
- * \brief Non-zero if the AST file is a module otherwise it's a PCH.
+ * \brief Location where the file is imported. Applicable only for modules.
*/
- int isModule;
+ CXIdxLoc loc;
/**
* \brief Non-zero if an inclusion directive was automatically turned into
- * a module import.
+ * a module import. Applicable only for modules.
*/
int isImplicit;
- /**
- * \brief The actual name of the module or submodule being imported.
- * The syntax is a sequence of identifiers separated by dots, e.g "std.vector"
- * Applicable only for modules.
- */
- const char *moduleName;
} CXIdxImportedASTFileInfo;
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c
index caa50d0167..c073b80698 100644
--- a/tools/c-index-test/c-index-test.c
+++ b/tools/c-index-test/c-index-test.c
@@ -2376,11 +2376,14 @@ static CXIdxClientFile index_importedASTFile(CXClientData client_data,
printf("[importedASTFile]: ");
printCXIndexFile((CXIdxClientFile)info->file);
- printf(" | loc: ");
- printCXIndexLoc(info->loc, client_data);
- printf(" | name: \"%s\"", info->moduleName);
- printf(" | isModule: %d | isImplicit: %d\n",
- info->isModule, info->isImplicit);
+ if (info->module) {
+ CXString name = clang_Module_getFullName(info->module);
+ printf(" | loc: ");
+ printCXIndexLoc(info->loc, client_data);
+ printf(" | name: \"%s\"", clang_getCString(name));
+ printf(" | isImplicit: %d\n", info->isImplicit);
+ clang_disposeString(name);
+ }
return (CXIdxClientFile)info->file;
}
diff --git a/tools/libclang/IndexingContext.cpp b/tools/libclang/IndexingContext.cpp
index 1186191cc3..74b3cf362b 100644
--- a/tools/libclang/IndexingContext.cpp
+++ b/tools/libclang/IndexingContext.cpp
@@ -264,10 +264,9 @@ void IndexingContext::importedModule(const ImportDecl *ImportD) {
CXIdxImportedASTFileInfo Info = {
(CXFile)Mod->getASTFile(),
+ Mod,
getIndexLoc(ImportD->getLocation()),
- /*isModule=*/true,
- ImportD->isImplicit(),
- ModuleName.c_str(),
+ ImportD->isImplicit()
};
CXIdxClientASTFile astFile = CB.importedASTFile(ClientData, &Info);
(void)astFile;
@@ -279,10 +278,9 @@ void IndexingContext::importedPCH(const FileEntry *File) {
CXIdxImportedASTFileInfo Info = {
(CXFile)File,
+ /*module=*/NULL,
getIndexLoc(SourceLocation()),
- /*isModule=*/false,
- /*isImplicit=*/false,
- /*moduleName=*/NULL
+ /*isImplicit=*/false
};
CXIdxClientASTFile astFile = CB.importedASTFile(ClientData, &Info);
(void)astFile;