[CFGVPrinter] Fix -dot-cfg-only
The refactoring in r281640 made -dot-cfg-only ignore the "-only" part.
llvm-svn: 321079
diff --git a/llvm/lib/Analysis/CFGPrinter.cpp b/llvm/lib/Analysis/CFGPrinter.cpp
index a85af6c..fb26175 100644
--- a/llvm/lib/Analysis/CFGPrinter.cpp
+++ b/llvm/lib/Analysis/CFGPrinter.cpp
@@ -82,7 +82,7 @@
return PreservedAnalyses::all();
}
-static void writeCFGToDotFile(Function &F) {
+static void writeCFGToDotFile(Function &F, bool CFGOnly = false) {
std::string Filename = ("cfg." + F.getName() + ".dot").str();
errs() << "Writing '" << Filename << "'...";
@@ -90,7 +90,7 @@
raw_fd_ostream File(Filename, EC, sys::fs::F_Text);
if (!EC)
- WriteGraph(File, (const Function*)&F);
+ WriteGraph(File, (const Function*)&F, CFGOnly);
else
errs() << " error opening file for writing!";
errs() << "\n";
@@ -134,7 +134,7 @@
}
bool runOnFunction(Function &F) override {
- writeCFGToDotFile(F);
+ writeCFGToDotFile(F, /*CFGOnly=*/true);
return false;
}
void print(raw_ostream &OS, const Module* = nullptr) const override {}
@@ -152,7 +152,7 @@
PreservedAnalyses CFGOnlyPrinterPass::run(Function &F,
FunctionAnalysisManager &AM) {
- writeCFGToDotFile(F);
+ writeCFGToDotFile(F, /*CFGOnly=*/true);
return PreservedAnalyses::all();
}