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

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 11 19:19:32 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL305179: Address http://bugs.llvm.org/pr32207 by making BannerPrinted local to runOnSCC… (authored by yrnkrn).

Changed prior to commit:
  https://reviews.llvm.org/D34086?vs=102129&id=102152#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D34086

Files:
  llvm/trunk/lib/Analysis/CallGraphSCCPass.cpp


Index: llvm/trunk/lib/Analysis/CallGraphSCCPass.cpp
===================================================================
--- llvm/trunk/lib/Analysis/CallGraphSCCPass.cpp
+++ llvm/trunk/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.102152.patch
Type: text/x-patch
Size: 1006 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170612/d71e6594/attachment.bin>


More information about the llvm-commits mailing list