svf-lib 1.0.1294 → 1.0.1296
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.
- package/SVF-osx/Release-build/lib/libSvf.a +0 -0
- package/SVF-osx/include/Graphs/CFLGraph.h +6 -6
- package/SVF-osx/include/Graphs/CHG.h +6 -6
- package/SVF-osx/include/Graphs/ConsG.h +6 -6
- package/SVF-osx/include/Graphs/DOTGraphTraits.h +3 -3
- package/SVF-osx/include/Graphs/GenericGraph.h +10 -9
- package/SVF-osx/include/Graphs/GraphPrinter.h +2 -2
- package/SVF-osx/include/Graphs/GraphTraits.h +29 -29
- package/SVF-osx/include/Graphs/GraphWriter.h +6 -6
- package/SVF-osx/include/Graphs/ICFG.h +6 -6
- package/SVF-osx/include/Graphs/IRGraph.h +6 -7
- package/SVF-osx/include/Graphs/PTACallGraph.h +6 -6
- package/SVF-osx/include/Graphs/SVFG.h +6 -6
- package/SVF-osx/include/Graphs/VFG.h +6 -6
- package/SVF-osx/include/MTA/TCT.h +6 -6
- package/SVF-osx/include/SABER/SrcSnkSolver.h +2 -2
- package/SVF-osx/include/SVF-LLVM/DCHG.h +6 -6
- package/SVF-osx/include/SVF-LLVM/LLVMUtil.h +5 -0
- package/SVF-osx/include/SVF-LLVM/SymbolTableBuilder.h +0 -3
- package/SVF-osx/include/SVFIR/SVFValue.h +2 -11
- package/SVF-osx/include/SVFIR/SVFVariables.h +5 -5
- package/SVF-osx/include/Util/GraphReachSolver.h +2 -2
- package/SVF-osx/include/Util/SCC.h +1 -1
- package/SVF-osx/include/Util/iterator.h +32 -32
- package/SVF-osx/include/Util/iterator_range.h +11 -11
- package/SVF-osx/include/WPA/WPASolver.h +1 -1
- package/package.json +1 -1
|
Binary file
|
|
@@ -189,23 +189,23 @@ private:
|
|
|
189
189
|
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
-
namespace
|
|
192
|
+
namespace SVF
|
|
193
193
|
{
|
|
194
194
|
/* !
|
|
195
|
-
*
|
|
195
|
+
* GenericGraphTraits specializations for generic graph algorithms.
|
|
196
196
|
* Provide graph traits for traversing from a constraint node using standard graph traversals.
|
|
197
197
|
*/
|
|
198
|
-
template<> struct
|
|
198
|
+
template<> struct GenericGraphTraits<SVF::CFLNode*> : public GenericGraphTraits<SVF::GenericNode<SVF::CFLNode,SVF::CFLEdge>* >
|
|
199
199
|
{
|
|
200
200
|
};
|
|
201
201
|
|
|
202
|
-
/// Inverse
|
|
202
|
+
/// Inverse GenericGraphTraits specializations for call graph node, it is used for inverse traversal.
|
|
203
203
|
template<>
|
|
204
|
-
struct
|
|
204
|
+
struct GenericGraphTraits<Inverse<SVF::CFLNode *> > : public GenericGraphTraits<Inverse<SVF::GenericNode<SVF::CFLNode,SVF::CFLEdge>* > >
|
|
205
205
|
{
|
|
206
206
|
};
|
|
207
207
|
|
|
208
|
-
template<> struct
|
|
208
|
+
template<> struct GenericGraphTraits<SVF::CFLGraph*> : public GenericGraphTraits<SVF::GenericGraph<SVF::CFLNode,SVF::CFLEdge>* >
|
|
209
209
|
{
|
|
210
210
|
typedef SVF::CFLNode *NodeRef;
|
|
211
211
|
};
|
|
@@ -325,23 +325,23 @@ private:
|
|
|
325
325
|
|
|
326
326
|
} // End namespace SVF
|
|
327
327
|
|
|
328
|
-
namespace
|
|
328
|
+
namespace SVF
|
|
329
329
|
{
|
|
330
330
|
/* !
|
|
331
|
-
*
|
|
331
|
+
* GenericGraphTraits specializations for generic graph algorithms.
|
|
332
332
|
* Provide graph traits for traversing from a constraint node using standard graph traversals.
|
|
333
333
|
*/
|
|
334
|
-
template<> struct
|
|
334
|
+
template<> struct GenericGraphTraits<SVF::CHNode*> : public GenericGraphTraits<SVF::GenericNode<SVF::CHNode,SVF::CHEdge>* >
|
|
335
335
|
{
|
|
336
336
|
};
|
|
337
337
|
|
|
338
|
-
/// Inverse
|
|
338
|
+
/// Inverse GenericGraphTraits specializations for call graph node, it is used for inverse traversal.
|
|
339
339
|
template<>
|
|
340
|
-
struct
|
|
340
|
+
struct GenericGraphTraits<Inverse<SVF::CHNode*> > : public GenericGraphTraits<Inverse<SVF::GenericNode<SVF::CHNode,SVF::CHEdge>* > >
|
|
341
341
|
{
|
|
342
342
|
};
|
|
343
343
|
|
|
344
|
-
template<> struct
|
|
344
|
+
template<> struct GenericGraphTraits<SVF::CHGraph*> : public GenericGraphTraits<SVF::GenericGraph<SVF::CHNode,SVF::CHEdge>* >
|
|
345
345
|
{
|
|
346
346
|
typedef SVF::CHNode *NodeRef;
|
|
347
347
|
};
|
|
@@ -382,23 +382,23 @@ public:
|
|
|
382
382
|
|
|
383
383
|
} // End namespace SVF
|
|
384
384
|
|
|
385
|
-
namespace
|
|
385
|
+
namespace SVF
|
|
386
386
|
{
|
|
387
387
|
/* !
|
|
388
|
-
*
|
|
388
|
+
* GenericGraphTraits specializations for the generic graph algorithms.
|
|
389
389
|
* Provide graph traits for traversing from a constraint node using standard graph traversals.
|
|
390
390
|
*/
|
|
391
|
-
template<> struct
|
|
391
|
+
template<> struct GenericGraphTraits<SVF::ConstraintNode*> : public GenericGraphTraits<SVF::GenericNode<SVF::ConstraintNode,SVF::ConstraintEdge>* >
|
|
392
392
|
{
|
|
393
393
|
};
|
|
394
394
|
|
|
395
|
-
/// Inverse
|
|
395
|
+
/// Inverse GenericGraphTraits specializations for Value flow node, it is used for inverse traversal.
|
|
396
396
|
template<>
|
|
397
|
-
struct
|
|
397
|
+
struct GenericGraphTraits<Inverse<SVF::ConstraintNode *> > : public GenericGraphTraits<Inverse<SVF::GenericNode<SVF::ConstraintNode,SVF::ConstraintEdge>* > >
|
|
398
398
|
{
|
|
399
399
|
};
|
|
400
400
|
|
|
401
|
-
template<> struct
|
|
401
|
+
template<> struct GenericGraphTraits<SVF::ConstraintGraph*> : public GenericGraphTraits<SVF::GenericGraph<SVF::ConstraintNode,SVF::ConstraintEdge>* >
|
|
402
402
|
{
|
|
403
403
|
typedef SVF::ConstraintNode *NodeRef;
|
|
404
404
|
};
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
//
|
|
14
14
|
//===----------------------------------------------------------------------===//
|
|
15
15
|
|
|
16
|
-
#ifndef
|
|
17
|
-
#define
|
|
16
|
+
#ifndef GRAPHS_DOTGRAPHTRAITS_H
|
|
17
|
+
#define GRAPHS_DOTGRAPHTRAITS_H
|
|
18
18
|
|
|
19
19
|
#include <string>
|
|
20
20
|
|
|
21
|
-
namespace
|
|
21
|
+
namespace SVF
|
|
22
22
|
{
|
|
23
23
|
|
|
24
24
|
/// DefaultDOTGraphTraits - This class provides the default implementations of
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
|
|
33
33
|
#include "SVFIR/SVFValue.h"
|
|
34
34
|
#include "Util/iterator.h"
|
|
35
|
+
#include "Graphs/GraphTraits.h"
|
|
35
36
|
|
|
36
37
|
namespace SVF
|
|
37
38
|
{
|
|
@@ -447,10 +448,10 @@ public:
|
|
|
447
448
|
} // End namespace SVF
|
|
448
449
|
|
|
449
450
|
/* !
|
|
450
|
-
*
|
|
451
|
+
* GenericGraphTraits specializations for generic graph algorithms.
|
|
451
452
|
* Provide graph traits for tranversing from a node using standard graph traversals.
|
|
452
453
|
*/
|
|
453
|
-
namespace
|
|
454
|
+
namespace SVF
|
|
454
455
|
{
|
|
455
456
|
|
|
456
457
|
// mapped_iter - This is a simple iterator adapter that causes a function to
|
|
@@ -460,14 +461,14 @@ template <typename ItTy, typename FuncTy,
|
|
|
460
461
|
typename FuncReturnTy =
|
|
461
462
|
decltype(std::declval<FuncTy>()(*std::declval<ItTy>()))>
|
|
462
463
|
class mapped_iter
|
|
463
|
-
: public
|
|
464
|
+
: public iter_adaptor_base<
|
|
464
465
|
mapped_iter<ItTy, FuncTy>, ItTy,
|
|
465
466
|
typename std::iterator_traits<ItTy>::iterator_category,
|
|
466
467
|
typename std::remove_reference<FuncReturnTy>::type>
|
|
467
468
|
{
|
|
468
469
|
public:
|
|
469
470
|
mapped_iter(ItTy U, FuncTy F)
|
|
470
|
-
: mapped_iter::
|
|
471
|
+
: mapped_iter::iter_adaptor_base(std::move(U)), F(std::move(F)) {}
|
|
471
472
|
|
|
472
473
|
ItTy getCurrent()
|
|
473
474
|
{
|
|
@@ -492,9 +493,9 @@ inline mapped_iter<ItTy, FuncTy> map_iter(ItTy I, FuncTy F)
|
|
|
492
493
|
}
|
|
493
494
|
|
|
494
495
|
/*!
|
|
495
|
-
*
|
|
496
|
+
* GenericGraphTraits for nodes
|
|
496
497
|
*/
|
|
497
|
-
template<class NodeTy,class EdgeTy> struct
|
|
498
|
+
template<class NodeTy,class EdgeTy> struct GenericGraphTraits<SVF::GenericNode<NodeTy,EdgeTy>* >
|
|
498
499
|
{
|
|
499
500
|
typedef NodeTy NodeType;
|
|
500
501
|
typedef EdgeTy EdgeType;
|
|
@@ -531,10 +532,10 @@ template<class NodeTy,class EdgeTy> struct GraphTraits<SVF::GenericNode<NodeTy,E
|
|
|
531
532
|
};
|
|
532
533
|
|
|
533
534
|
/*!
|
|
534
|
-
* Inverse
|
|
535
|
+
* Inverse GenericGraphTraits for node which is used for inverse traversal.
|
|
535
536
|
*/
|
|
536
537
|
template<class NodeTy,class EdgeTy>
|
|
537
|
-
struct
|
|
538
|
+
struct GenericGraphTraits<Inverse<SVF::GenericNode<NodeTy,EdgeTy>* > >
|
|
538
539
|
{
|
|
539
540
|
typedef NodeTy NodeType;
|
|
540
541
|
typedef EdgeTy EdgeType;
|
|
@@ -570,7 +571,7 @@ struct GraphTraits<Inverse<SVF::GenericNode<NodeTy,EdgeTy>* > >
|
|
|
570
571
|
/*!
|
|
571
572
|
* GraphTraints
|
|
572
573
|
*/
|
|
573
|
-
template<class NodeTy,class EdgeTy> struct
|
|
574
|
+
template<class NodeTy,class EdgeTy> struct GenericGraphTraits<SVF::GenericGraph<NodeTy,EdgeTy>* > : public GenericGraphTraits<SVF::GenericNode<NodeTy,EdgeTy>* >
|
|
574
575
|
{
|
|
575
576
|
typedef SVF::GenericGraph<NodeTy,EdgeTy> GenericGraphTy;
|
|
576
577
|
typedef NodeTy NodeType;
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
#include "Graphs/GraphWriter.h" // for graph write
|
|
36
36
|
#include <fstream>
|
|
37
37
|
|
|
38
|
-
namespace
|
|
38
|
+
namespace SVF
|
|
39
39
|
{
|
|
40
40
|
|
|
41
41
|
/*
|
|
@@ -80,7 +80,7 @@ public:
|
|
|
80
80
|
const GraphType >)
|
|
81
81
|
{
|
|
82
82
|
///Define the GTraits and node iterator for printing
|
|
83
|
-
typedef
|
|
83
|
+
typedef GenericGraphTraits<GraphType> GTraits;
|
|
84
84
|
|
|
85
85
|
typedef typename GTraits::NodeRef NodeRef;
|
|
86
86
|
typedef typename GTraits::nodes_iterator node_iterator;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//===- llvm/ADT/
|
|
1
|
+
//===- llvm/ADT/GenericGraphTraits.h - Graph traits template -----------*- C++ -*-===//
|
|
2
2
|
//
|
|
3
3
|
// From the LLVM Project with some modifications, under the Apache License v2.0
|
|
4
4
|
// with LLVM Exceptions. See https://llvm.org/LICENSE.txt for license information.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
//
|
|
7
7
|
//===----------------------------------------------------------------------===//
|
|
8
8
|
//
|
|
9
|
-
// This file defines the little
|
|
9
|
+
// This file defines the little GenericGraphTraits<X> template class that should be
|
|
10
10
|
// specialized by classes that want to be iteratable by generic graph iterators.
|
|
11
11
|
//
|
|
12
12
|
// This file also defines the marker class Inverse that is used to iterate over
|
|
@@ -14,26 +14,26 @@
|
|
|
14
14
|
//
|
|
15
15
|
//===----------------------------------------------------------------------===//
|
|
16
16
|
|
|
17
|
-
#ifndef
|
|
18
|
-
#define
|
|
17
|
+
#ifndef GRAPHS_GRAPHTRAITS_H
|
|
18
|
+
#define GRAPHS_GRAPHTRAITS_H
|
|
19
19
|
|
|
20
20
|
#include "Util/iterator_range.h"
|
|
21
21
|
|
|
22
|
-
namespace
|
|
22
|
+
namespace SVF
|
|
23
23
|
{
|
|
24
24
|
|
|
25
|
-
//
|
|
25
|
+
// GenericGraphTraits - This class should be specialized by different graph types...
|
|
26
26
|
// which is why the default version is empty.
|
|
27
27
|
//
|
|
28
28
|
// This template evolved from supporting `BasicBlock` to also later supporting
|
|
29
29
|
// more complex types (e.g. CFG and DomTree).
|
|
30
30
|
//
|
|
31
|
-
//
|
|
31
|
+
// GenericGraphTraits can be used to create a view over a graph interpreting it
|
|
32
32
|
// differently without requiring a copy of the original graph. This could
|
|
33
33
|
// be achieved by carrying more data in NodeRef. See LoopBodyTraits for one
|
|
34
34
|
// example.
|
|
35
35
|
template<class GraphType>
|
|
36
|
-
struct
|
|
36
|
+
struct GenericGraphTraits
|
|
37
37
|
{
|
|
38
38
|
// Elements to provide:
|
|
39
39
|
|
|
@@ -73,7 +73,7 @@ struct GraphTraits
|
|
|
73
73
|
|
|
74
74
|
// If anyone tries to use this class without having an appropriate
|
|
75
75
|
// specialization, make an error. If you get this error, it's because you
|
|
76
|
-
// need to include the appropriate specialization of
|
|
76
|
+
// need to include the appropriate specialization of GenericGraphTraits<> for your
|
|
77
77
|
// graph, or you need to define it for a new graph type. Either that or
|
|
78
78
|
// your argument to XXX_begin(...) is unknown or needs to have the proper .h
|
|
79
79
|
// file #include'd.
|
|
@@ -101,48 +101,48 @@ struct Inverse
|
|
|
101
101
|
inline Inverse(const GraphType &G) : Graph(G) {}
|
|
102
102
|
};
|
|
103
103
|
|
|
104
|
-
// Provide a partial specialization of
|
|
104
|
+
// Provide a partial specialization of GenericGraphTraits so that the inverse of an
|
|
105
105
|
// inverse falls back to the original graph.
|
|
106
|
-
template <class T> struct
|
|
106
|
+
template <class T> struct GenericGraphTraits<Inverse<Inverse<T>>> : GenericGraphTraits<T> {};
|
|
107
107
|
|
|
108
108
|
// Provide iterator ranges for the graph traits nodes and children
|
|
109
109
|
template <class GraphType>
|
|
110
|
-
|
|
110
|
+
iter_range<typename GenericGraphTraits<GraphType>::nodes_iterator>
|
|
111
111
|
nodes(const GraphType &G)
|
|
112
112
|
{
|
|
113
|
-
return make_range(
|
|
114
|
-
|
|
113
|
+
return make_range(GenericGraphTraits<GraphType>::nodes_begin(G),
|
|
114
|
+
GenericGraphTraits<GraphType>::nodes_end(G));
|
|
115
115
|
}
|
|
116
116
|
template <class GraphType>
|
|
117
|
-
|
|
117
|
+
iter_range<typename GenericGraphTraits<Inverse<GraphType>>::nodes_iterator>
|
|
118
118
|
inverse_nodes(const GraphType &G)
|
|
119
119
|
{
|
|
120
|
-
return make_range(
|
|
121
|
-
|
|
120
|
+
return make_range(GenericGraphTraits<Inverse<GraphType>>::nodes_begin(G),
|
|
121
|
+
GenericGraphTraits<Inverse<GraphType>>::nodes_end(G));
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
template <class GraphType>
|
|
125
|
-
|
|
126
|
-
children(const typename
|
|
125
|
+
iter_range<typename GenericGraphTraits<GraphType>::ChildIteratorType>
|
|
126
|
+
children(const typename GenericGraphTraits<GraphType>::NodeRef &G)
|
|
127
127
|
{
|
|
128
|
-
return make_range(
|
|
129
|
-
|
|
128
|
+
return make_range(GenericGraphTraits<GraphType>::child_begin(G),
|
|
129
|
+
GenericGraphTraits<GraphType>::child_end(G));
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
template <class GraphType>
|
|
133
|
-
|
|
134
|
-
inverse_children(const typename
|
|
133
|
+
iter_range<typename GenericGraphTraits<Inverse<GraphType>>::ChildIteratorType>
|
|
134
|
+
inverse_children(const typename GenericGraphTraits<GraphType>::NodeRef &G)
|
|
135
135
|
{
|
|
136
|
-
return make_range(
|
|
137
|
-
|
|
136
|
+
return make_range(GenericGraphTraits<Inverse<GraphType>>::child_begin(G),
|
|
137
|
+
GenericGraphTraits<Inverse<GraphType>>::child_end(G));
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
template <class GraphType>
|
|
141
|
-
|
|
142
|
-
children_edges(const typename
|
|
141
|
+
iter_range<typename GenericGraphTraits<GraphType>::ChildEdgeIteratorType>
|
|
142
|
+
children_edges(const typename GenericGraphTraits<GraphType>::NodeRef &G)
|
|
143
143
|
{
|
|
144
|
-
return make_range(
|
|
145
|
-
|
|
144
|
+
return make_range(GenericGraphTraits<GraphType>::child_edge_begin(G),
|
|
145
|
+
GenericGraphTraits<GraphType>::child_edge_end(G));
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
} // end namespace llvm
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
//
|
|
20
20
|
//===----------------------------------------------------------------------===//
|
|
21
21
|
|
|
22
|
-
#ifndef
|
|
23
|
-
#define
|
|
22
|
+
#ifndef GRAPHS_GRAPHWRITER_H
|
|
23
|
+
#define GRAPHS_GRAPHWRITER_H
|
|
24
24
|
|
|
25
25
|
#include "Graphs/GraphTraits.h"
|
|
26
26
|
#include "Graphs/DOTGraphTraits.h"
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
#include <sstream>
|
|
35
35
|
#include <iostream>
|
|
36
36
|
|
|
37
|
-
namespace
|
|
37
|
+
namespace SVF
|
|
38
38
|
{
|
|
39
39
|
|
|
40
40
|
namespace DOT // Private functions...
|
|
@@ -65,7 +65,7 @@ class GraphWriter
|
|
|
65
65
|
const GraphType &G;
|
|
66
66
|
|
|
67
67
|
using DOTTraits = DOTGraphTraits<GraphType>;
|
|
68
|
-
using GTraits =
|
|
68
|
+
using GTraits = GenericGraphTraits<GraphType>;
|
|
69
69
|
using NodeRef = typename GTraits::NodeRef;
|
|
70
70
|
using node_iterator = typename GTraits::nodes_iterator;
|
|
71
71
|
using child_iterator = typename GTraits::ChildIteratorType;
|
|
@@ -356,7 +356,7 @@ std::string WriteGraph(const GraphType &G,
|
|
|
356
356
|
return "";
|
|
357
357
|
}
|
|
358
358
|
|
|
359
|
-
|
|
359
|
+
SVF::WriteGraph(O, G, ShortNames);
|
|
360
360
|
O.close();
|
|
361
361
|
|
|
362
362
|
std::cerr << " done. \n";
|
|
@@ -372,7 +372,7 @@ void ViewGraph(const GraphType &G,const std::string& name,
|
|
|
372
372
|
bool ShortNames = false,
|
|
373
373
|
GraphProgram::Name Program = GraphProgram::DOT)
|
|
374
374
|
{
|
|
375
|
-
|
|
375
|
+
SVF::WriteGraph(G, ShortNames);
|
|
376
376
|
}
|
|
377
377
|
|
|
378
378
|
} // end namespace llvm
|
|
@@ -305,23 +305,23 @@ private:
|
|
|
305
305
|
|
|
306
306
|
} // End namespace SVF
|
|
307
307
|
|
|
308
|
-
namespace
|
|
308
|
+
namespace SVF
|
|
309
309
|
{
|
|
310
310
|
/* !
|
|
311
|
-
*
|
|
311
|
+
* GenericGraphTraits specializations for generic graph algorithms.
|
|
312
312
|
* Provide graph traits for traversing from a constraint node using standard graph traversals.
|
|
313
313
|
*/
|
|
314
|
-
template<> struct
|
|
314
|
+
template<> struct GenericGraphTraits<SVF::ICFGNode*> : public GenericGraphTraits<SVF::GenericNode<SVF::ICFGNode,SVF::ICFGEdge>* >
|
|
315
315
|
{
|
|
316
316
|
};
|
|
317
317
|
|
|
318
|
-
/// Inverse
|
|
318
|
+
/// Inverse GenericGraphTraits specializations for call graph node, it is used for inverse traversal.
|
|
319
319
|
template<>
|
|
320
|
-
struct
|
|
320
|
+
struct GenericGraphTraits<Inverse<SVF::ICFGNode *> > : public GenericGraphTraits<Inverse<SVF::GenericNode<SVF::ICFGNode,SVF::ICFGEdge>* > >
|
|
321
321
|
{
|
|
322
322
|
};
|
|
323
323
|
|
|
324
|
-
template<> struct
|
|
324
|
+
template<> struct GenericGraphTraits<SVF::ICFG*> : public GenericGraphTraits<SVF::GenericGraph<SVF::ICFGNode,SVF::ICFGEdge>* >
|
|
325
325
|
{
|
|
326
326
|
typedef SVF::ICFGNode *NodeRef;
|
|
327
327
|
};
|
|
@@ -218,24 +218,23 @@ public:
|
|
|
218
218
|
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
-
|
|
222
|
-
namespace llvm
|
|
221
|
+
namespace SVF
|
|
223
222
|
{
|
|
224
223
|
|
|
225
224
|
/* !
|
|
226
|
-
*
|
|
225
|
+
* GenericGraphTraits specializations of SVFIR to be used for the generic graph algorithms.
|
|
227
226
|
* Provide graph traits for tranversing from a SVFIR node using standard graph traversals.
|
|
228
227
|
*/
|
|
229
|
-
template<> struct
|
|
228
|
+
template<> struct GenericGraphTraits<SVF::SVFVar*> : public GenericGraphTraits<SVF::GenericNode<SVF::SVFVar,SVF::SVFStmt>* >
|
|
230
229
|
{
|
|
231
230
|
};
|
|
232
231
|
|
|
233
|
-
/// Inverse
|
|
234
|
-
template<> struct
|
|
232
|
+
/// Inverse GenericGraphTraits specializations for SVFIR node, it is used for inverse traversal.
|
|
233
|
+
template<> struct GenericGraphTraits<Inverse<SVF::SVFVar *> > : public GenericGraphTraits<Inverse<SVF::GenericNode<SVF::SVFVar,SVF::SVFStmt>* > >
|
|
235
234
|
{
|
|
236
235
|
};
|
|
237
236
|
|
|
238
|
-
template<> struct
|
|
237
|
+
template<> struct GenericGraphTraits<SVF::IRGraph*> : public GenericGraphTraits<SVF::GenericGraph<SVF::SVFVar,SVF::SVFStmt>* >
|
|
239
238
|
{
|
|
240
239
|
typedef SVF::SVFVar *NodeRef;
|
|
241
240
|
};
|
|
@@ -445,23 +445,23 @@ public:
|
|
|
445
445
|
|
|
446
446
|
} // End namespace SVF
|
|
447
447
|
|
|
448
|
-
namespace
|
|
448
|
+
namespace SVF
|
|
449
449
|
{
|
|
450
450
|
/* !
|
|
451
|
-
*
|
|
451
|
+
* GenericGraphTraits specializations for generic graph algorithms.
|
|
452
452
|
* Provide graph traits for traversing from a constraint node using standard graph traversals.
|
|
453
453
|
*/
|
|
454
|
-
template<> struct
|
|
454
|
+
template<> struct GenericGraphTraits<SVF::PTACallGraphNode*> : public GenericGraphTraits<SVF::GenericNode<SVF::PTACallGraphNode,SVF::PTACallGraphEdge>* >
|
|
455
455
|
{
|
|
456
456
|
};
|
|
457
457
|
|
|
458
|
-
/// Inverse
|
|
458
|
+
/// Inverse GenericGraphTraits specializations for call graph node, it is used for inverse traversal.
|
|
459
459
|
template<>
|
|
460
|
-
struct
|
|
460
|
+
struct GenericGraphTraits<Inverse<SVF::PTACallGraphNode *> > : public GenericGraphTraits<Inverse<SVF::GenericNode<SVF::PTACallGraphNode,SVF::PTACallGraphEdge>* > >
|
|
461
461
|
{
|
|
462
462
|
};
|
|
463
463
|
|
|
464
|
-
template<> struct
|
|
464
|
+
template<> struct GenericGraphTraits<SVF::PTACallGraph*> : public GenericGraphTraits<SVF::GenericGraph<SVF::PTACallGraphNode,SVF::PTACallGraphEdge>* >
|
|
465
465
|
{
|
|
466
466
|
typedef SVF::PTACallGraphNode *NodeRef;
|
|
467
467
|
};
|
|
@@ -461,21 +461,21 @@ protected:
|
|
|
461
461
|
|
|
462
462
|
} // End namespace SVF
|
|
463
463
|
|
|
464
|
-
namespace
|
|
464
|
+
namespace SVF
|
|
465
465
|
{
|
|
466
466
|
/* !
|
|
467
|
-
*
|
|
467
|
+
* GenericGraphTraits specializations for SVFG to be used for generic graph algorithms.
|
|
468
468
|
* Provide graph traits for traversing from a SVFG node using standard graph traversals.
|
|
469
469
|
*/
|
|
470
|
-
//template<> struct
|
|
470
|
+
//template<> struct GenericGraphTraits<SVF::SVFGNode*>: public GenericGraphTraits<SVF::GenericNode<SVF::SVFGNode,SVF::SVFGEdge>* > {
|
|
471
471
|
//};
|
|
472
472
|
//
|
|
473
|
-
///// Inverse
|
|
473
|
+
///// Inverse GenericGraphTraits specializations for Value flow node, it is used for inverse traversal.
|
|
474
474
|
//template<>
|
|
475
|
-
//struct
|
|
475
|
+
//struct GenericGraphTraits<Inverse<SVF::SVFGNode *> > : public GenericGraphTraits<Inverse<SVF::GenericNode<SVF::SVFGNode,SVF::SVFGEdge>* > > {
|
|
476
476
|
//};
|
|
477
477
|
|
|
478
|
-
template<> struct
|
|
478
|
+
template<> struct GenericGraphTraits<SVF::SVFG*> : public GenericGraphTraits<SVF::GenericGraph<SVF::SVFGNode,SVF::SVFGEdge>* >
|
|
479
479
|
{
|
|
480
480
|
typedef SVF::SVFGNode *NodeRef;
|
|
481
481
|
};
|
|
@@ -638,23 +638,23 @@ protected:
|
|
|
638
638
|
|
|
639
639
|
} // End namespace SVF
|
|
640
640
|
|
|
641
|
-
namespace
|
|
641
|
+
namespace SVF
|
|
642
642
|
{
|
|
643
643
|
/* !
|
|
644
|
-
*
|
|
644
|
+
* GenericGraphTraits specializations for generic graph algorithms.
|
|
645
645
|
* Provide graph traits for traversing from a constraint node using standard graph traversals.
|
|
646
646
|
*/
|
|
647
|
-
template<> struct
|
|
647
|
+
template<> struct GenericGraphTraits<SVF::VFGNode*> : public GenericGraphTraits<SVF::GenericNode<SVF::VFGNode,SVF::VFGEdge>* >
|
|
648
648
|
{
|
|
649
649
|
};
|
|
650
650
|
|
|
651
|
-
/// Inverse
|
|
651
|
+
/// Inverse GenericGraphTraits specializations for call graph node, it is used for inverse traversal.
|
|
652
652
|
template<>
|
|
653
|
-
struct
|
|
653
|
+
struct GenericGraphTraits<Inverse<SVF::VFGNode *> > : public GenericGraphTraits<Inverse<SVF::GenericNode<SVF::VFGNode,SVF::VFGEdge>* > >
|
|
654
654
|
{
|
|
655
655
|
};
|
|
656
656
|
|
|
657
|
-
template<> struct
|
|
657
|
+
template<> struct GenericGraphTraits<SVF::VFG*> : public GenericGraphTraits<SVF::GenericGraph<SVF::VFGNode,SVF::VFGEdge>* >
|
|
658
658
|
{
|
|
659
659
|
typedef SVF::VFGNode *NodeRef;
|
|
660
660
|
};
|
|
@@ -572,24 +572,24 @@ private:
|
|
|
572
572
|
|
|
573
573
|
} // End namespace SVF
|
|
574
574
|
|
|
575
|
-
namespace
|
|
575
|
+
namespace SVF
|
|
576
576
|
{
|
|
577
577
|
/* !
|
|
578
|
-
*
|
|
578
|
+
* GenericGraphTraits specializations for constraint graph so that they can be treated as
|
|
579
579
|
* graphs by the generic graph algorithms.
|
|
580
580
|
* Provide graph traits for traversing from a constraint node using standard graph traversals.
|
|
581
581
|
*/
|
|
582
|
-
template<> struct
|
|
582
|
+
template<> struct GenericGraphTraits<SVF::TCTNode*> : public GenericGraphTraits<SVF::GenericNode<SVF::TCTNode,SVF::TCTEdge>* >
|
|
583
583
|
{
|
|
584
584
|
};
|
|
585
585
|
|
|
586
|
-
/// Inverse
|
|
586
|
+
/// Inverse GenericGraphTraits specializations for Value flow node, it is used for inverse traversal.
|
|
587
587
|
template<>
|
|
588
|
-
struct
|
|
588
|
+
struct GenericGraphTraits<Inverse<SVF::TCTNode *> > : public GenericGraphTraits<Inverse<SVF::GenericNode<SVF::TCTNode,SVF::TCTEdge>* > >
|
|
589
589
|
{
|
|
590
590
|
};
|
|
591
591
|
|
|
592
|
-
template<> struct
|
|
592
|
+
template<> struct GenericGraphTraits<SVF::TCT*> : public GenericGraphTraits<SVF::GenericGraph<SVF::TCTNode,SVF::TCTEdge>* >
|
|
593
593
|
{
|
|
594
594
|
typedef SVF::TCTNode *NodeRef;
|
|
595
595
|
};
|
|
@@ -46,14 +46,14 @@ class SrcSnkSolver
|
|
|
46
46
|
|
|
47
47
|
public:
|
|
48
48
|
///Define the GTraits and node iterator
|
|
49
|
-
typedef
|
|
49
|
+
typedef SVF::GraphTraits<GraphType> GTraits;
|
|
50
50
|
typedef typename GTraits::NodeType GNODE;
|
|
51
51
|
typedef typename GTraits::EdgeType GEDGE;
|
|
52
52
|
typedef typename GTraits::nodes_iterator node_iterator;
|
|
53
53
|
typedef typename GTraits::ChildIteratorType child_iterator;
|
|
54
54
|
|
|
55
55
|
/// Define inverse GTraits and note iterator
|
|
56
|
-
typedef
|
|
56
|
+
typedef SVF::GraphTraits<SVF::Inverse<GNODE *> > InvGTraits;
|
|
57
57
|
typedef typename InvGTraits::ChildIteratorType inv_child_iterator;
|
|
58
58
|
|
|
59
59
|
/// Define worklist
|
|
@@ -455,23 +455,23 @@ private:
|
|
|
455
455
|
|
|
456
456
|
} // End namespace SVF
|
|
457
457
|
|
|
458
|
-
namespace
|
|
458
|
+
namespace SVF
|
|
459
459
|
{
|
|
460
460
|
/* !
|
|
461
|
-
*
|
|
461
|
+
* GenericGraphTraits specializations for generic graph algorithms.
|
|
462
462
|
* Provide graph traits for traversing from a constraint node using standard graph traversals.
|
|
463
463
|
*/
|
|
464
|
-
template<> struct
|
|
464
|
+
template<> struct GenericGraphTraits<SVF::DCHNode*> : public GenericGraphTraits<SVF::GenericNode<SVF::DCHNode,SVF::DCHEdge>* >
|
|
465
465
|
{
|
|
466
466
|
};
|
|
467
467
|
|
|
468
|
-
/// Inverse
|
|
468
|
+
/// Inverse GenericGraphTraits specializations for call graph node, it is used for inverse traversal.
|
|
469
469
|
template<>
|
|
470
|
-
struct
|
|
470
|
+
struct GenericGraphTraits<Inverse<SVF::DCHNode*> > : public GenericGraphTraits<Inverse<SVF::GenericNode<SVF::DCHNode,SVF::DCHEdge>* > >
|
|
471
471
|
{
|
|
472
472
|
};
|
|
473
473
|
|
|
474
|
-
template<> struct
|
|
474
|
+
template<> struct GenericGraphTraits<SVF::DCHGraph*> : public GenericGraphTraits<SVF::GenericGraph<SVF::DCHNode,SVF::DCHEdge>* >
|
|
475
475
|
{
|
|
476
476
|
typedef SVF::DCHNode *NodeRef;
|
|
477
477
|
};
|
|
@@ -391,6 +391,11 @@ inline const Value* getGlobalRep(const Value* val)
|
|
|
391
391
|
return val;
|
|
392
392
|
}
|
|
393
393
|
|
|
394
|
+
/// Check whether this value points-to a constant object
|
|
395
|
+
bool isConstantObjSym(const SVFValue* val);
|
|
396
|
+
|
|
397
|
+
/// Check whether this value points-to a constant object
|
|
398
|
+
bool isConstantObjSym(const Value* val);
|
|
394
399
|
|
|
395
400
|
// Dump Control Flow Graph of llvm function, with instructions
|
|
396
401
|
void viewCFG(const Function* fun);
|
|
@@ -38,7 +38,7 @@ namespace SVF
|
|
|
38
38
|
{
|
|
39
39
|
|
|
40
40
|
/// LLVM Aliases and constants
|
|
41
|
-
typedef
|
|
41
|
+
typedef SVF::GraphPrinter GraphPrinter;
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
class SVFInstruction;
|
|
@@ -174,7 +174,6 @@ public:
|
|
|
174
174
|
private:
|
|
175
175
|
GNodeK kind; ///< used for classof
|
|
176
176
|
bool ptrInUncalledFun; ///< true if this pointer is in an uncalled function
|
|
177
|
-
bool has_name; ///< true if this value has a name
|
|
178
177
|
bool constDataOrAggData; ///< true if this value is a ConstantData (e.g., numbers, string, floats) or a constantAggregate
|
|
179
178
|
|
|
180
179
|
protected:
|
|
@@ -183,7 +182,7 @@ protected:
|
|
|
183
182
|
std::string sourceLoc; ///< Source code information of this value
|
|
184
183
|
/// Constructor
|
|
185
184
|
SVFValue(const std::string& val, const SVFType* ty, SVFValKind k): kind(k),
|
|
186
|
-
ptrInUncalledFun(false),
|
|
185
|
+
ptrInUncalledFun(false), constDataOrAggData(SVFConstData==k), type(ty),
|
|
187
186
|
name(val), sourceLoc("No source code Info")
|
|
188
187
|
{
|
|
189
188
|
}
|
|
@@ -197,10 +196,6 @@ protected:
|
|
|
197
196
|
{
|
|
198
197
|
ptrInUncalledFun = true;
|
|
199
198
|
}
|
|
200
|
-
inline void setHasName()
|
|
201
|
-
{
|
|
202
|
-
has_name = true;
|
|
203
|
-
}
|
|
204
199
|
///@}
|
|
205
200
|
public:
|
|
206
201
|
SVFValue(void) = delete;
|
|
@@ -237,10 +232,6 @@ public:
|
|
|
237
232
|
{
|
|
238
233
|
return getKind() == SVFNullPtr;
|
|
239
234
|
}
|
|
240
|
-
inline bool hasName() const
|
|
241
|
-
{
|
|
242
|
-
return has_name;
|
|
243
|
-
}
|
|
244
235
|
inline virtual void setSourceLoc(const std::string& sourceCodeInfo)
|
|
245
236
|
{
|
|
246
237
|
sourceLoc = sourceCodeInfo;
|
|
@@ -289,7 +289,7 @@ public:
|
|
|
289
289
|
/// Return name of a LLVM value
|
|
290
290
|
inline const std::string getValueName() const
|
|
291
291
|
{
|
|
292
|
-
if (value
|
|
292
|
+
if (value)
|
|
293
293
|
return value->getName();
|
|
294
294
|
return "";
|
|
295
295
|
}
|
|
@@ -343,7 +343,7 @@ public:
|
|
|
343
343
|
/// Return name of a LLVM value
|
|
344
344
|
virtual const std::string getValueName() const
|
|
345
345
|
{
|
|
346
|
-
if (value
|
|
346
|
+
if (value)
|
|
347
347
|
return value->getName();
|
|
348
348
|
return "";
|
|
349
349
|
}
|
|
@@ -405,7 +405,7 @@ public:
|
|
|
405
405
|
/// Return name of a LLVM value
|
|
406
406
|
inline const std::string getValueName() const
|
|
407
407
|
{
|
|
408
|
-
if (value
|
|
408
|
+
if (value)
|
|
409
409
|
return value->getName() + "_" + std::to_string(getConstantFieldIdx());
|
|
410
410
|
return "offset_" + std::to_string(getConstantFieldIdx());
|
|
411
411
|
}
|
|
@@ -490,7 +490,7 @@ public:
|
|
|
490
490
|
/// Return name of a LLVM value
|
|
491
491
|
inline const std::string getValueName() const
|
|
492
492
|
{
|
|
493
|
-
if (value
|
|
493
|
+
if (value)
|
|
494
494
|
return value->getName() + "_" + std::to_string(ls.accumulateConstantFieldIdx());
|
|
495
495
|
return "offset_" + std::to_string(ls.accumulateConstantFieldIdx());
|
|
496
496
|
}
|
|
@@ -535,7 +535,7 @@ public:
|
|
|
535
535
|
/// Return name of a LLVM value
|
|
536
536
|
inline const std::string getValueName() const
|
|
537
537
|
{
|
|
538
|
-
if (value
|
|
538
|
+
if (value)
|
|
539
539
|
return value->getName() + " (base object)";
|
|
540
540
|
return " (base object)";
|
|
541
541
|
}
|
|
@@ -46,14 +46,14 @@ class GraphReachSolver
|
|
|
46
46
|
|
|
47
47
|
public:
|
|
48
48
|
///Define the GTraits and node iterator
|
|
49
|
-
typedef
|
|
49
|
+
typedef SVF::GenericGraphTraits<GraphType> GTraits;
|
|
50
50
|
typedef typename GTraits::NodeType GNODE;
|
|
51
51
|
typedef typename GTraits::EdgeType GEDGE;
|
|
52
52
|
typedef typename GTraits::nodes_iterator node_iterator;
|
|
53
53
|
typedef typename GTraits::ChildIteratorType child_iterator;
|
|
54
54
|
|
|
55
55
|
/// Define inverse GTraits and note iterator
|
|
56
|
-
typedef
|
|
56
|
+
typedef SVF::GenericGraphTraits<SVF::Inverse<GNODE *> > InvGTraits;
|
|
57
57
|
typedef typename InvGTraits::ChildIteratorType inv_child_iterator;
|
|
58
58
|
|
|
59
59
|
/// Define worklist
|
|
@@ -56,7 +56,7 @@ class SCCDetection
|
|
|
56
56
|
|
|
57
57
|
private:
|
|
58
58
|
///Define the GTraits and node iterator for printing
|
|
59
|
-
typedef
|
|
59
|
+
typedef SVF::GenericGraphTraits<GraphType> GTraits;
|
|
60
60
|
typedef typename GTraits::NodeRef GNODE;
|
|
61
61
|
typedef typename GTraits::nodes_iterator node_iterator;
|
|
62
62
|
typedef typename GTraits::ChildIteratorType child_iterator;
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
//
|
|
7
7
|
//===----------------------------------------------------------------------===//
|
|
8
8
|
|
|
9
|
-
#ifndef
|
|
10
|
-
#define
|
|
9
|
+
#ifndef UTIL_ITERATOR_H
|
|
10
|
+
#define UTIL_ITERATOR_H
|
|
11
11
|
|
|
12
12
|
#include "Util/iterator_range.h"
|
|
13
13
|
#include <cstddef>
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
#include <type_traits>
|
|
16
16
|
#include <utility>
|
|
17
17
|
|
|
18
|
-
namespace
|
|
18
|
+
namespace SVF
|
|
19
19
|
{
|
|
20
20
|
|
|
21
21
|
/// CRTP base class which implements the entire standard iterator facade
|
|
@@ -36,7 +36,7 @@ namespace llvm
|
|
|
36
36
|
/// terms of addition of one. These aren't equivalent for all iterator
|
|
37
37
|
/// categories, and respecting that adds a lot of complexity for little gain.
|
|
38
38
|
///
|
|
39
|
-
/// Classes wishing to use `
|
|
39
|
+
/// Classes wishing to use `iter_facade_base` should implement the following
|
|
40
40
|
/// methods:
|
|
41
41
|
///
|
|
42
42
|
/// Forward Iterators:
|
|
@@ -64,7 +64,7 @@ namespace llvm
|
|
|
64
64
|
template <typename DerivedT, typename IteratorCategoryT, typename T,
|
|
65
65
|
typename DifferenceTypeT = std::ptrdiff_t, typename PointerT = T *,
|
|
66
66
|
typename ReferenceT = T &>
|
|
67
|
-
class
|
|
67
|
+
class iter_facade_base
|
|
68
68
|
{
|
|
69
69
|
public:
|
|
70
70
|
using iterator_category = IteratorCategoryT;
|
|
@@ -89,7 +89,7 @@ protected:
|
|
|
89
89
|
/// reference via a conversion operator.
|
|
90
90
|
class ReferenceProxy
|
|
91
91
|
{
|
|
92
|
-
friend
|
|
92
|
+
friend iter_facade_base;
|
|
93
93
|
|
|
94
94
|
DerivedT I;
|
|
95
95
|
|
|
@@ -105,7 +105,7 @@ protected:
|
|
|
105
105
|
public:
|
|
106
106
|
DerivedT operator+(DifferenceTypeT n) const
|
|
107
107
|
{
|
|
108
|
-
static_assert(std::is_base_of<
|
|
108
|
+
static_assert(std::is_base_of<iter_facade_base, DerivedT>::value,
|
|
109
109
|
"Must pass the derived type to this template!");
|
|
110
110
|
static_assert(
|
|
111
111
|
IsRandomAccess,
|
|
@@ -133,7 +133,7 @@ public:
|
|
|
133
133
|
|
|
134
134
|
DerivedT &operator++()
|
|
135
135
|
{
|
|
136
|
-
static_assert(std::is_base_of<
|
|
136
|
+
static_assert(std::is_base_of<iter_facade_base, DerivedT>::value,
|
|
137
137
|
"Must pass the derived type to this template!");
|
|
138
138
|
return static_cast<DerivedT *>(this)->operator+=(1);
|
|
139
139
|
}
|
|
@@ -232,20 +232,20 @@ template <
|
|
|
232
232
|
std::is_same<T, typename std::iterator_traits<
|
|
233
233
|
WrappedIteratorT>::value_type>::value,
|
|
234
234
|
typename std::iterator_traits<WrappedIteratorT>::reference, T &>>
|
|
235
|
-
class
|
|
236
|
-
: public
|
|
235
|
+
class iter_adaptor_base
|
|
236
|
+
: public iter_facade_base<DerivedT, IteratorCategoryT, T,
|
|
237
237
|
DifferenceTypeT, PointerT, ReferenceT>
|
|
238
238
|
{
|
|
239
|
-
using BaseT = typename
|
|
239
|
+
using BaseT = typename iter_adaptor_base::iter_facade_base;
|
|
240
240
|
|
|
241
241
|
protected:
|
|
242
242
|
WrappedIteratorT I;
|
|
243
243
|
|
|
244
|
-
|
|
244
|
+
iter_adaptor_base() = default;
|
|
245
245
|
|
|
246
|
-
explicit
|
|
246
|
+
explicit iter_adaptor_base(WrappedIteratorT u) : I(std::move(u))
|
|
247
247
|
{
|
|
248
|
-
static_assert(std::is_base_of<
|
|
248
|
+
static_assert(std::is_base_of<iter_adaptor_base, DerivedT>::value,
|
|
249
249
|
"Must pass the derived type to this template!");
|
|
250
250
|
}
|
|
251
251
|
|
|
@@ -300,13 +300,13 @@ public:
|
|
|
300
300
|
return *static_cast<DerivedT *>(this);
|
|
301
301
|
}
|
|
302
302
|
|
|
303
|
-
friend bool operator==(const
|
|
304
|
-
const
|
|
303
|
+
friend bool operator==(const iter_adaptor_base &LHS,
|
|
304
|
+
const iter_adaptor_base &RHS)
|
|
305
305
|
{
|
|
306
306
|
return LHS.I == RHS.I;
|
|
307
307
|
}
|
|
308
|
-
friend bool operator<(const
|
|
309
|
-
const
|
|
308
|
+
friend bool operator<(const iter_adaptor_base &LHS,
|
|
309
|
+
const iter_adaptor_base &RHS)
|
|
310
310
|
{
|
|
311
311
|
static_assert(
|
|
312
312
|
BaseT::IsRandomAccess,
|
|
@@ -327,21 +327,21 @@ public:
|
|
|
327
327
|
/// which is implemented with some iterator over T*s:
|
|
328
328
|
///
|
|
329
329
|
/// \code
|
|
330
|
-
/// using iterator =
|
|
330
|
+
/// using iterator = pointee_iter<SmallVectorImpl<T *>::iterator>;
|
|
331
331
|
/// \endcode
|
|
332
332
|
template <typename WrappedIteratorT,
|
|
333
333
|
typename T = std::remove_reference_t<decltype(
|
|
334
334
|
**std::declval<WrappedIteratorT>())>>
|
|
335
|
-
struct
|
|
336
|
-
:
|
|
337
|
-
|
|
335
|
+
struct pointee_iter
|
|
336
|
+
: iter_adaptor_base<
|
|
337
|
+
pointee_iter<WrappedIteratorT, T>, WrappedIteratorT,
|
|
338
338
|
typename std::iterator_traits<WrappedIteratorT>::iterator_category,
|
|
339
339
|
T>
|
|
340
340
|
{
|
|
341
|
-
|
|
341
|
+
pointee_iter() = default;
|
|
342
342
|
template <typename U>
|
|
343
|
-
|
|
344
|
-
:
|
|
343
|
+
pointee_iter(U &&u)
|
|
344
|
+
: pointee_iter::iter_adaptor_base(std::forward<U &&>(u)) {}
|
|
345
345
|
|
|
346
346
|
T &operator*() const
|
|
347
347
|
{
|
|
@@ -351,10 +351,10 @@ struct pointee_iterator
|
|
|
351
351
|
|
|
352
352
|
template <typename RangeT, typename WrappedIteratorT =
|
|
353
353
|
decltype(std::begin(std::declval<RangeT>()))>
|
|
354
|
-
|
|
355
|
-
|
|
354
|
+
iter_range<pointee_iter<WrappedIteratorT>>
|
|
355
|
+
make_pointee_range(RangeT &&Range)
|
|
356
356
|
{
|
|
357
|
-
using PointeeIteratorT =
|
|
357
|
+
using PointeeIteratorT = pointee_iter<WrappedIteratorT>;
|
|
358
358
|
return make_range(PointeeIteratorT(std::begin(std::forward<RangeT>(Range))),
|
|
359
359
|
PointeeIteratorT(std::end(std::forward<RangeT>(Range))));
|
|
360
360
|
}
|
|
@@ -362,7 +362,7 @@ iterator_range<pointee_iterator<WrappedIteratorT>>
|
|
|
362
362
|
template <typename WrappedIteratorT,
|
|
363
363
|
typename T = decltype(&*std::declval<WrappedIteratorT>())>
|
|
364
364
|
class pointer_iterator
|
|
365
|
-
: public
|
|
365
|
+
: public iter_adaptor_base<
|
|
366
366
|
pointer_iterator<WrappedIteratorT, T>, WrappedIteratorT,
|
|
367
367
|
typename std::iterator_traits<WrappedIteratorT>::iterator_category,
|
|
368
368
|
T>
|
|
@@ -373,7 +373,7 @@ public:
|
|
|
373
373
|
pointer_iterator() = default;
|
|
374
374
|
|
|
375
375
|
explicit pointer_iterator(WrappedIteratorT u)
|
|
376
|
-
: pointer_iterator::
|
|
376
|
+
: pointer_iterator::iter_adaptor_base(std::move(u)) {}
|
|
377
377
|
|
|
378
378
|
T &operator*()
|
|
379
379
|
{
|
|
@@ -387,7 +387,7 @@ public:
|
|
|
387
387
|
|
|
388
388
|
template <typename RangeT, typename WrappedIteratorT =
|
|
389
389
|
decltype(std::begin(std::declval<RangeT>()))>
|
|
390
|
-
|
|
390
|
+
iter_range<pointer_iterator<WrappedIteratorT>>
|
|
391
391
|
make_pointer_range(RangeT &&Range)
|
|
392
392
|
{
|
|
393
393
|
using PointerIteratorT = pointer_iterator<WrappedIteratorT>;
|
|
@@ -400,7 +400,7 @@ template <typename WrappedIteratorT,
|
|
|
400
400
|
**std::declval<WrappedIteratorT>())>,
|
|
401
401
|
typename T2 = std::add_pointer_t<T1>>
|
|
402
402
|
using raw_pointer_iterator =
|
|
403
|
-
pointer_iterator<
|
|
403
|
+
pointer_iterator<pointee_iter<WrappedIteratorT, T1>, T2>;
|
|
404
404
|
|
|
405
405
|
} // end namespace llvm
|
|
406
406
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//===-
|
|
1
|
+
//===- iter_range.h - A range adaptor for iterators ---------*- C++ -*-===//
|
|
2
2
|
//
|
|
3
3
|
// From the LLVM Project with some modifications, under the Apache License v2.0
|
|
4
4
|
// with LLVM Exceptions. See https://llvm.org/LICENSE.txt for license information.
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
///
|
|
16
16
|
//===----------------------------------------------------------------------===//
|
|
17
17
|
|
|
18
|
-
#ifndef
|
|
19
|
-
#define
|
|
18
|
+
#ifndef UTIL_ITERATOR_RANGE_H
|
|
19
|
+
#define UTIL_ITERATOR_RANGE_H
|
|
20
20
|
|
|
21
21
|
#include <utility>
|
|
22
22
|
|
|
23
|
-
namespace
|
|
23
|
+
namespace SVF
|
|
24
24
|
{
|
|
25
25
|
|
|
26
26
|
/// A range adaptor for a pair of iterators.
|
|
@@ -28,7 +28,7 @@ namespace llvm
|
|
|
28
28
|
/// This just wraps two iterators into a range-compatible interface. Nothing
|
|
29
29
|
/// fancy at all.
|
|
30
30
|
template <typename IteratorT>
|
|
31
|
-
class
|
|
31
|
+
class iter_range
|
|
32
32
|
{
|
|
33
33
|
IteratorT begin_iterator, end_iterator;
|
|
34
34
|
|
|
@@ -36,10 +36,10 @@ public:
|
|
|
36
36
|
//TODO: Add SFINAE to test that the Container's iterators match the range's
|
|
37
37
|
// iterators.
|
|
38
38
|
template <typename Container>
|
|
39
|
-
|
|
39
|
+
iter_range(Container &&c)
|
|
40
40
|
//TODO: Consider ADL/non-member begin/end calls.
|
|
41
41
|
: begin_iterator(c.begin()), end_iterator(c.end()) {}
|
|
42
|
-
|
|
42
|
+
iter_range(IteratorT begin_iterator, IteratorT end_iterator)
|
|
43
43
|
: begin_iterator(std::move(begin_iterator)),
|
|
44
44
|
end_iterator(std::move(end_iterator)) {}
|
|
45
45
|
|
|
@@ -61,14 +61,14 @@ public:
|
|
|
61
61
|
///
|
|
62
62
|
/// This provides a bit of syntactic sugar to make using sub-ranges
|
|
63
63
|
/// in for loops a bit easier. Analogous to std::make_pair().
|
|
64
|
-
template <class T>
|
|
64
|
+
template <class T> iter_range<T> make_range(T x, T y)
|
|
65
65
|
{
|
|
66
|
-
return
|
|
66
|
+
return iter_range<T>(std::move(x), std::move(y));
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
template <typename T>
|
|
69
|
+
template <typename T> iter_range<T> make_range(std::pair<T, T> p)
|
|
70
70
|
{
|
|
71
|
-
return
|
|
71
|
+
return iter_range<T>(std::move(p.first), std::move(p.second));
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
}
|
|
@@ -45,7 +45,7 @@ class WPASolver
|
|
|
45
45
|
|
|
46
46
|
public:
|
|
47
47
|
///Define the GTraits and node iterator for printing
|
|
48
|
-
typedef
|
|
48
|
+
typedef SVF::GenericGraphTraits<GraphType> GTraits;
|
|
49
49
|
typedef typename GTraits::NodeRef GNODE;
|
|
50
50
|
typedef typename GTraits::EdgeType GEDGE;
|
|
51
51
|
typedef typename GTraits::ChildIteratorType child_iterator;
|