diff options
Diffstat (limited to 'clang/tools/libclang/CXIndexDataConsumer.cpp')
-rw-r--r-- | clang/tools/libclang/CXIndexDataConsumer.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/tools/libclang/CXIndexDataConsumer.cpp b/clang/tools/libclang/CXIndexDataConsumer.cpp index 59fa92bb21e..74d8f2415c6 100644 --- a/clang/tools/libclang/CXIndexDataConsumer.cpp +++ b/clang/tools/libclang/CXIndexDataConsumer.cpp @@ -478,6 +478,14 @@ void CXIndexDataConsumer::importedModule(const ImportDecl *ImportD) { if (!Mod) return; + // If the imported module is part of the top-level module that we're + // indexing, it doesn't correspond to an imported AST file. + // FIXME: This assumes that AST files and top-level modules directly + // correspond, which is unlikely to remain true forever. + if (Module *SrcMod = ImportD->getImportedOwningModule()) + if (SrcMod->getTopLevelModule() == Mod->getTopLevelModule()) + return; + CXIdxImportedASTFileInfo Info = { static_cast<CXFile>( const_cast<FileEntry *>(Mod->getASTFile())), |