[PATCH] D34086: Fix -print-after-all banner

Yaron Keren via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 11 01:30:14 PDT 2017


yaron.keren created this revision.

Address https://bugs.llvm.org/show_bug.cgi?id=32207, banner does not print more than once following r292442 by making BannerPrinted local and skipping banner for function declarations.


Repository:
  rL LLVM

https://reviews.llvm.org/D34086

Files:
  lib/Analysis/CallGraphSCCPass.cpp


Index: lib/Analysis/CallGraphSCCPass.cpp
===================================================================
--- lib/Analysis/CallGraphSCCPass.cpp
+++ lib/Analysis/CallGraphSCCPass.cpp
@@ -608,18 +608,18 @@
     }
 
     bool runOnSCC(CallGraphSCC &SCC) override {
+      bool BannerPrinted = false;
       auto PrintBannerOnce = [&] () {
-        static bool BannerPrinted = false;
         if (BannerPrinted)
           return;
         Out << Banner;
         BannerPrinted = true;
         };
       for (CallGraphNode *CGN : SCC) {
-        if (CGN->getFunction()) {
-          if (isFunctionInPrintList(CGN->getFunction()->getName())) {
+        if (Function *F = CGN->getFunction()) {
+          if (!F->isDeclaration() && isFunctionInPrintList(F->getName())) {
             PrintBannerOnce();
-            CGN->getFunction()->print(Out);
+            F->print(Out);
           }
         } else if (llvm::isFunctionInPrintList("*")) {
           PrintBannerOnce();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34086.102129.patch
Type: text/x-patch
Size: 973 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170611/5f0625d7/attachment.bin>


More information about the llvm-commits mailing list