diff options
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Frontend/CompilerInstance.cpp | 5 | ||||
| -rw-r--r-- | clang/lib/Lex/HeaderSearch.cpp | 6 | ||||
| -rw-r--r-- | clang/lib/Tooling/DependencyScanning/DependencyScannerImpl.cpp | 11 |
3 files changed, 10 insertions, 12 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index 374138f..e3bf0ea 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -546,14 +546,11 @@ void CompilerInstance::createPreprocessor(TranslationUnitKind TUKind) { std::string CompilerInstance::getSpecificModuleCachePath(StringRef ModuleHash) { assert(FileMgr && "Specific module cache path requires a FileManager"); - if (getHeaderSearchOpts().ModuleCachePath.empty()) - return ""; - // Set up the module path, including the hash for the module-creation options. SmallString<256> SpecificModuleCache; normalizeModuleCachePath(*FileMgr, getHeaderSearchOpts().ModuleCachePath, SpecificModuleCache); - if (!getHeaderSearchOpts().DisableModuleHash) + if (!SpecificModuleCache.empty() && !getHeaderSearchOpts().DisableModuleHash) llvm::sys::path::append(SpecificModuleCache, ModuleHash); return std::string(SpecificModuleCache); } diff --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp index 238c5e2..65c324c 100644 --- a/clang/lib/Lex/HeaderSearch.cpp +++ b/clang/lib/Lex/HeaderSearch.cpp @@ -2186,6 +2186,8 @@ std::string HeaderSearch::suggestPathToFileForDiagnostics( void clang::normalizeModuleCachePath(FileManager &FileMgr, StringRef Path, SmallVectorImpl<char> &NormalizedPath) { NormalizedPath.assign(Path.begin(), Path.end()); - FileMgr.makeAbsolutePath(NormalizedPath); - llvm::sys::path::remove_dots(NormalizedPath); + if (!NormalizedPath.empty()) { + FileMgr.makeAbsolutePath(NormalizedPath); + llvm::sys::path::remove_dots(NormalizedPath); + } } diff --git a/clang/lib/Tooling/DependencyScanning/DependencyScannerImpl.cpp b/clang/lib/Tooling/DependencyScanning/DependencyScannerImpl.cpp index 05d5669..42f52d0 100644 --- a/clang/lib/Tooling/DependencyScanning/DependencyScannerImpl.cpp +++ b/clang/lib/Tooling/DependencyScanning/DependencyScannerImpl.cpp @@ -524,13 +524,12 @@ bool initializeScanCompilerInstance( // Use the dependency scanning optimized file system if requested to do so. if (DepFS) { DepFS->resetBypassedPathPrefix(); - if (!ScanInstance.getHeaderSearchOpts().ModuleCachePath.empty()) { - SmallString<256> ModulesCachePath; - normalizeModuleCachePath( - ScanInstance.getFileManager(), - ScanInstance.getHeaderSearchOpts().ModuleCachePath, ModulesCachePath); + SmallString<256> ModulesCachePath; + normalizeModuleCachePath(ScanInstance.getFileManager(), + ScanInstance.getHeaderSearchOpts().ModuleCachePath, + ModulesCachePath); + if (!ModulesCachePath.empty()) DepFS->setBypassedPathPrefix(ModulesCachePath); - } ScanInstance.setDependencyDirectivesGetter( std::make_unique<ScanningDependencyDirectivesGetter>( |
