[PATCH] D127654: [clang] NFCI: Use DirectoryEntryRef in Module::Directory

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 13 08:29:09 PDT 2022


jansvoboda11 created this revision.
jansvoboda11 added a reviewer: 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 changes the type of `Module::Directory` from `const DirectoryEntry *` to (essentially) `Optional<DirectoryEntryRef>` in order to remove uses of the deprecated `DirectoryEntry::getName()`.

Depends on D127651 <https://reviews.llvm.org/D127651>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D127654

Files:
  clang/include/clang/Basic/Module.h
  clang/lib/Lex/ModuleMap.cpp


Index: clang/lib/Lex/ModuleMap.cpp
===================================================================
--- clang/lib/Lex/ModuleMap.cpp
+++ clang/lib/Lex/ModuleMap.cpp
@@ -175,7 +175,7 @@
     Module *M, const Module::UnresolvedHeaderDirective &Header,
     SmallVectorImpl<char> &RelativePathName, bool &NeedsFramework) {
   // Search for the header file within the module's home directory.
-  auto *Directory = M->Directory;
+  auto Directory = M->Directory;
   SmallString<128> FullPathName(Directory->getName());
 
   auto GetFile = [&](StringRef Filename) -> Optional<FileEntryRef> {
Index: clang/include/clang/Basic/Module.h
===================================================================
--- clang/include/clang/Basic/Module.h
+++ clang/include/clang/Basic/Module.h
@@ -135,7 +135,7 @@
   /// The build directory of this module. This is the directory in
   /// which the module is notionally built, and relative to which its headers
   /// are found.
-  const DirectoryEntry *Directory = nullptr;
+  OptionalDirectoryEntryRefDegradesToDirectoryEntryPtr Directory;
 
   /// The presumed file name for the module map defining this module.
   /// Only non-empty when building from preprocessed source.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127654.436408.patch
Type: text/x-patch
Size: 1209 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220613/1556ddef/attachment.bin>


More information about the cfe-commits mailing list