[clang] 65331da - Partially revert "[clang] NFCI: Adopt `SourceManager::getFileEntryRefForID()`"

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 6 11:59:47 PDT 2023


Author: Jan Svoboda
Date: 2023-09-06T11:59:40-07:00
New Revision: 65331da0032ab4253a4bc0ddcb2da67664bd86a9

URL: https://github.com/llvm/llvm-project/commit/65331da0032ab4253a4bc0ddcb2da67664bd86a9
DIFF: https://github.com/llvm/llvm-project/commit/65331da0032ab4253a4bc0ddcb2da67664bd86a9.diff

LOG: Partially revert "[clang] NFCI: Adopt `SourceManager::getFileEntryRefForID()`"

This commit partially reverts ddbcc10b to fix `clang-tools-extra/test/clang-tidy/infrastructure/clang-tidy-run-with-database.cpp`.

Added: 
    

Modified: 
    clang/lib/Rewrite/Rewriter.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Rewrite/Rewriter.cpp b/clang/lib/Rewrite/Rewriter.cpp
index ae04b51192d93ec..ef2858990dd954e 100644
--- a/clang/lib/Rewrite/Rewriter.cpp
+++ b/clang/lib/Rewrite/Rewriter.cpp
@@ -412,7 +412,7 @@ bool Rewriter::overwriteChangedFiles() {
   unsigned OverwriteFailure = Diag.getCustomDiagID(
       DiagnosticsEngine::Error, "unable to overwrite file %0: %1");
   for (buffer_iterator I = buffer_begin(), E = buffer_end(); I != E; ++I) {
-    OptionalFileEntryRef Entry = getSourceMgr().getFileEntryRefForID(I->first);
+    const FileEntry *Entry = getSourceMgr().getFileEntryForID(I->first);
     if (auto Error =
             llvm::writeToOutput(Entry->getName(), [&](llvm::raw_ostream &OS) {
               I->second.write(OS);


        


More information about the cfe-commits mailing list