[clang] 20edfae - [clang] NFCI: Use `DirectoryEntryRef` in `ASTWriter`

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


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

URL: https://github.com/llvm/llvm-project/commit/20edfaeef7c55bc6ef320ffe1dcb82b88583c92c
DIFF: https://github.com/llvm/llvm-project/commit/20edfaeef7c55bc6ef320ffe1dcb82b88583c92c.diff

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

This removes the call to deprecated `DirectoryEntry::getName()`.

Added: 
    

Modified: 
    clang/lib/Serialization/ASTWriter.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index 63d91708aeb02..6fa2cd681b191 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -1280,8 +1280,9 @@ void ASTWriter::WriteControlBlock(Preprocessor &PP, ASTContext &Context,
     SmallString<128> BaseDir;
     if (PP.getHeaderSearchInfo().getHeaderSearchOpts().ModuleFileHomeIsCwd) {
       // Use the current working directory as the base path for all inputs.
-      auto *CWD =
-          Context.getSourceManager().getFileManager().getDirectory(".").get();
+      auto CWD =
+          Context.getSourceManager().getFileManager().getOptionalDirectoryRef(
+              ".");
       BaseDir.assign(CWD->getName());
     } else {
       BaseDir.assign(WritingModule->Directory->getName());


        


More information about the cfe-commits mailing list