[clang] ba118f3 - [clang] NFCI: Use DirectoryEntryRef in FrontendAction::BeginSourceFile()

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 20 09:55:19 PDT 2022


Author: Jan Svoboda
Date: 2022-04-20T18:54:39+02:00
New Revision: ba118f30676d44025885f422e29fe853a84495f8

URL: https://github.com/llvm/llvm-project/commit/ba118f30676d44025885f422e29fe853a84495f8
DIFF: https://github.com/llvm/llvm-project/commit/ba118f30676d44025885f422e29fe853a84495f8.diff

LOG: [clang] NFCI: Use DirectoryEntryRef in FrontendAction::BeginSourceFile()

This patch removes use of the deprecated `DirectoryEntry::getName()` from `FrontendAction::BeginSourceFile()`.

Reviewed By: bnbarham

Differential Revision: https://reviews.llvm.org/D123853

Added: 
    

Modified: 
    clang/lib/Frontend/FrontendAction.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp
index 45245f3f0fef4..68c70dda12b9e 100644
--- a/clang/lib/Frontend/FrontendAction.cpp
+++ b/clang/lib/Frontend/FrontendAction.cpp
@@ -761,10 +761,10 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
     PreprocessorOptions &PPOpts = CI.getPreprocessorOpts();
     StringRef PCHInclude = PPOpts.ImplicitPCHInclude;
     std::string SpecificModuleCachePath = CI.getSpecificModuleCachePath();
-    if (auto PCHDir = FileMgr.getDirectory(PCHInclude)) {
+    if (auto PCHDir = FileMgr.getOptionalDirectoryRef(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),


        


More information about the cfe-commits mailing list