[PATCH] D145346: [NFC] Format printstmt

xufei via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 5 20:10:08 PST 2023


zkkxu updated this revision to Diff 502510.
zkkxu added a comment.



1. Updating D145346 <https://reviews.llvm.org/D145346>: [NFC] Format printstmt #
2. Enter a brief description of the changes included in this update.
3. The first line is used as subject, next lines as comment. #
4. If you intended to create a new revision, use:
5. $ arc diff --create

up


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145346/new/

https://reviews.llvm.org/D145346

Files:
  clang/lib/AST/Stmt.cpp


Index: clang/lib/AST/Stmt.cpp
===================================================================
--- clang/lib/AST/Stmt.cpp
+++ clang/lib/AST/Stmt.cpp
@@ -102,24 +102,21 @@
   getStmtInfoTableEntry(Stmt::NullStmtClass);
 
   unsigned sum = 0;
+  unsigned total_bytes = 0;
   llvm::errs() << "\n*** Stmt/Expr Stats:\n";
   for (int i = 0; i != Stmt::lastStmtConstant+1; i++) {
     if (StmtClassInfo[i].Name == nullptr) continue;
     sum += StmtClassInfo[i].Counter;
-  }
-  llvm::errs() << "  " << sum << " stmts/exprs total.\n";
-  sum = 0;
-  for (int i = 0; i != Stmt::lastStmtConstant+1; i++) {
-    if (StmtClassInfo[i].Name == nullptr) continue;
     if (StmtClassInfo[i].Counter == 0) continue;
     llvm::errs() << "    " << StmtClassInfo[i].Counter << " "
                  << StmtClassInfo[i].Name << ", " << StmtClassInfo[i].Size
                  << " each (" << StmtClassInfo[i].Counter*StmtClassInfo[i].Size
                  << " bytes)\n";
-    sum += StmtClassInfo[i].Counter*StmtClassInfo[i].Size;
+    total_bytes += StmtClassInfo[i].Counter*StmtClassInfo[i].Size;
   }
-
-  llvm::errs() << "Total bytes = " << sum << "\n";
+  
+  llvm::errs() << "  " << sum << " stmts/exprs total.\n";
+  llvm::errs() << "Total bytes = " << total_bytes << "\n";
 }
 
 void Stmt::addStmtClass(StmtClass s) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145346.502510.patch
Type: text/x-patch
Size: 1313 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230306/2e94d8bd/attachment.bin>


More information about the cfe-commits mailing list