svf-lib 1.0.1291 → 1.0.1293

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,407 @@
1
+ //===- iterator.h - Utilities for using and defining iterators --*- C++ -*-===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ //
7
+ //===----------------------------------------------------------------------===//
8
+
9
+ #ifndef LLVM_ADT_ITERATOR_H
10
+ #define LLVM_ADT_ITERATOR_H
11
+
12
+ #include "Util/iterator_range.h"
13
+ #include <cstddef>
14
+ #include <iterator>
15
+ #include <type_traits>
16
+ #include <utility>
17
+
18
+ namespace llvm
19
+ {
20
+
21
+ /// CRTP base class which implements the entire standard iterator facade
22
+ /// in terms of a minimal subset of the interface.
23
+ ///
24
+ /// Use this when it is reasonable to implement most of the iterator
25
+ /// functionality in terms of a core subset. If you need special behavior or
26
+ /// there are performance implications for this, you may want to override the
27
+ /// relevant members instead.
28
+ ///
29
+ /// Note, one abstraction that this does *not* provide is implementing
30
+ /// subtraction in terms of addition by negating the difference. Negation isn't
31
+ /// always information preserving, and I can see very reasonable iterator
32
+ /// designs where this doesn't work well. It doesn't really force much added
33
+ /// boilerplate anyways.
34
+ ///
35
+ /// Another abstraction that this doesn't provide is implementing increment in
36
+ /// terms of addition of one. These aren't equivalent for all iterator
37
+ /// categories, and respecting that adds a lot of complexity for little gain.
38
+ ///
39
+ /// Classes wishing to use `iterator_facade_base` should implement the following
40
+ /// methods:
41
+ ///
42
+ /// Forward Iterators:
43
+ /// (All of the following methods)
44
+ /// - DerivedT &operator=(const DerivedT &R);
45
+ /// - bool operator==(const DerivedT &R) const;
46
+ /// - const T &operator*() const;
47
+ /// - T &operator*();
48
+ /// - DerivedT &operator++();
49
+ ///
50
+ /// Bidirectional Iterators:
51
+ /// (All methods of forward iterators, plus the following)
52
+ /// - DerivedT &operator--();
53
+ ///
54
+ /// Random-access Iterators:
55
+ /// (All methods of bidirectional iterators excluding the following)
56
+ /// - DerivedT &operator++();
57
+ /// - DerivedT &operator--();
58
+ /// (and plus the following)
59
+ /// - bool operator<(const DerivedT &RHS) const;
60
+ /// - DifferenceTypeT operator-(const DerivedT &R) const;
61
+ /// - DerivedT &operator+=(DifferenceTypeT N);
62
+ /// - DerivedT &operator-=(DifferenceTypeT N);
63
+ ///
64
+ template <typename DerivedT, typename IteratorCategoryT, typename T,
65
+ typename DifferenceTypeT = std::ptrdiff_t, typename PointerT = T *,
66
+ typename ReferenceT = T &>
67
+ class iterator_facade_base
68
+ {
69
+ public:
70
+ using iterator_category = IteratorCategoryT;
71
+ using value_type = T;
72
+ using difference_type = DifferenceTypeT;
73
+ using pointer = PointerT;
74
+ using reference = ReferenceT;
75
+
76
+ protected:
77
+ enum
78
+ {
79
+ IsRandomAccess = std::is_base_of<std::random_access_iterator_tag,
80
+ IteratorCategoryT>::value,
81
+ IsBidirectional = std::is_base_of<std::bidirectional_iterator_tag,
82
+ IteratorCategoryT>::value,
83
+ };
84
+
85
+ /// A proxy object for computing a reference via indirecting a copy of an
86
+ /// iterator. This is used in APIs which need to produce a reference via
87
+ /// indirection but for which the iterator object might be a temporary. The
88
+ /// proxy preserves the iterator internally and exposes the indirected
89
+ /// reference via a conversion operator.
90
+ class ReferenceProxy
91
+ {
92
+ friend iterator_facade_base;
93
+
94
+ DerivedT I;
95
+
96
+ ReferenceProxy(DerivedT I) : I(std::move(I)) {}
97
+
98
+ public:
99
+ operator ReferenceT() const
100
+ {
101
+ return *I;
102
+ }
103
+ };
104
+
105
+ public:
106
+ DerivedT operator+(DifferenceTypeT n) const
107
+ {
108
+ static_assert(std::is_base_of<iterator_facade_base, DerivedT>::value,
109
+ "Must pass the derived type to this template!");
110
+ static_assert(
111
+ IsRandomAccess,
112
+ "The '+' operator is only defined for random access iterators.");
113
+ DerivedT tmp = *static_cast<const DerivedT *>(this);
114
+ tmp += n;
115
+ return tmp;
116
+ }
117
+ friend DerivedT operator+(DifferenceTypeT n, const DerivedT &i)
118
+ {
119
+ static_assert(
120
+ IsRandomAccess,
121
+ "The '+' operator is only defined for random access iterators.");
122
+ return i + n;
123
+ }
124
+ DerivedT operator-(DifferenceTypeT n) const
125
+ {
126
+ static_assert(
127
+ IsRandomAccess,
128
+ "The '-' operator is only defined for random access iterators.");
129
+ DerivedT tmp = *static_cast<const DerivedT *>(this);
130
+ tmp -= n;
131
+ return tmp;
132
+ }
133
+
134
+ DerivedT &operator++()
135
+ {
136
+ static_assert(std::is_base_of<iterator_facade_base, DerivedT>::value,
137
+ "Must pass the derived type to this template!");
138
+ return static_cast<DerivedT *>(this)->operator+=(1);
139
+ }
140
+ DerivedT operator++(int)
141
+ {
142
+ DerivedT tmp = *static_cast<DerivedT *>(this);
143
+ ++*static_cast<DerivedT *>(this);
144
+ return tmp;
145
+ }
146
+ DerivedT &operator--()
147
+ {
148
+ static_assert(
149
+ IsBidirectional,
150
+ "The decrement operator is only defined for bidirectional iterators.");
151
+ return static_cast<DerivedT *>(this)->operator-=(1);
152
+ }
153
+ DerivedT operator--(int)
154
+ {
155
+ static_assert(
156
+ IsBidirectional,
157
+ "The decrement operator is only defined for bidirectional iterators.");
158
+ DerivedT tmp = *static_cast<DerivedT *>(this);
159
+ --*static_cast<DerivedT *>(this);
160
+ return tmp;
161
+ }
162
+
163
+ #ifndef __cpp_impl_three_way_comparison
164
+ bool operator!=(const DerivedT &RHS) const
165
+ {
166
+ return !(static_cast<const DerivedT &>(*this) == RHS);
167
+ }
168
+ #endif
169
+
170
+ bool operator>(const DerivedT &RHS) const
171
+ {
172
+ static_assert(
173
+ IsRandomAccess,
174
+ "Relational operators are only defined for random access iterators.");
175
+ return !(static_cast<const DerivedT &>(*this) < RHS) &&
176
+ !(static_cast<const DerivedT &>(*this) == RHS);
177
+ }
178
+ bool operator<=(const DerivedT &RHS) const
179
+ {
180
+ static_assert(
181
+ IsRandomAccess,
182
+ "Relational operators are only defined for random access iterators.");
183
+ return !(static_cast<const DerivedT &>(*this) > RHS);
184
+ }
185
+ bool operator>=(const DerivedT &RHS) const
186
+ {
187
+ static_assert(
188
+ IsRandomAccess,
189
+ "Relational operators are only defined for random access iterators.");
190
+ return !(static_cast<const DerivedT &>(*this) < RHS);
191
+ }
192
+
193
+ PointerT operator->()
194
+ {
195
+ return &static_cast<DerivedT *>(this)->operator*();
196
+ }
197
+ PointerT operator->() const
198
+ {
199
+ return &static_cast<const DerivedT *>(this)->operator*();
200
+ }
201
+ ReferenceProxy operator[](DifferenceTypeT n)
202
+ {
203
+ static_assert(IsRandomAccess,
204
+ "Subscripting is only defined for random access iterators.");
205
+ return ReferenceProxy(static_cast<DerivedT *>(this)->operator+(n));
206
+ }
207
+ ReferenceProxy operator[](DifferenceTypeT n) const
208
+ {
209
+ static_assert(IsRandomAccess,
210
+ "Subscripting is only defined for random access iterators.");
211
+ return ReferenceProxy(static_cast<const DerivedT *>(this)->operator+(n));
212
+ }
213
+ };
214
+
215
+ /// CRTP base class for adapting an iterator to a different type.
216
+ ///
217
+ /// This class can be used through CRTP to adapt one iterator into another.
218
+ /// Typically this is done through providing in the derived class a custom \c
219
+ /// operator* implementation. Other methods can be overridden as well.
220
+ template <
221
+ typename DerivedT, typename WrappedIteratorT,
222
+ typename IteratorCategoryT =
223
+ typename std::iterator_traits<WrappedIteratorT>::iterator_category,
224
+ typename T = typename std::iterator_traits<WrappedIteratorT>::value_type,
225
+ typename DifferenceTypeT =
226
+ typename std::iterator_traits<WrappedIteratorT>::difference_type,
227
+ typename PointerT = std::conditional_t<
228
+ std::is_same<T, typename std::iterator_traits<
229
+ WrappedIteratorT>::value_type>::value,
230
+ typename std::iterator_traits<WrappedIteratorT>::pointer, T *>,
231
+ typename ReferenceT = std::conditional_t<
232
+ std::is_same<T, typename std::iterator_traits<
233
+ WrappedIteratorT>::value_type>::value,
234
+ typename std::iterator_traits<WrappedIteratorT>::reference, T &>>
235
+ class iterator_adaptor_base
236
+ : public iterator_facade_base<DerivedT, IteratorCategoryT, T,
237
+ DifferenceTypeT, PointerT, ReferenceT>
238
+ {
239
+ using BaseT = typename iterator_adaptor_base::iterator_facade_base;
240
+
241
+ protected:
242
+ WrappedIteratorT I;
243
+
244
+ iterator_adaptor_base() = default;
245
+
246
+ explicit iterator_adaptor_base(WrappedIteratorT u) : I(std::move(u))
247
+ {
248
+ static_assert(std::is_base_of<iterator_adaptor_base, DerivedT>::value,
249
+ "Must pass the derived type to this template!");
250
+ }
251
+
252
+ const WrappedIteratorT &wrapped() const
253
+ {
254
+ return I;
255
+ }
256
+
257
+ public:
258
+ using difference_type = DifferenceTypeT;
259
+
260
+ DerivedT &operator+=(difference_type n)
261
+ {
262
+ static_assert(
263
+ BaseT::IsRandomAccess,
264
+ "The '+=' operator is only defined for random access iterators.");
265
+ I += n;
266
+ return *static_cast<DerivedT *>(this);
267
+ }
268
+ DerivedT &operator-=(difference_type n)
269
+ {
270
+ static_assert(
271
+ BaseT::IsRandomAccess,
272
+ "The '-=' operator is only defined for random access iterators.");
273
+ I -= n;
274
+ return *static_cast<DerivedT *>(this);
275
+ }
276
+ using BaseT::operator-;
277
+ difference_type operator-(const DerivedT &RHS) const
278
+ {
279
+ static_assert(
280
+ BaseT::IsRandomAccess,
281
+ "The '-' operator is only defined for random access iterators.");
282
+ return I - RHS.I;
283
+ }
284
+
285
+ // We have to explicitly provide ++ and -- rather than letting the facade
286
+ // forward to += because WrappedIteratorT might not support +=.
287
+ using BaseT::operator++;
288
+ DerivedT &operator++()
289
+ {
290
+ ++I;
291
+ return *static_cast<DerivedT *>(this);
292
+ }
293
+ using BaseT::operator--;
294
+ DerivedT &operator--()
295
+ {
296
+ static_assert(
297
+ BaseT::IsBidirectional,
298
+ "The decrement operator is only defined for bidirectional iterators.");
299
+ --I;
300
+ return *static_cast<DerivedT *>(this);
301
+ }
302
+
303
+ friend bool operator==(const iterator_adaptor_base &LHS,
304
+ const iterator_adaptor_base &RHS)
305
+ {
306
+ return LHS.I == RHS.I;
307
+ }
308
+ friend bool operator<(const iterator_adaptor_base &LHS,
309
+ const iterator_adaptor_base &RHS)
310
+ {
311
+ static_assert(
312
+ BaseT::IsRandomAccess,
313
+ "Relational operators are only defined for random access iterators.");
314
+ return LHS.I < RHS.I;
315
+ }
316
+
317
+ ReferenceT operator*() const
318
+ {
319
+ return *I;
320
+ }
321
+ };
322
+
323
+ /// An iterator type that allows iterating over the pointees via some
324
+ /// other iterator.
325
+ ///
326
+ /// The typical usage of this is to expose a type that iterates over Ts, but
327
+ /// which is implemented with some iterator over T*s:
328
+ ///
329
+ /// \code
330
+ /// using iterator = pointee_iterator<SmallVectorImpl<T *>::iterator>;
331
+ /// \endcode
332
+ template <typename WrappedIteratorT,
333
+ typename T = std::remove_reference_t<decltype(
334
+ **std::declval<WrappedIteratorT>())>>
335
+ struct pointee_iterator
336
+ : iterator_adaptor_base<
337
+ pointee_iterator<WrappedIteratorT, T>, WrappedIteratorT,
338
+ typename std::iterator_traits<WrappedIteratorT>::iterator_category,
339
+ T>
340
+ {
341
+ pointee_iterator() = default;
342
+ template <typename U>
343
+ pointee_iterator(U &&u)
344
+ : pointee_iterator::iterator_adaptor_base(std::forward<U &&>(u)) {}
345
+
346
+ T &operator*() const
347
+ {
348
+ return **this->I;
349
+ }
350
+ };
351
+
352
+ template <typename RangeT, typename WrappedIteratorT =
353
+ decltype(std::begin(std::declval<RangeT>()))>
354
+ iterator_range<pointee_iterator<WrappedIteratorT>>
355
+ make_pointee_range(RangeT &&Range)
356
+ {
357
+ using PointeeIteratorT = pointee_iterator<WrappedIteratorT>;
358
+ return make_range(PointeeIteratorT(std::begin(std::forward<RangeT>(Range))),
359
+ PointeeIteratorT(std::end(std::forward<RangeT>(Range))));
360
+ }
361
+
362
+ template <typename WrappedIteratorT,
363
+ typename T = decltype(&*std::declval<WrappedIteratorT>())>
364
+ class pointer_iterator
365
+ : public iterator_adaptor_base<
366
+ pointer_iterator<WrappedIteratorT, T>, WrappedIteratorT,
367
+ typename std::iterator_traits<WrappedIteratorT>::iterator_category,
368
+ T>
369
+ {
370
+ mutable T Ptr;
371
+
372
+ public:
373
+ pointer_iterator() = default;
374
+
375
+ explicit pointer_iterator(WrappedIteratorT u)
376
+ : pointer_iterator::iterator_adaptor_base(std::move(u)) {}
377
+
378
+ T &operator*()
379
+ {
380
+ return Ptr = &*this->I;
381
+ }
382
+ const T &operator*() const
383
+ {
384
+ return Ptr = &*this->I;
385
+ }
386
+ };
387
+
388
+ template <typename RangeT, typename WrappedIteratorT =
389
+ decltype(std::begin(std::declval<RangeT>()))>
390
+ iterator_range<pointer_iterator<WrappedIteratorT>>
391
+ make_pointer_range(RangeT &&Range)
392
+ {
393
+ using PointerIteratorT = pointer_iterator<WrappedIteratorT>;
394
+ return make_range(PointerIteratorT(std::begin(std::forward<RangeT>(Range))),
395
+ PointerIteratorT(std::end(std::forward<RangeT>(Range))));
396
+ }
397
+
398
+ template <typename WrappedIteratorT,
399
+ typename T1 = std::remove_reference_t<decltype(
400
+ **std::declval<WrappedIteratorT>())>,
401
+ typename T2 = std::add_pointer_t<T1>>
402
+ using raw_pointer_iterator =
403
+ pointer_iterator<pointee_iterator<WrappedIteratorT, T1>, T2>;
404
+
405
+ } // end namespace llvm
406
+
407
+ #endif // LLVM_ADT_ITERATOR_H
@@ -0,0 +1,76 @@
1
+ //===- iterator_range.h - A range adaptor for iterators ---------*- 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
+ /// \file
9
+ /// This provides a very simple, boring adaptor for a begin and end iterator
10
+ /// into a range type. This should be used to build range views that work well
11
+ /// with range based for loops and range based constructors.
12
+ ///
13
+ /// Note that code here follows more standards-based coding conventions as it
14
+ /// is mirroring proposed interfaces for standardization.
15
+ ///
16
+ //===----------------------------------------------------------------------===//
17
+
18
+ #ifndef LLVM_ADT_ITERATOR_RANGE_H
19
+ #define LLVM_ADT_ITERATOR_RANGE_H
20
+
21
+ #include <utility>
22
+
23
+ namespace llvm
24
+ {
25
+
26
+ /// A range adaptor for a pair of iterators.
27
+ ///
28
+ /// This just wraps two iterators into a range-compatible interface. Nothing
29
+ /// fancy at all.
30
+ template <typename IteratorT>
31
+ class iterator_range
32
+ {
33
+ IteratorT begin_iterator, end_iterator;
34
+
35
+ public:
36
+ //TODO: Add SFINAE to test that the Container's iterators match the range's
37
+ // iterators.
38
+ template <typename Container>
39
+ iterator_range(Container &&c)
40
+ //TODO: Consider ADL/non-member begin/end calls.
41
+ : begin_iterator(c.begin()), end_iterator(c.end()) {}
42
+ iterator_range(IteratorT begin_iterator, IteratorT end_iterator)
43
+ : begin_iterator(std::move(begin_iterator)),
44
+ end_iterator(std::move(end_iterator)) {}
45
+
46
+ IteratorT begin() const
47
+ {
48
+ return begin_iterator;
49
+ }
50
+ IteratorT end() const
51
+ {
52
+ return end_iterator;
53
+ }
54
+ bool empty() const
55
+ {
56
+ return begin_iterator == end_iterator;
57
+ }
58
+ };
59
+
60
+ /// Convenience function for iterating over sub-ranges.
61
+ ///
62
+ /// This provides a bit of syntactic sugar to make using sub-ranges
63
+ /// in for loops a bit easier. Analogous to std::make_pair().
64
+ template <class T> iterator_range<T> make_range(T x, T y)
65
+ {
66
+ return iterator_range<T>(std::move(x), std::move(y));
67
+ }
68
+
69
+ template <typename T> iterator_range<T> make_range(std::pair<T, T> p)
70
+ {
71
+ return iterator_range<T>(std::move(p.first), std::move(p.second));
72
+ }
73
+
74
+ }
75
+
76
+ #endif
Binary file
@@ -0,0 +1,188 @@
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 LLVM_SUPPORT_DOTGRAPHTRAITS_H
17
+ #define LLVM_SUPPORT_DOTGRAPHTRAITS_H
18
+
19
+ #include <string>
20
+
21
+ namespace llvm
22
+ {
23
+
24
+ /// DefaultDOTGraphTraits - This class provides the default implementations of
25
+ /// all of the DOTGraphTraits methods. If a specialization does not need to
26
+ /// override all methods here it should inherit so that it can get the default
27
+ /// implementations.
28
+ ///
29
+ struct DefaultDOTGraphTraits
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
+
43
+ /// getGraphName - Return the label for the graph as a whole. Printed at the
44
+ /// top of the graph.
45
+ ///
46
+ template<typename GraphType>
47
+ static std::string getGraphName(const GraphType &)
48
+ {
49
+ return "";
50
+ }
51
+
52
+ /// getGraphProperties - Return any custom properties that should be included
53
+ /// in the top level graph structure for dot.
54
+ ///
55
+ template<typename GraphType>
56
+ static std::string getGraphProperties(const GraphType &)
57
+ {
58
+ return "";
59
+ }
60
+
61
+ /// renderGraphFromBottomUp - If this function returns true, the graph is
62
+ /// emitted bottom-up instead of top-down. This requires graphviz 2.0 to work
63
+ /// though.
64
+ static bool renderGraphFromBottomUp()
65
+ {
66
+ return false;
67
+ }
68
+
69
+ /// isNodeHidden - If the function returns true, the given node is not
70
+ /// displayed in the graph.
71
+ template <typename GraphType>
72
+ static bool isNodeHidden(const void *, const GraphType &)
73
+ {
74
+ return false;
75
+ }
76
+
77
+ /// getNodeLabel - Given a node and a pointer to the top level graph, return
78
+ /// the label to print in the node.
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
+
100
+ /// If you want to specify custom node attributes, this is the place to do so
101
+ ///
102
+ template<typename GraphType>
103
+ static std::string getNodeAttributes(const void *,
104
+ const GraphType &)
105
+ {
106
+ return "";
107
+ }
108
+
109
+ /// If you want to override the dot attributes printed for a particular edge,
110
+ /// override this method.
111
+ template<typename EdgeIter, typename GraphType>
112
+ static std::string getEdgeAttributes(const void *, EdgeIter,
113
+ const GraphType &)
114
+ {
115
+ return "";
116
+ }
117
+
118
+ /// getEdgeSourceLabel - If you want to label the edge source itself,
119
+ /// implement this method.
120
+ template<typename EdgeIter>
121
+ static std::string getEdgeSourceLabel(const void *, EdgeIter)
122
+ {
123
+ return "";
124
+ }
125
+
126
+ /// edgeTargetsEdgeSource - This method returns true if this outgoing edge
127
+ /// should actually target another edge source, not a node. If this method is
128
+ /// implemented, getEdgeTarget should be implemented.
129
+ template<typename EdgeIter>
130
+ static bool edgeTargetsEdgeSource(const void *, EdgeIter)
131
+ {
132
+ return false;
133
+ }
134
+
135
+ /// getEdgeTarget - If edgeTargetsEdgeSource returns true, this method is
136
+ /// called to determine which outgoing edge of Node is the target of this
137
+ /// edge.
138
+ template<typename EdgeIter>
139
+ static EdgeIter getEdgeTarget(const void *, EdgeIter I)
140
+ {
141
+ return I;
142
+ }
143
+
144
+ /// hasEdgeDestLabels - If this function returns true, the graph is able
145
+ /// to provide labels for edge destinations.
146
+ static bool hasEdgeDestLabels()
147
+ {
148
+ return false;
149
+ }
150
+
151
+ /// numEdgeDestLabels - If hasEdgeDestLabels, this function returns the
152
+ /// number of incoming edge labels the given node has.
153
+ static unsigned numEdgeDestLabels(const void *)
154
+ {
155
+ return 0;
156
+ }
157
+
158
+ /// getEdgeDestLabel - If hasEdgeDestLabels, this function returns the
159
+ /// incoming edge label with the given index in the given node.
160
+ static std::string getEdgeDestLabel(const void *, unsigned)
161
+ {
162
+ return "";
163
+ }
164
+
165
+ /// addCustomGraphFeatures - If a graph is made up of more than just
166
+ /// straight-forward nodes and edges, this is the place to put all of the
167
+ /// custom stuff necessary. The GraphWriter object, instantiated with your
168
+ /// GraphType is passed in as an argument. You may call arbitrary methods on
169
+ /// it to add things to the output graph.
170
+ ///
171
+ template<typename GraphType, typename GraphWriter>
172
+ static void addCustomGraphFeatures(const GraphType &, GraphWriter &) {}
173
+ };
174
+
175
+
176
+ /// DOTGraphTraits - Template class that can be specialized to customize how
177
+ /// graphs are converted to 'dot' graphs. When specializing, you may inherit
178
+ /// from DefaultDOTGraphTraits if you don't need to override everything.
179
+ ///
180
+ template <typename Ty>
181
+ struct DOTGraphTraits : public DefaultDOTGraphTraits
182
+ {
183
+ DOTGraphTraits (bool simple=false) : DefaultDOTGraphTraits (simple) {}
184
+ };
185
+
186
+ } // End llvm namespace
187
+
188
+ #endif