[clang] 54e4772 - [clang] NFCI: Use `DirectoryEntryRef` in `PrecompiledPreamble`

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


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

URL: https://github.com/llvm/llvm-project/commit/54e47724cfbf12dce05412c5b127ae311066afb3
DIFF: https://github.com/llvm/llvm-project/commit/54e47724cfbf12dce05412c5b127ae311066afb3.diff

LOG: [clang] NFCI: Use `DirectoryEntryRef` in `PrecompiledPreamble`

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

Added: 
    

Modified: 
    clang/lib/Frontend/PrecompiledPreamble.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Frontend/PrecompiledPreamble.cpp b/clang/lib/Frontend/PrecompiledPreamble.cpp
index a47d2b0be004c..5ffb54e2fdf65 100644
--- a/clang/lib/Frontend/PrecompiledPreamble.cpp
+++ b/clang/lib/Frontend/PrecompiledPreamble.cpp
@@ -113,16 +113,16 @@ class MissingFileCollector : public PPCallbacks {
 
     // Reconstruct the filenames that would satisfy this directive...
     llvm::SmallString<256> Buf;
-    auto NotFoundRelativeTo = [&](const DirectoryEntry *DE) {
-      Buf = DE->getName();
+    auto NotFoundRelativeTo = [&](DirectoryEntryRef DE) {
+      Buf = DE.getName();
       llvm::sys::path::append(Buf, FileName);
       llvm::sys::path::remove_dots(Buf, /*remove_dot_dot=*/true);
       Out.insert(Buf);
     };
     // ...relative to the including file.
     if (!IsAngled) {
-      if (const FileEntry *IncludingFile =
-              SM.getFileEntryForID(SM.getFileID(IncludeTok.getLocation())))
+      if (OptionalFileEntryRef IncludingFile =
+              SM.getFileEntryRefForID(SM.getFileID(IncludeTok.getLocation())))
         if (IncludingFile->getDir())
           NotFoundRelativeTo(IncludingFile->getDir());
     }
@@ -132,7 +132,7 @@ class MissingFileCollector : public PPCallbacks {
              Search.search_dir_end())) {
       // No support for frameworks or header maps yet.
       if (Dir.isNormalDir())
-        NotFoundRelativeTo(Dir.getDir());
+        NotFoundRelativeTo(*Dir.getDirRef());
     }
   }
 };


        


More information about the cfe-commits mailing list