diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-10-03 21:05:44 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-10-03 21:05:44 +0000 |
commit | 37f2f52fbc16b0d426d4d86c7e1662e5c6b9e3b8 (patch) | |
tree | 4d78aa3746e9c258418fe5e241f183181920c90a /tools/libclang/IndexingContext.cpp | |
parent | 1a71112c56a7b5efe15a88971b9c0c93d92d29f4 (diff) |
[libclang] Simplify indexing of module imports by handling implicit
imports via ImportDecls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165160 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/libclang/IndexingContext.cpp')
-rw-r--r-- | tools/libclang/IndexingContext.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/tools/libclang/IndexingContext.cpp b/tools/libclang/IndexingContext.cpp index 3a3c010370..c964e963c7 100644 --- a/tools/libclang/IndexingContext.cpp +++ b/tools/libclang/IndexingContext.cpp @@ -253,21 +253,20 @@ void IndexingContext::ppIncludedFile(SourceLocation hashLoc, FileMap[File] = idxFile; } -void IndexingContext::importedModule(SourceLocation Loc, - StringRef name, bool isIncludeDirective, - const Module *module) { +void IndexingContext::importedModule(const ImportDecl *ImportD) { if (!CB.importedASTFile) return; - std::string ModuleName = module->getFullModuleName(); + Module *Mod = ImportD->getImportedModule(); + if (!Mod) + return; + std::string ModuleName = Mod->getFullModuleName(); - ScratchAlloc SA(*this); CXIdxImportedASTFileInfo Info = { - (CXFile)module->getASTFile(), - getIndexLoc(Loc), + (CXFile)Mod->getASTFile(), + getIndexLoc(ImportD->getLocation()), /*isModule=*/true, - isIncludeDirective, - SA.toCStr(name), + ImportD->isImplicit(), ModuleName.c_str(), }; CXIdxClientASTFile astFile = CB.importedASTFile(ClientData, &Info); @@ -1110,6 +1109,8 @@ bool IndexingContext::shouldIgnoreIfImplicit(const Decl *D) { return false; if (isa<ObjCMethodDecl>(D)) return false; + if (isa<ImportDecl>(D)) + return false; return true; } |