Address http://bugs.llvm.org/pr32207 by making BannerPrinted local to runOnSCC and skipping banner for function declarations.

Reviewed By: Mehdi AMINI

Differential Revision: https://reviews.llvm.org/D34086

llvm-svn: 305179
This commit is contained in:
Yaron Keren 2017-06-12 02:18:50 +00:00
parent dffec3d678
commit 7d46392124
1 changed files with 4 additions and 4 deletions

View File

@ -608,18 +608,18 @@ namespace {
}
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();