summaryrefslogtreecommitdiffstats
path: root/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/include/llvm/Analysis/DOTGraphTraitsPass.h')
-rw-r--r--llvm/include/llvm/Analysis/DOTGraphTraitsPass.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h b/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h
index cb74e9f32d3..3b2c0cb2b15 100644
--- a/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h
+++ b/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h
@@ -36,7 +36,18 @@ public:
DOTGraphTraitsViewer(StringRef GraphName, char &ID)
: FunctionPass(ID), Name(GraphName) {}
+ /// @brief Return true if this function should be processed.
+ ///
+ /// An implementation of this class my override this function to indicate that
+ /// only certain functions should be viewed.
+ virtual bool processFunction(Function &F) {
+ return true;
+ }
+
bool runOnFunction(Function &F) override {
+ if (!processFunction(F))
+ return false;
+
GraphT Graph = AnalysisGraphTraitsT::getGraph(&getAnalysis<AnalysisT>());
std::string GraphName = DOTGraphTraits<GraphT>::getGraphName(Graph);
std::string Title = GraphName + " for '" + F.getName().str() + "' function";
@@ -63,7 +74,18 @@ public:
DOTGraphTraitsPrinter(StringRef GraphName, char &ID)
: FunctionPass(ID), Name(GraphName) {}
+ /// @brief Return true if this function should be processed.
+ ///
+ /// An implementation of this class my override this function to indicate that
+ /// only certain functions should be printed.
+ virtual bool processFunction(Function &F) {
+ return true;
+ }
+
bool runOnFunction(Function &F) override {
+ if (!processFunction(F))
+ return false;
+
GraphT Graph = AnalysisGraphTraitsT::getGraph(&getAnalysis<AnalysisT>());
std::string Filename = Name + "." + F.getName().str() + ".dot";
std::error_code EC;
OpenPOWER on IntegriCloud