diff options
Diffstat (limited to 'lib/Analysis/CallGraphSCCPass.cpp')
-rw-r--r-- | lib/Analysis/CallGraphSCCPass.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/Analysis/CallGraphSCCPass.cpp b/lib/Analysis/CallGraphSCCPass.cpp index 9cef78144150..ea70f5752c61 100644 --- a/lib/Analysis/CallGraphSCCPass.cpp +++ b/lib/Analysis/CallGraphSCCPass.cpp @@ -609,16 +609,28 @@ namespace { } bool runOnSCC(CallGraphSCC &SCC) override { - Out << Banner; + 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 (isFunctionInPrintList(CGN->getFunction()->getName())) { + PrintBannerOnce(); CGN->getFunction()->print(Out); - } else + } + } else if (llvm::isFunctionInPrintList("*")) { + PrintBannerOnce(); Out << "\nPrinting <null> Function\n"; + } } return false; } + + StringRef getPassName() const override { return "Print CallGraph IR"; } }; } // end anonymous namespace. |