aboutsummaryrefslogtreecommitdiff
path: root/tools/libclang/IndexingContext.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-10-02 16:10:38 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-10-02 16:10:38 +0000
commit2c3e05c266de0d4c465b58ffd129bd0b31604368 (patch)
tree208f2ff0a3e8f8bdf812c4774e5e4512b90005c6 /tools/libclang/IndexingContext.cpp
parentd44e43e46f81cc83b8f1e4384724a9923426bb2a (diff)
[libclang] Implement the importedASTFile indexing callback to provide
info about imported modules. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165020 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/libclang/IndexingContext.cpp')
-rw-r--r--tools/libclang/IndexingContext.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/libclang/IndexingContext.cpp b/tools/libclang/IndexingContext.cpp
index 210dc36d52..3a3c010370 100644
--- a/tools/libclang/IndexingContext.cpp
+++ b/tools/libclang/IndexingContext.cpp
@@ -253,6 +253,27 @@ void IndexingContext::ppIncludedFile(SourceLocation hashLoc,
FileMap[File] = idxFile;
}
+void IndexingContext::importedModule(SourceLocation Loc,
+ StringRef name, bool isIncludeDirective,
+ const Module *module) {
+ if (!CB.importedASTFile)
+ return;
+
+ std::string ModuleName = module->getFullModuleName();
+
+ ScratchAlloc SA(*this);
+ CXIdxImportedASTFileInfo Info = {
+ (CXFile)module->getASTFile(),
+ getIndexLoc(Loc),
+ /*isModule=*/true,
+ isIncludeDirective,
+ SA.toCStr(name),
+ ModuleName.c_str(),
+ };
+ CXIdxClientASTFile astFile = CB.importedASTFile(ClientData, &Info);
+ (void)astFile;
+}
+
void IndexingContext::startedTranslationUnit() {
CXIdxClientContainer idxCont = 0;
if (CB.startedTranslationUnit)