[PATCH] D145346: [clang][ast]: refactor printstmt merge the two for loop

xufei via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 5 18:46:24 PST 2023


zkkxu created this revision.
zkkxu added reviewers: arcbbb, craig.topper.
Herald added a project: All.
zkkxu requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

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
@@ -104,17 +104,20 @@
   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;
+  for (int i = 0; i != Stmt::lastStmtConstant + 1; i++) {
+    if (StmtClassInfo[i].Name == nullptr)
+      continue;
     sum += StmtClassInfo[i].Counter;
-    if (StmtClassInfo[i].Counter == 0) 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
+                 << " each ("
+                 << StmtClassInfo[i].Counter * StmtClassInfo[i].Size
                  << " bytes)\n";
-    total_bytes += StmtClassInfo[i].Counter*StmtClassInfo[i].Size;
+    total_bytes += StmtClassInfo[i].Counter * StmtClassInfo[i].Size;
   }
-  
+
   llvm::errs() << "  " << sum << " stmts/exprs total.\n";
   llvm::errs() << "Total bytes = " << total_bytes << "\n";
 }


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


More information about the cfe-commits mailing list