Author: Jan Svoboda
Date: 2023-05-30T13:54:06-07:00
New Revision: 32d6f3cfd90b90321e84477b2bd353afbf9876ea

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

LOG: [clang] NFCI: Use DirectoryEntryRef in Module::Directory

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Basic/Module.h 
b/clang/include/clang/Basic/Module.h
index 128e2adc189b2..3ecab422bc42c 100644
--- a/clang/include/clang/Basic/Module.h
+++ b/clang/include/clang/Basic/Module.h
@@ -149,7 +149,7 @@ class alignas(8) Module {
   /// 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.

diff  --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp
index 833287c665167..6808fdfdaf4f9 100644
--- a/clang/lib/Lex/ModuleMap.cpp
+++ b/clang/lib/Lex/ModuleMap.cpp
@@ -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 {


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to