diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-10-18 00:17:05 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-10-18 00:17:05 +0000 |
commit | 8d7a24e94b58676e57fd3f47353cbdbc59917d81 (patch) | |
tree | 8292f3559d0fcbb646eae94042ed784e3d09e143 /tools/libclang/Indexing.cpp | |
parent | ff9c9e1d71ec8f994c08d185f5acc01c0a685d0d (diff) |
[libclang] Invoke a ppIncludedFile callback when indexing implicit module imports.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166161 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/libclang/Indexing.cpp')
-rw-r--r-- | tools/libclang/Indexing.cpp | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/tools/libclang/Indexing.cpp b/tools/libclang/Indexing.cpp index 887b5fc1ee..36442fa232 100644 --- a/tools/libclang/Indexing.cpp +++ b/tools/libclang/Indexing.cpp @@ -73,14 +73,10 @@ public: StringRef SearchPath, StringRef RelativePath, const Module *Imported) { - if (Imported) { - // We handle implicit imports via ImportDecls. - return; - } - bool isImport = (IncludeTok.is(tok::identifier) && IncludeTok.getIdentifierInfo()->getPPKeywordID() == tok::pp_import); - IndexCtx.ppIncludedFile(HashLoc, FileName, File, isImport, IsAngled); + IndexCtx.ppIncludedFile(HashLoc, FileName, File, isImport, IsAngled, + Imported); } /// MacroDefined - This hook is called whenever a macro definition is seen. @@ -458,16 +454,15 @@ static void indexPreprocessingRecord(ASTUnit &Unit, IndexingContext &IdxCtx) { PreprocessedEntity *PPE = *I; if (InclusionDirective *ID = dyn_cast<InclusionDirective>(PPE)) { - if (!ID->importedModule()) { - SourceLocation Loc = ID->getSourceRange().getBegin(); - // Modules have synthetic main files as input, give an invalid location - // if the location points to such a file. - if (isModuleFile && Unit.isInMainFileID(Loc)) - Loc = SourceLocation(); - IdxCtx.ppIncludedFile(Loc, ID->getFileName(), - ID->getFile(), ID->getKind() == InclusionDirective::Import, - !ID->wasInQuotes()); - } + SourceLocation Loc = ID->getSourceRange().getBegin(); + // Modules have synthetic main files as input, give an invalid location + // if the location points to such a file. + if (isModuleFile && Unit.isInMainFileID(Loc)) + Loc = SourceLocation(); + IdxCtx.ppIncludedFile(Loc, ID->getFileName(), + ID->getFile(), + ID->getKind() == InclusionDirective::Import, + !ID->wasInQuotes(), ID->importedModule()); } } } |