[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
This commit is contained in:
Jan Svoboda 2022-04-20 18:54:36 +02:00
parent 1d3ba05e4a
commit ba118f3067
1 changed files with 2 additions and 2 deletions

View File

@ -761,10 +761,10 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
PreprocessorOptions &PPOpts = CI.getPreprocessorOpts(); PreprocessorOptions &PPOpts = CI.getPreprocessorOpts();
StringRef PCHInclude = PPOpts.ImplicitPCHInclude; StringRef PCHInclude = PPOpts.ImplicitPCHInclude;
std::string SpecificModuleCachePath = CI.getSpecificModuleCachePath(); std::string SpecificModuleCachePath = CI.getSpecificModuleCachePath();
if (auto PCHDir = FileMgr.getDirectory(PCHInclude)) { if (auto PCHDir = FileMgr.getOptionalDirectoryRef(PCHInclude)) {
std::error_code EC; std::error_code EC;
SmallString<128> DirNative; SmallString<128> DirNative;
llvm::sys::path::native((*PCHDir)->getName(), DirNative); llvm::sys::path::native(PCHDir->getName(), DirNative);
bool Found = false; bool Found = false;
llvm::vfs::FileSystem &FS = FileMgr.getVirtualFileSystem(); llvm::vfs::FileSystem &FS = FileMgr.getVirtualFileSystem();
for (llvm::vfs::directory_iterator Dir = FS.dir_begin(DirNative, EC), for (llvm::vfs::directory_iterator Dir = FS.dir_begin(DirNative, EC),