[clang] NFCI: Use DirectoryEntryRef in Module::Directory
authorJan Svoboda <jan_svoboda@apple.com>
Thu, 25 May 2023 21:37:20 +0000 (14:37 -0700)
committerJan Svoboda <jan_svoboda@apple.com>
Tue, 30 May 2023 20:54:06 +0000 (13:54 -0700)
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.

Reviewed By: bnbarham

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

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

index 128e2ad..3ecab42 100644 (file)
@@ -149,7 +149,7 @@ public:
   /// 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.
index 833287c..6808fdf 100644 (file)
@@ -181,7 +181,7 @@ OptionalFileEntryRef ModuleMap::findHeader(
     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) -> OptionalFileEntryRef {