[llvm] r321079 - [CFGVPrinter] Fix -dot-cfg-only

Francis Visoiu Mistrih via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 19 07:20:18 PST 2017


Author: thegameg
Date: Tue Dec 19 07:20:18 2017
New Revision: 321079

URL: http://llvm.org/viewvc/llvm-project?rev=321079&view=rev
Log:
[CFGVPrinter] Fix -dot-cfg-only

The refactoring in r281640 made -dot-cfg-only ignore the "-only" part.

Modified:
    llvm/trunk/lib/Analysis/CFGPrinter.cpp

Modified: llvm/trunk/lib/Analysis/CFGPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/CFGPrinter.cpp?rev=321079&r1=321078&r2=321079&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/CFGPrinter.cpp (original)
+++ llvm/trunk/lib/Analysis/CFGPrinter.cpp Tue Dec 19 07:20:18 2017
@@ -82,7 +82,7 @@ PreservedAnalyses CFGOnlyViewerPass::run
   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 @@ static void writeCFGToDotFile(Function &
   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 @@ namespace {
     }
 
     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 @@ INITIALIZE_PASS(CFGOnlyPrinterLegacyPass
 
 PreservedAnalyses CFGOnlyPrinterPass::run(Function &F,
                                           FunctionAnalysisManager &AM) {
-  writeCFGToDotFile(F);
+  writeCFGToDotFile(F, /*CFGOnly=*/true);
   return PreservedAnalyses::all();
 }
 




More information about the llvm-commits mailing list