svf-lib 1.0.1034 → 1.0.1037
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-linux/Release-build/lib/libSvf.a +0 -0
- package/SVF-linux/include/CFL/CFGNormalizer.h +11 -18
- package/SVF-linux/include/CFL/CFLAlias.h +8 -7
- package/SVF-linux/include/CFL/CFLGramGraphChecker.h +19 -12
- package/SVF-linux/include/CFL/CFLGrammar.h +81 -25
- package/SVF-linux/include/CFL/CFLGrammar.txt +9 -1
- package/SVF-linux/include/CFL/CFLGrammarDev.txt +16 -0
- package/SVF-linux/include/CFL/CFLGraphBuilder.h +51 -11
- package/SVF-linux/include/CFL/CFLSolver.h +2 -0
- package/SVF-linux/include/Graphs/CFLGraph.h +5 -29
- package/SVF-linux/include/SVF-FE/BasicTypes.h +1 -0
- package/SVF-linux/include/SVF-FE/Graph2Json.h +1 -1
- package/SVF-linux/include/SVF-FE/LLVMUtil.h +0 -122
- package/SVF-linux/include/Util/BasicTypes.h +0 -1
- package/SVF-linux/include/Util/SVFUtil.h +124 -0
- package/SVF-osx/Release-build/lib/CUDD/libCudd.a +0 -0
- package/SVF-osx/Release-build/lib/libSvf.a +0 -0
- package/SVF-osx/include/CFL/CFGNormalizer.h +11 -18
- package/SVF-osx/include/CFL/CFLAlias.h +8 -7
- package/SVF-osx/include/CFL/CFLGramGraphChecker.h +19 -12
- package/SVF-osx/include/CFL/CFLGrammar.h +81 -25
- package/SVF-osx/include/CFL/CFLGrammar.txt +9 -1
- package/SVF-osx/include/CFL/CFLGrammarDev.txt +16 -0
- package/SVF-osx/include/CFL/CFLGraphBuilder.h +51 -11
- package/SVF-osx/include/CFL/CFLSolver.h +2 -0
- package/SVF-osx/include/Graphs/CFLGraph.h +5 -29
- package/package.json +1 -1
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
Start:
|
|
2
2
|
V
|
|
3
3
|
Productions:
|
|
4
|
+
F -> Addr;
|
|
5
|
+
F -> Addr ( Copy ) *;
|
|
6
|
+
F -> Addr ( Store V Load ) *;
|
|
4
7
|
F -> ( Copy ) *;
|
|
5
8
|
F -> ( Store V Load ) *;
|
|
9
|
+
Fbar -> Addrbar;
|
|
10
|
+
Fbar -> Addrbar ( Copybar ) *;
|
|
11
|
+
Fbar -> Addrbar ( Loadbar V Storebar ) *;
|
|
6
12
|
Fbar -> ( Copybar ) *;
|
|
7
13
|
Fbar -> ( Loadbar V Storebar ) *;
|
|
8
14
|
V -> Fbar V F;
|
|
9
15
|
V -> Gepbar_i V Gep_i;
|
|
10
16
|
V -> Addrbar Addr;
|
|
11
|
-
V -> epsilon;
|
|
17
|
+
V -> epsilon;
|
|
18
|
+
|
|
19
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Start:
|
|
2
|
+
V
|
|
3
|
+
Productions:
|
|
4
|
+
F -> ( Copy ) *;
|
|
5
|
+
F -> ( Store V Load ) *;
|
|
6
|
+
Fbar -> ( Copybar ) *;
|
|
7
|
+
Fbar -> ( Loadbar Vbar Storebar ) *;
|
|
8
|
+
V -> Fbar V F;
|
|
9
|
+
V -> Gepbar_i V Gep_i;
|
|
10
|
+
V -> Addrbar Addr;
|
|
11
|
+
V -> epsilon;
|
|
12
|
+
Vbar -> Fbar Vbar Fbar;
|
|
13
|
+
Vbar -> Gepbar_i Vbar Gep_i;
|
|
14
|
+
Vbar -> Addrbar Addr;
|
|
15
|
+
Vbar -> epsilon;
|
|
16
|
+
|
|
@@ -39,7 +39,19 @@ namespace SVF
|
|
|
39
39
|
|
|
40
40
|
class CFLGraphBuilder
|
|
41
41
|
{
|
|
42
|
+
private:
|
|
43
|
+
typedef CFLGrammar::Kind Kind;
|
|
44
|
+
typedef CFLGrammar::Symbol Symbol;
|
|
45
|
+
Map<std::string, Kind> label2KindMap;
|
|
46
|
+
Map<Kind, std::string> kind2LabelMap;
|
|
47
|
+
Map<CFLGrammar::Kind, Set<CFLGrammar::Attribute>> kind2AttrsMap;
|
|
48
|
+
bool externMap;
|
|
49
|
+
Symbol current;
|
|
50
|
+
|
|
42
51
|
public:
|
|
52
|
+
/// add attribute to kind2Attribute Map
|
|
53
|
+
void addAttribute(CFLGrammar::Kind kind, CFLGrammar::Attribute attribute);
|
|
54
|
+
|
|
43
55
|
/// Build graph by copying nodes and edges from any graph inherited from GenericGraph
|
|
44
56
|
template<class N, class E>
|
|
45
57
|
void build(GenericGraph<N,E>* graph, CFLGraph* cflGraph)
|
|
@@ -61,11 +73,22 @@ public:
|
|
|
61
73
|
|
|
62
74
|
/// Build Bidirectional graph by copying nodes and edges from any graph inherited from GenericGraph
|
|
63
75
|
template<class N, class E>
|
|
64
|
-
CFLGraph* buildBigraph(GenericGraph<N,E>* graph)
|
|
76
|
+
CFLGraph* buildBigraph(GenericGraph<N,E>* graph, Kind startKind)
|
|
65
77
|
{
|
|
66
|
-
CFLGraph *cflGraph = new CFLGraph();
|
|
78
|
+
CFLGraph *cflGraph = new CFLGraph(startKind);
|
|
67
79
|
Map<std::string, SVF::CFLGraph::Symbol> ConstMap = {{"Addr",0}, {"Copy", 1},{"Store", 2},{"Load", 3},{"Gep_i", 4},{"Vgep", 5},{"Addrbar",6}, {"Copybar", 7},{"Storebar", 8},{"Loadbar", 9},{"Gepbar_i", 10},{"Vgepbar", 11}};
|
|
68
|
-
|
|
80
|
+
externMap = true;
|
|
81
|
+
for(auto pairV : ConstMap)
|
|
82
|
+
{
|
|
83
|
+
if(label2KindMap.find(pairV.first) == label2KindMap.end())
|
|
84
|
+
{
|
|
85
|
+
label2KindMap.insert(pairV);
|
|
86
|
+
}
|
|
87
|
+
if(kind2LabelMap.find(pairV.second) == kind2LabelMap.end())
|
|
88
|
+
{
|
|
89
|
+
kind2LabelMap.insert(make_pair(pairV.second, pairV.first));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
69
92
|
for(auto it = graph->begin(); it!= graph->end(); it++)
|
|
70
93
|
{
|
|
71
94
|
CFLNode* node = new CFLNode((*it).first);
|
|
@@ -82,23 +105,23 @@ public:
|
|
|
82
105
|
if(NormalGepCGEdge::classof(edge))
|
|
83
106
|
{
|
|
84
107
|
NormalGepCGEdge *nGepEdge = SVFUtil::dyn_cast<NormalGepCGEdge>(edge);
|
|
85
|
-
CFLGrammar::Attribute
|
|
86
|
-
|
|
87
|
-
edgeLabel = CFLGrammar::getAttributedKind(
|
|
108
|
+
CFLGrammar::Attribute attr = nGepEdge->getConstantFieldIdx();
|
|
109
|
+
addAttribute(edgeLabel, attr);
|
|
110
|
+
edgeLabel = CFLGrammar::getAttributedKind(attr, edgeLabel);
|
|
88
111
|
cflGraph->addCFLEdge(cflGraph->getGNode(edge->getSrcID()), cflGraph->getGNode(edge->getDstID()), edgeLabel);
|
|
89
|
-
std::string key =
|
|
112
|
+
std::string key = kind2LabelMap[edge->getEdgeKind()];
|
|
90
113
|
key.pop_back();
|
|
91
114
|
key.pop_back(); // _i standsfor attribute variable should place at last
|
|
92
115
|
key.append("bar_i"); // for example Gep_i should be Gepbar_i, not Gep_ibar
|
|
93
|
-
cflGraph->addCFLEdge(cflGraph->getGNode(edge->getDstID()), cflGraph->getGNode(edge->getSrcID()), CFLGrammar::getAttributedKind(
|
|
94
|
-
|
|
116
|
+
cflGraph->addCFLEdge(cflGraph->getGNode(edge->getDstID()), cflGraph->getGNode(edge->getSrcID()), CFLGrammar::getAttributedKind(attr, label2KindMap[key]));
|
|
117
|
+
addAttribute(label2KindMap[key], attr);
|
|
95
118
|
}
|
|
96
119
|
else
|
|
97
120
|
{
|
|
98
121
|
cflGraph->addCFLEdge(cflGraph->getGNode(edge->getSrcID()), cflGraph->getGNode(edge->getDstID()), edgeLabel);
|
|
99
|
-
std::string key =
|
|
122
|
+
std::string key = kind2LabelMap[edge->getEdgeKind()];
|
|
100
123
|
key.append("bar");
|
|
101
|
-
cflGraph->addCFLEdge(cflGraph->getGNode(edge->getDstID()), cflGraph->getGNode(edge->getSrcID()),
|
|
124
|
+
cflGraph->addCFLEdge(cflGraph->getGNode(edge->getDstID()), cflGraph->getGNode(edge->getSrcID()), label2KindMap[key]);
|
|
102
125
|
}
|
|
103
126
|
}
|
|
104
127
|
}
|
|
@@ -109,6 +132,23 @@ public:
|
|
|
109
132
|
|
|
110
133
|
/// Build graph from Dot
|
|
111
134
|
CFLGraph *buildFromDot(std::string filename, GrammarBase *grammar);
|
|
135
|
+
|
|
136
|
+
Map<std::string, Kind>& getLabel2KindMap()
|
|
137
|
+
{
|
|
138
|
+
return this->label2KindMap;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
Map<Kind, std::string>& getKind2LabelMap()
|
|
142
|
+
{
|
|
143
|
+
return this->kind2LabelMap;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
Map<CFLGrammar::Kind, Set<CFLGrammar::Attribute>>& getKind2AttrsMap()
|
|
147
|
+
{
|
|
148
|
+
return this->kind2AttrsMap;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
|
|
112
152
|
};
|
|
113
153
|
}// SVF
|
|
114
154
|
|
|
@@ -77,16 +77,13 @@ class CFLGraph: public GenericCFLGraphTy
|
|
|
77
77
|
{
|
|
78
78
|
public:
|
|
79
79
|
typedef CFLGrammar::Symbol Symbol;
|
|
80
|
+
typedef CFLGrammar::Kind Kind;
|
|
80
81
|
typedef GenericNode<CFLNode,CFLEdge>::GEdgeSetTy CFLEdgeSet;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
Map<CFLGrammar::Kind, Set<CFLGrammar::Attribute>> kind2AttrMap;
|
|
85
|
-
bool externMap;
|
|
86
|
-
Symbol current;
|
|
87
|
-
|
|
88
|
-
CFLGraph()
|
|
82
|
+
Kind startKind;
|
|
83
|
+
|
|
84
|
+
CFLGraph(Kind kind)
|
|
89
85
|
{
|
|
86
|
+
startKind = kind;
|
|
90
87
|
}
|
|
91
88
|
~CFLGraph() override = default;
|
|
92
89
|
|
|
@@ -100,27 +97,6 @@ public:
|
|
|
100
97
|
|
|
101
98
|
void view();
|
|
102
99
|
|
|
103
|
-
void setMap(Map<std::string, Symbol> &labelMap);
|
|
104
|
-
/// Set label2Sym from External
|
|
105
|
-
void setMap(GrammarBase *grammar);
|
|
106
|
-
|
|
107
|
-
/// add attribute to kind2Attribute Map
|
|
108
|
-
void addAttribute(CFLGrammar::Kind kind, CFLGrammar::Attribute attribute)
|
|
109
|
-
{
|
|
110
|
-
if(kind2AttrMap.find(kind) == kind2AttrMap.end())
|
|
111
|
-
{
|
|
112
|
-
Set<CFLGrammar::Attribute> attrs {attribute};
|
|
113
|
-
kind2AttrMap.insert(make_pair(kind, attrs));
|
|
114
|
-
}
|
|
115
|
-
else
|
|
116
|
-
{
|
|
117
|
-
if(kind2AttrMap[kind].find(attribute) == kind2AttrMap[kind].end())
|
|
118
|
-
{
|
|
119
|
-
kind2AttrMap[kind].insert(attribute);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
100
|
private:
|
|
125
101
|
CFLEdgeSet cflEdgeSet;
|
|
126
102
|
|