[PATCH] D127509: Prefer `getCurrentFileOrBufferName` in `FrontendAction::EndSourceFile`

Yuki Okushi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 10 09:37:10 PDT 2022


JohnTitor created this revision.
Herald added a project: All.
JohnTitor requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

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

llvm#55950


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D127509

Files:
  clang/lib/Frontend/FrontendAction.cpp


Index: clang/lib/Frontend/FrontendAction.cpp
===================================================================
--- clang/lib/Frontend/FrontendAction.cpp
+++ clang/lib/Frontend/FrontendAction.cpp
@@ -1075,7 +1075,7 @@
   }
 
   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();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127509.435953.patch
Type: text/x-patch
Size: 588 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220610/6377779d/attachment-0001.bin>


More information about the cfe-commits mailing list