DOTGraphTraits: Allow the decision to show a graph to consider the analysis
[oota-llvm.git] / include / llvm / Analysis / DOTGraphTraitsPass.h
index 3b2c0cb2b15e5f08162130d9fc2b5ef021f60b08..ca50ee2f829a55d82832b0c643b2507201190d7c 100644 (file)
@@ -40,15 +40,19 @@ public:
   ///
   /// An implementation of this class my override this function to indicate that
   /// only certain functions should be viewed.
-  virtual bool processFunction(Function &F) {
+  ///
+  /// @param Analysis The current analysis result for this function.
+  virtual bool processFunction(Function &F, AnalysisT &Analysis) {
     return true;
   }
 
   bool runOnFunction(Function &F) override {
-    if (!processFunction(F))
+    auto &Analysis = getAnalysis<AnalysisT>();
+
+    if (!processFunction(F, Analysis))
       return false;
 
-    GraphT Graph = AnalysisGraphTraitsT::getGraph(&getAnalysis<AnalysisT>());
+    GraphT Graph = AnalysisGraphTraitsT::getGraph(&Analysis);
     std::string GraphName = DOTGraphTraits<GraphT>::getGraphName(Graph);
     std::string Title = GraphName + " for '" + F.getName().str() + "' function";
 
@@ -78,15 +82,19 @@ public:
   ///
   /// An implementation of this class my override this function to indicate that
   /// only certain functions should be printed.
-  virtual bool processFunction(Function &F) {
+  ///
+  /// @param Analysis The current analysis result for this function.
+  virtual bool processFunction(Function &F, AnalysisT &Analysis) {
     return true;
   }
 
   bool runOnFunction(Function &F) override {
-    if (!processFunction(F))
+    auto &Analysis = getAnalysis<AnalysisT>();
+
+    if (!processFunction(F, Analysis))
       return false;
 
-    GraphT Graph = AnalysisGraphTraitsT::getGraph(&getAnalysis<AnalysisT>());
+    GraphT Graph = AnalysisGraphTraitsT::getGraph(&Analysis);
     std::string Filename = Name + "." + F.getName().str() + ".dot";
     std::error_code EC;