diff options
Diffstat (limited to 'clang/lib/Frontend/FrontendAction.cpp')
-rw-r--r-- | clang/lib/Frontend/FrontendAction.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp index d724bbce374..d74984c6bc2 100644 --- a/clang/lib/Frontend/FrontendAction.cpp +++ b/clang/lib/Frontend/FrontendAction.cpp @@ -370,7 +370,7 @@ static std::error_code collectModuleHeaderIncludes( .Default(false)) continue; - const FileEntry *Header = FileMgr.getFile(Dir->path()); + auto Header = FileMgr.getFile(Dir->path()); // FIXME: This shouldn't happen unless there is a file system race. Is // that worth diagnosing? if (!Header) @@ -378,7 +378,7 @@ static std::error_code collectModuleHeaderIncludes( // If this header is marked 'unavailable' in this module, don't include // it. - if (ModMap.isHeaderUnavailableInModule(Header, Module)) + if (ModMap.isHeaderUnavailableInModule(*Header, Module)) continue; // Compute the relative path from the directory to this file. @@ -392,7 +392,7 @@ static std::error_code collectModuleHeaderIncludes( llvm::sys::path::append(RelativeHeader, *It); // Include this header as part of the umbrella directory. - Module->addTopHeader(Header); + Module->addTopHeader(*Header); addHeaderInclude(RelativeHeader, Includes, LangOpts, Module->IsExternC); } @@ -481,7 +481,7 @@ static Module *prepareToBuildModule(CompilerInstance &CI, // the module map, rather than adding it after the fact. StringRef OriginalModuleMapName = CI.getFrontendOpts().OriginalModuleMap; if (!OriginalModuleMapName.empty()) { - auto *OriginalModuleMap = + auto OriginalModuleMap = CI.getFileManager().getFile(OriginalModuleMapName, /*openFile*/ true); if (!OriginalModuleMap) { @@ -489,11 +489,11 @@ static Module *prepareToBuildModule(CompilerInstance &CI, << OriginalModuleMapName; return nullptr; } - if (OriginalModuleMap != CI.getSourceManager().getFileEntryForID( + if (*OriginalModuleMap != CI.getSourceManager().getFileEntryForID( CI.getSourceManager().getMainFileID())) { M->IsInferred = true; CI.getPreprocessor().getHeaderSearchInfo().getModuleMap() - .setInferredModuleAllowedBy(M, OriginalModuleMap); + .setInferredModuleAllowedBy(M, *OriginalModuleMap); } } @@ -674,8 +674,8 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, // Set up embedding for any specified files. Do this before we load any // source files, including the primary module map for the compilation. for (const auto &F : CI.getFrontendOpts().ModulesEmbedFiles) { - if (const auto *FE = CI.getFileManager().getFile(F, /*openFile*/true)) - CI.getSourceManager().setFileIsTransient(FE); + if (auto FE = CI.getFileManager().getFile(F, /*openFile*/true)) + CI.getSourceManager().setFileIsTransient(*FE); else CI.getDiagnostics().Report(diag::err_modules_embed_file_not_found) << F; } @@ -709,10 +709,10 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, PreprocessorOptions &PPOpts = CI.getPreprocessorOpts(); StringRef PCHInclude = PPOpts.ImplicitPCHInclude; std::string SpecificModuleCachePath = CI.getSpecificModuleCachePath(); - if (const DirectoryEntry *PCHDir = FileMgr.getDirectory(PCHInclude)) { + if (auto PCHDir = FileMgr.getDirectory(PCHInclude)) { std::error_code EC; SmallString<128> DirNative; - llvm::sys::path::native(PCHDir->getName(), DirNative); + llvm::sys::path::native((*PCHDir)->getName(), DirNative); bool Found = false; llvm::vfs::FileSystem &FS = FileMgr.getVirtualFileSystem(); for (llvm::vfs::directory_iterator Dir = FS.dir_begin(DirNative, EC), @@ -792,9 +792,9 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, // If we were asked to load any module map files, do so now. for (const auto &Filename : CI.getFrontendOpts().ModuleMapFiles) { - if (auto *File = CI.getFileManager().getFile(Filename)) + if (auto File = CI.getFileManager().getFile(Filename)) CI.getPreprocessor().getHeaderSearchInfo().loadModuleMapFile( - File, /*IsSystem*/false); + *File, /*IsSystem*/false); else CI.getDiagnostics().Report(diag::err_module_map_not_found) << Filename; } |