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();


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to