[clang] 6587d9d - [clang] NFCI: Use `DirectoryEntryRef` for `ModuleMap::BuiltinIncludeDir`

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Wed May 31 14:54:50 PDT 2023


Author: Jan Svoboda
Date: 2023-05-31T14:54:42-07:00
New Revision: 6587d9d87a58b08e86484ab25a121c3bfeb68949

URL: https://github.com/llvm/llvm-project/commit/6587d9d87a58b08e86484ab25a121c3bfeb68949
DIFF: https://github.com/llvm/llvm-project/commit/6587d9d87a58b08e86484ab25a121c3bfeb68949.diff

LOG: [clang] NFCI: Use `DirectoryEntryRef` for `ModuleMap::BuiltinIncludeDir`

This removes some uses of the deprecated `DirectoryEntry::getName()`.

Added: 
    

Modified: 
    clang/include/clang/Lex/ModuleMap.h
    clang/lib/Lex/InitHeaderSearch.cpp

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Lex/ModuleMap.h b/clang/include/clang/Lex/ModuleMap.h
index 79cf0afc46271..e28147c7be080 100644
--- a/clang/include/clang/Lex/ModuleMap.h
+++ b/clang/include/clang/Lex/ModuleMap.h
@@ -84,7 +84,7 @@ class ModuleMap {
 
   /// The directory used for Clang-supplied, builtin include headers,
   /// such as "stdint.h".
-  const DirectoryEntry *BuiltinIncludeDir = nullptr;
+  OptionalDirectoryEntryRefDegradesToDirectoryEntryPtr BuiltinIncludeDir;
 
   /// Language options used to parse the module map itself.
   ///
@@ -407,7 +407,7 @@ class ModuleMap {
 
   /// Set the directory that contains Clang-supplied include
   /// files, such as our stdarg.h or tgmath.h.
-  void setBuiltinIncludeDir(const DirectoryEntry *Dir) {
+  void setBuiltinIncludeDir(DirectoryEntryRef Dir) {
     BuiltinIncludeDir = Dir;
   }
 

diff  --git a/clang/lib/Lex/InitHeaderSearch.cpp b/clang/lib/Lex/InitHeaderSearch.cpp
index 313efb36bcc93..41382d7cb3fc6 100644
--- a/clang/lib/Lex/InitHeaderSearch.cpp
+++ b/clang/lib/Lex/InitHeaderSearch.cpp
@@ -652,7 +652,7 @@ void clang::ApplyHeaderSearchOptions(HeaderSearch &HS,
     // Set up the builtin include directory in the module map.
     SmallString<128> P = StringRef(HSOpts.ResourceDir);
     llvm::sys::path::append(P, "include");
-    if (auto Dir = HS.getFileMgr().getDirectory(P))
+    if (auto Dir = HS.getFileMgr().getOptionalDirectoryRef(P))
       HS.getModuleMap().setBuiltinIncludeDir(*Dir);
   }
 


        


More information about the cfe-commits mailing list