[PATCH] D123769: [clang] NFCI: Use DirectoryEntryRef in collectIncludePCH

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 14 01:54:43 PDT 2022


jansvoboda11 created this revision.
jansvoboda11 added reviewers: dexonsmith, bnbarham.
Herald added a project: All.
jansvoboda11 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This patch removes use of the deprecated `DirectoryEntry::getName()` from `collectIncludePCH` by using `{File,Directory}EntryRef` instead.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D123769

Files:
  clang/lib/Frontend/CompilerInstance.cpp


Index: clang/lib/Frontend/CompilerInstance.cpp
===================================================================
--- clang/lib/Frontend/CompilerInstance.cpp
+++ clang/lib/Frontend/CompilerInstance.cpp
@@ -232,7 +232,7 @@
 
   StringRef PCHInclude = PPOpts.ImplicitPCHInclude;
   FileManager &FileMgr = CI.getFileManager();
-  auto PCHDir = FileMgr.getDirectory(PCHInclude);
+  auto PCHDir = FileMgr.getOptionalDirectoryRef(PCHInclude);
   if (!PCHDir) {
     MDC->addFile(PCHInclude);
     return;
@@ -240,7 +240,7 @@
 
   std::error_code EC;
   SmallString<128> DirNative;
-  llvm::sys::path::native((*PCHDir)->getName(), DirNative);
+  llvm::sys::path::native(PCHDir->getName(), DirNative);
   llvm::vfs::FileSystem &FS = FileMgr.getVirtualFileSystem();
   SimpleASTReaderListener Validator(CI.getPreprocessor());
   for (llvm::vfs::directory_iterator Dir = FS.dir_begin(DirNative, EC), DirEnd;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123769.422774.patch
Type: text/x-patch
Size: 899 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220414/b99aa615/attachment.bin>


More information about the cfe-commits mailing list