diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Frontend/CompilerInstance.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index 76301f2a44e..d7b526b2da2 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -1164,7 +1164,7 @@ CompilerInstance::loadModule(SourceLocation ImportLoc, Module = Known->second; } else if (ModuleName == getLangOpts().CurrentModule) { // This is the module we're building. - Module = PP->getHeaderSearchInfo().getModuleMap().findModule(ModuleName); + Module = PP->getHeaderSearchInfo().lookupModule(ModuleName); Known = KnownModules.insert(std::make_pair(Path[0].first, Module)).first; } else { // Search for a module with the given name. diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 743a8f29439..3ee1577b0ba 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -13142,6 +13142,13 @@ DeclResult Sema::ActOnModuleImport(SourceLocation AtLoc, checkModuleImportContext(*this, Mod, ImportLoc, CurContext); + // FIXME: we should support importing a submodule within a different submodule + // of the same top-level module. Until we do, make it an error rather than + // silently ignoring the import. + if (Mod->getTopLevelModuleName() == getLangOpts().CurrentModule) + Diag(ImportLoc, diag::err_module_self_import) + << Mod->getFullModuleName() << getLangOpts().CurrentModule; + SmallVector<SourceLocation, 2> IdentifierLocs; Module *ModCheck = Mod; for (unsigned I = 0, N = Path.size(); I != N; ++I) { |