summaryrefslogtreecommitdiffstats
path: root/clang/tools/libclang/CXIndexDataConsumer.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2016-09-01 20:15:25 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2016-09-01 20:15:25 +0000
commit30fc9a9339de86b098667a8fa9eba6da1f7232d2 (patch)
tree25f064f28b750b3429481711358cf4ebbc895ac4 /clang/tools/libclang/CXIndexDataConsumer.cpp
parent2fa35194632ce6ebfa2d6782afd62e1274d2e225 (diff)
downloadbcm5719-llvm-30fc9a9339de86b098667a8fa9eba6da1f7232d2.tar.gz
bcm5719-llvm-30fc9a9339de86b098667a8fa9eba6da1f7232d2.zip
When we reach the end of a #include of a header of a local submodule that we
textually included, create an ImportDecl just as we would if we reached a #include of any other modular header. This is necessary in order to correctly determine the set of variables to initialize for an imported module. This should hopefully make the modules selfhost buildbot green again. llvm-svn: 280409
Diffstat (limited to 'clang/tools/libclang/CXIndexDataConsumer.cpp')
-rw-r--r--clang/tools/libclang/CXIndexDataConsumer.cpp8
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())),
OpenPOWER on IntegriCloud