Static Value-Flow Analysis
Loading...
Searching...
No Matches
DOTGraphTraits.h
Go to the documentation of this file.
1//===-- Graphs/DOTGraphTraits.h - Customize .dot output ---*- C++ -*-===//
2//
3// From the LLVM Project with some modifications, under the Apache License v2.0
4// with LLVM Exceptions. See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines a template class that can be used to customize dot output
10// graphs generated by the GraphWriter.h file. The default implementation of
11// this file will produce a simple, but not very polished graph. By
12// specializing this template, lots of customization opportunities are possible.
13//
14//===----------------------------------------------------------------------===//
15
16#ifndef GRAPHS_DOTGRAPHTRAITS_H
17#define GRAPHS_DOTGRAPHTRAITS_H
18
19#include <string>
20
21namespace SVF
22{
23
30{
31private:
33
34protected:
35 bool isSimple()
36 {
37 return IsSimple;
38 }
39
40public:
41 explicit DefaultDOTGraphTraits(bool simple=false) : IsSimple (simple) {}
42
46 template<typename GraphType>
47 static std::string getGraphName(const GraphType &)
48 {
49 return "";
50 }
51
55 template<typename GraphType>
56 static std::string getGraphProperties(const GraphType &)
57 {
58 return "";
59 }
60
65 {
66 return false;
67 }
68
74 template <typename NodeT>
75 static const void *getNodeIdentifier(NodeT N)
76 {
77 return static_cast<const void *>(N);
78 }
79
82 template <typename NodeT, typename GraphType>
83 static bool isNodeHidden(NodeT, const GraphType &)
84 {
85 return false;
86 }
87
90 template<typename NodeT, typename GraphType>
91 std::string getNodeLabel(NodeT, const GraphType &)
92 {
93 return "";
94 }
95
96 // getNodeIdentifierLabel - Returns a string representing the
97 // address or other unique identifier of the node. (Only used if
98 // non-empty.)
99 template <typename NodeT, typename GraphType>
100 static std::string getNodeIdentifierLabel(NodeT, const GraphType &)
101 {
102 return "";
103 }
104
105 template<typename NodeT, typename GraphType>
106 static std::string getNodeDescription(NodeT, const GraphType &)
107 {
108 return "";
109 }
110
113 template<typename NodeT, typename GraphType>
114 static std::string getNodeAttributes(NodeT,
115 const GraphType &)
116 {
117 return "";
118 }
119
122 template<typename NodeT, typename EdgeIter, typename GraphType>
123 static std::string getEdgeAttributes(NodeT, EdgeIter,
124 const GraphType &)
125 {
126 return "";
127 }
128
131 template<typename NodeT, typename EdgeIter>
132 static std::string getEdgeSourceLabel(NodeT, EdgeIter)
133 {
134 return "";
135 }
136
140 template<typename NodeT, typename EdgeIter>
141 static bool edgeTargetsEdgeSource(NodeT, EdgeIter)
142 {
143 return false;
144 }
145
149 template<typename NodeT, typename EdgeIter>
151 {
152 return I;
153 }
154
157 static bool hasEdgeDestLabels()
158 {
159 return false;
160 }
161
164 template<typename NodeT>
165 static unsigned numEdgeDestLabels(NodeT)
166 {
167 return 0;
168 }
169
172 template<typename NodeT>
173 static std::string getEdgeDestLabel(NodeT, unsigned)
174 {
175 return "";
176 }
177
184 template<typename GraphType, typename GraphWriter>
186};
187
188
193template <typename Ty>
198
199} // End llvm namespace
200
201#endif
for isBitcode
Definition BasicTypes.h:70
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:76
DOTGraphTraits(bool simple=false)
static std::string getNodeIdentifierLabel(NodeT, const GraphType &)
DefaultDOTGraphTraits(bool simple=false)
static EdgeIter getEdgeTarget(NodeT, EdgeIter I)
static std::string getGraphName(const GraphType &)
static void addCustomGraphFeatures(const GraphType &, GraphWriter &)
static std::string getEdgeSourceLabel(NodeT, EdgeIter)
static std::string getNodeAttributes(NodeT, const GraphType &)
static const void * getNodeIdentifier(NodeT N)
static std::string getEdgeAttributes(NodeT, EdgeIter, const GraphType &)
std::string getNodeLabel(NodeT, const GraphType &)
static unsigned numEdgeDestLabels(NodeT)
static std::string getEdgeDestLabel(NodeT, unsigned)
static bool renderGraphFromBottomUp()
static bool edgeTargetsEdgeSource(NodeT, EdgeIter)
static std::string getNodeDescription(NodeT, const GraphType &)
static bool isNodeHidden(NodeT, const GraphType &)
static std::string getGraphProperties(const GraphType &)