[clang] 7eb0466 - Prefer `getCurrentFileOrBufferName` in `FrontendAction::EndSourceFile`

Yuki Okushi via cfe-commits cfe-commits at lists.llvm.org
Sat Jun 18 07:48:46 PDT 2022


Author: Yuki Okushi
Date: 2022-06-18T23:48:30+09:00
New Revision: 7eb046624f2a35f32f0821c91ad5c6a26f250e5f

URL: https://github.com/llvm/llvm-project/commit/7eb046624f2a35f32f0821c91ad5c6a26f250e5f
DIFF: https://github.com/llvm/llvm-project/commit/7eb046624f2a35f32f0821c91ad5c6a26f250e5f.diff

LOG: Prefer `getCurrentFileOrBufferName` in `FrontendAction::EndSourceFile`

`getCurrentFile` here causes an assertion on some condition.
`getCurrentFileOrBufferName` is preferrable instead.

llvm#55950

Differential Revision: https://reviews.llvm.org/D127509

Added: 
    

Modified: 
    clang/lib/Frontend/FrontendAction.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp
index 6b1f6364b13c3..65160dd7e0b18 100644
--- a/clang/lib/Frontend/FrontendAction.cpp
+++ b/clang/lib/Frontend/FrontendAction.cpp
@@ -1075,7 +1075,7 @@ void FrontendAction::EndSourceFile() {
   }
 
   if (CI.getFrontendOpts().ShowStats) {
-    llvm::errs() << "\nSTATISTICS FOR '" << getCurrentFile() << "':\n";
+    llvm::errs() << "\nSTATISTICS FOR '" << getCurrentFileOrBufferName() << "':\n";
     CI.getPreprocessor().PrintStats();
     CI.getPreprocessor().getIdentifierTable().PrintStats();
     CI.getPreprocessor().getHeaderSearchInfo().PrintStats();


        


More information about the cfe-commits mailing list