[PATCH] D145346: [NFC] Format printstmt

xufei via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 6 01:52:43 PST 2023


zkkxu updated this revision to Diff 502557.
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

format


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.502557.patch
Type: text/x-patch
Size: 1313 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230306/c6deb87f/attachment.bin>


More information about the cfe-commits mailing list