diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-07-21 18:07:47 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-07-21 18:07:47 +0000 |
commit | d520a250b6525be399c732871cdacbfcc335bbc5 (patch) | |
tree | 3c078b81efcb4b50d50befd15b0e8075bcc756ff /clang/lib/Frontend/CompilerInstance.cpp | |
parent | bd05101e67f975ef4a42585b732ee03d135645d2 (diff) | |
download | llvm-d520a250b6525be399c732871cdacbfcc335bbc5.zip llvm-d520a250b6525be399c732871cdacbfcc335bbc5.tar.gz llvm-d520a250b6525be399c732871cdacbfcc335bbc5.tar.bz2 |
[modules] Produce an error if -cc1 wants to implicitly build a module and no
module cache has been provided, rather than creating one in the current
directory.
llvm-svn: 242819
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInstance.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index c33b150..9da69d4 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -372,9 +372,8 @@ void CompilerInstance::createPreprocessor(TranslationUnitKind TUKind) { std::string CompilerInstance::getSpecificModuleCachePath() { // Set up the module path, including the hash for the // module-creation options. - SmallString<256> SpecificModuleCache( - getHeaderSearchOpts().ModuleCachePath); - if (!getHeaderSearchOpts().DisableModuleHash) + SmallString<256> SpecificModuleCache(getHeaderSearchOpts().ModuleCachePath); + if (!SpecificModuleCache.empty() && !getHeaderSearchOpts().DisableModuleHash) llvm::sys::path::append(SpecificModuleCache, getInvocation().getModuleHash()); return SpecificModuleCache.str(); @@ -1406,17 +1405,17 @@ CompilerInstance::loadModule(SourceLocation ImportLoc, auto Override = ModuleFileOverrides.find(ModuleName); bool Explicit = Override != ModuleFileOverrides.end(); - if (!Explicit && !getLangOpts().ImplicitModules) { + + std::string ModuleFileName = + Explicit ? Override->second + : PP->getHeaderSearchInfo().getModuleFileName(Module); + if (ModuleFileName.empty()) { getDiagnostics().Report(ModuleNameLoc, diag::err_module_build_disabled) << ModuleName; ModuleBuildFailed = true; return ModuleLoadResult(); } - std::string ModuleFileName = - Explicit ? Override->second - : PP->getHeaderSearchInfo().getModuleFileName(Module); - // If we don't already have an ASTReader, create one now. if (!ModuleManager) createModuleManager(); |