summaryrefslogtreecommitdiff
path: root/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
commitb934d248d001d1536e074e3e8da8f47db63d719f (patch)
tree5a93b3210a486c669a6b426d94298c9fb3f80859 /lib/Frontend/CompilerInstance.cpp
parentc85832f6feffd646458f5493710e433724e0cf34 (diff)
downloadclang-b934d248d001d1536e074e3e8da8f47db63d719f.tar.gz
clang-b934d248d001d1536e074e3e8da8f47db63d719f.tar.bz2
clang-b934d248d001d1536e074e3e8da8f47db63d719f.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193005 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/CompilerInstance.cpp')
-rw-r--r--lib/Frontend/CompilerInstance.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp
index 7c5ca01272..9f0ca3b31e 100644
--- a/lib/Frontend/CompilerInstance.cpp
+++ b/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);