summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/CompilerInstance.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-10-18 22:48:20 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-10-18 22:48:20 +0000
commit92304e0013b7df2396d143c7e23c2197bcc0d13d (patch)
tree4c8db6438f96c8daa7bfb59ad858bd2da5b33af0 /clang/lib/Frontend/CompilerInstance.cpp
parentc064a9abff4413fa5fc2fb96fdb78a436e01d18a (diff)
downloadbcm5719-llvm-92304e0013b7df2396d143c7e23c2197bcc0d13d.tar.gz
bcm5719-llvm-92304e0013b7df2396d143c7e23c2197bcc0d13d.zip
Fix crash if a submodule @imports another submodule from the same module. The
test also adds FIXMEs for a number of places where imports and includes of submodules don't work very well. llvm-svn: 193005
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInstance.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index 7c5ca012726..9f0ca3b31e9 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -1108,23 +1108,23 @@ CompilerInstance::loadModule(SourceLocation ImportLoc,
ModuleIdPath Path,
Module::NameVisibilityKind Visibility,
bool IsInclusionDirective) {
+ // Determine what file we're searching from.
+ StringRef ModuleName = Path[0].first->getName();
+ SourceLocation ModuleNameLoc = Path[0].second;
+
// If we've already handled this import, just return the cached result.
// This one-element cache is important to eliminate redundant diagnostics
// when both the preprocessor and parser see the same import declaration.
if (!ImportLoc.isInvalid() && LastModuleImportLoc == ImportLoc) {
// Make the named module visible.
- if (LastModuleImportResult)
+ if (LastModuleImportResult && ModuleName != getLangOpts().CurrentModule)
ModuleManager->makeModuleVisible(LastModuleImportResult, Visibility,
ImportLoc, /*Complain=*/false);
return LastModuleImportResult;
}
-
- // Determine what file we're searching from.
- StringRef ModuleName = Path[0].first->getName();
- SourceLocation ModuleNameLoc = Path[0].second;
clang::Module *Module = 0;
-
+
// If we don't already have information on this module, load the module now.
llvm::DenseMap<const IdentifierInfo *, clang::Module *>::iterator Known
= KnownModules.find(Path[0].first);
OpenPOWER on IntegriCloud