Static Value-Flow Analysis
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 
21 namespace SVF
22 {
23 
30 {
31 private:
32  bool IsSimple;
33 
34 protected:
35  bool isSimple()
36  {
37  return IsSimple;
38  }
39 
40 public:
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 
71  template <typename GraphType>
72  static bool isNodeHidden(const void *, const GraphType &)
73  {
74  return false;
75  }
76 
79  template<typename GraphType>
80  std::string getNodeLabel(const void *, const GraphType &)
81  {
82  return "";
83  }
84 
85  // getNodeIdentifierLabel - Returns a string representing the
86  // address or other unique identifier of the node. (Only used if
87  // non-empty.)
88  template <typename GraphType>
89  static std::string getNodeIdentifierLabel(const void *, const GraphType &)
90  {
91  return "";
92  }
93 
94  template<typename GraphType>
95  static std::string getNodeDescription(const void *, const GraphType &)
96  {
97  return "";
98  }
99 
102  template<typename GraphType>
103  static std::string getNodeAttributes(const void *,
104  const GraphType &)
105  {
106  return "";
107  }
108 
111  template<typename EdgeIter, typename GraphType>
112  static std::string getEdgeAttributes(const void *, EdgeIter,
113  const GraphType &)
114  {
115  return "";
116  }
117 
120  template<typename EdgeIter>
121  static std::string getEdgeSourceLabel(const void *, EdgeIter)
122  {
123  return "";
124  }
125 
129  template<typename EdgeIter>
130  static bool edgeTargetsEdgeSource(const void *, EdgeIter)
131  {
132  return false;
133  }
134 
138  template<typename EdgeIter>
139  static EdgeIter getEdgeTarget(const void *, EdgeIter I)
140  {
141  return I;
142  }
143 
146  static bool hasEdgeDestLabels()
147  {
148  return false;
149  }
150 
153  static unsigned numEdgeDestLabels(const void *)
154  {
155  return 0;
156  }
157 
160  static std::string getEdgeDestLabel(const void *, unsigned)
161  {
162  return "";
163  }
164 
171  template<typename GraphType, typename GraphWriter>
172  static void addCustomGraphFeatures(const GraphType &, GraphWriter &) {}
173 };
174 
175 
180 template <typename Ty>
182 {
183  DOTGraphTraits (bool simple=false) : DefaultDOTGraphTraits (simple) {}
184 };
185 
186 } // End llvm namespace
187 
188 #endif
const char *const string
Definition: cJSON.h:172
for isBitcode
Definition: BasicTypes.h:68
DOTGraphTraits(bool simple=false)
std::string getNodeLabel(const void *, const GraphType &)
static std::string getNodeIdentifierLabel(const void *, const GraphType &)
DefaultDOTGraphTraits(bool simple=false)
static std::string getNodeAttributes(const void *, const GraphType &)
static std::string getGraphName(const GraphType &)
static void addCustomGraphFeatures(const GraphType &, GraphWriter &)
static std::string getEdgeDestLabel(const void *, unsigned)
static std::string getEdgeSourceLabel(const void *, EdgeIter)
static bool edgeTargetsEdgeSource(const void *, EdgeIter)
static unsigned numEdgeDestLabels(const void *)
static EdgeIter getEdgeTarget(const void *, EdgeIter I)
static std::string getEdgeAttributes(const void *, EdgeIter, const GraphType &)
static bool isNodeHidden(const void *, const GraphType &)
static bool renderGraphFromBottomUp()
static std::string getNodeDescription(const void *, const GraphType &)
static std::string getGraphProperties(const GraphType &)