svf-lib 1.0.1262 → 1.0.1263

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.
@@ -177,6 +177,16 @@ public:
177
177
  this->terminals = terminals;
178
178
  }
179
179
 
180
+ inline Map<std::string, Kind>& getEBNFSigns()
181
+ {
182
+ return this->EBNFSigns;
183
+ }
184
+
185
+ inline void setEBNFSigns(Map<std::string, Kind>& EBNFSigns)
186
+ {
187
+ this->EBNFSigns = EBNFSigns;
188
+ }
189
+
180
190
  inline SymbolMap<Symbol, Productions>& getRawProductions()
181
191
  {
182
192
  return this->rawProductions;
@@ -248,6 +258,8 @@ public:
248
258
 
249
259
  Symbol insertTerminalSymbol(std::string strLit);
250
260
 
261
+ Symbol insertEBNFSigns(std::string strLit);
262
+
251
263
  void insertAttribute(Kind kind, Attribute a);
252
264
 
253
265
  inline static Kind getAttributedKind(Attribute attribute, Kind kind)
@@ -268,6 +280,7 @@ protected:
268
280
  private:
269
281
  Map<std::string, Kind> nonterminals;
270
282
  Map<std::string, Kind> terminals;
283
+ Map<std::string, Kind> EBNFSigns; /// Map contains Signs' String and associated Symbols
271
284
  Set<Kind> attributeKinds;
272
285
  Map<Kind, Set<Attribute>> kind2AttrsMap;
273
286
  SymbolMap<Symbol, Productions> rawProductions;
@@ -3,37 +3,13 @@ Start:
3
3
  Terminal:
4
4
  addr copy store load gep vgep
5
5
  Productions:
6
- F -> epsilon;
7
- F -> F copy;
8
- F -> addr Memflow;
9
- F -> F store V load;
10
- F -> store Memflow load;
11
- Fbar -> epsilon;
12
- Fbar -> copybar Fbar;
13
- Fbar -> Memflowbar addrbar;
14
- Fbar -> loadbar V storebar Fbar;
15
- Fbar -> loadbar Memflowbar storebar;
16
- V -> Fbar V F;
17
- V -> addrbar addr;
18
- V -> gepbar_i V gep_i;
19
- V -> gepbarpath V gep_0;
20
- V -> gepbar_i F gep_i;
21
- V -> gepbar_i Fbar gep_i;
22
- copy -> vgep;
6
+ F -> epsilon | F copy | addr Memflow | F store V load | store Memflow load;
7
+ Fbar -> epsilon | copybar Fbar | Memflowbar addrbar | loadbar V storebar Fbar | loadbar Memflowbar storebar;
8
+ V -> Fbar V F | addrbar addr | gepbar_i V gep_i | gepbarpath V gep_0 | gepbar_i F gep_i | gepbar_i Fbar gep_i;
9
+ copy -> vgep;
23
10
  copybar -> vgepbar;
24
- gep_1 -> gep_0 F gep_1;
25
- gepbar_1 -> gepbar_1 Fbar gepbar_0;
26
- gep_1 -> gep_0 F vgep;
27
- gepbar_1 -> vgepbar Fbar gepbar_0;
28
- gepbarpath -> gepbar_0 gepbar_0;
29
- gepbarpath -> gepbarpath gepbar_0;
30
- Memflow -> load store;
31
- Memflow -> Fbar Memflow;
32
- Memflow -> F Memflow Fbar;
33
- Memflow -> gep_i Memflow gepbar_i;
34
- Memflow -> gepbar_i Memflow gep_i;
35
- Memflowbar -> storebar loadbar;
36
- Memflowbar -> Memflowbar F;
37
- Memflowbar -> F Memflowbar Fbar;
38
- Memflowbar -> gep_i Memflowbar gepbar_i;
39
- Memflowbar -> gepbar_i Memflowbar gep_i;
11
+ gep_1 -> gep_0 F vgep | gep_0 F gep_1;
12
+ gepbar_1 -> gepbar_1 Fbar gepbar_0 | vgepbar Fbar gepbar_0;
13
+ gepbarpath -> gepbar_0 gepbar_0 | gepbarpath gepbar_0;
14
+ Memflow -> load store | Fbar Memflow | F Memflow Fbar | gep_i Memflow gepbar_i | gepbar_i Memflow gep_i;;
15
+ Memflowbar -> storebar loadbar | Memflowbar F | F Memflowbar Fbar | gep_i Memflowbar gepbar_i | gepbar_i Memflowbar gep_i;
@@ -67,8 +67,6 @@ public:
67
67
 
68
68
  void collectCFLInfo(CFLGraph* CFLGraph);
69
69
 
70
- void constraintGraphStat();
71
-
72
70
  void CFLGrammarStat();
73
71
  };
74
72
 
@@ -47,6 +47,8 @@ typedef GenericEdge<CFLNode> GenericCFLEdgeTy;
47
47
  class CFLEdge: public GenericCFLEdgeTy
48
48
  {
49
49
  public:
50
+ typedef GenericNode<CFLNode, CFLEdge>::GEdgeSetTy CFLEdgeSetTy;
51
+
50
52
  CFLEdge(CFLNode *s, CFLNode *d, GEdgeFlag k = 0):
51
53
  GenericCFLEdgeTy(s,d,k)
52
54
  {
@@ -78,7 +80,64 @@ public:
78
80
  GenericCFLNodeTy(i, k)
79
81
  {
80
82
  }
83
+
81
84
  ~CFLNode() override = default;
85
+
86
+ /// Different Kind(label) associated edges set
87
+ typedef std::map <CFLEdge::GEdgeKind, CFLEdge::CFLEdgeSetTy> CFLEdgeDataTy;
88
+
89
+ private:
90
+ CFLEdgeDataTy inCFLEdges;
91
+ CFLEdgeDataTy outCFLEdges;
92
+
93
+ public:
94
+ inline const CFLEdge::CFLEdgeSetTy& getInEdgeWithTy(CFLEdge::GEdgeKind k)
95
+ {
96
+ return inCFLEdges[k];
97
+ }
98
+
99
+ inline const CFLEdge::CFLEdgeSetTy& getOutEdgeWithTy(CFLEdge::GEdgeKind k)
100
+ {
101
+ return outCFLEdges[k];
102
+ }
103
+
104
+ inline bool addInEdgeWithKind(CFLEdge* inEdge, CFLEdge::GEdgeKind k)
105
+ {
106
+ assert(inEdge->getDstID() == this->getId());
107
+ bool added1 = addIncomingEdge(inEdge);
108
+ bool added2 = inCFLEdges[k].insert(inEdge).second;
109
+
110
+ return added1 && added2;
111
+ }
112
+
113
+ inline bool addOutEdgeWithKind(CFLEdge* outEdge, CFLEdge::GEdgeKind k)
114
+ {
115
+ assert(outEdge->getSrcID() == this->getId());
116
+ bool added1 = addOutgoingEdge(outEdge);
117
+ bool added2 = outCFLEdges[k].insert(outEdge).second;
118
+
119
+ return added1 && added2;
120
+ }
121
+
122
+ inline bool removeCFLInEdge(CFLEdge* inEdge)
123
+ {
124
+ u32_t num1 = removeIncomingEdge(inEdge);
125
+
126
+ CFLEdge::GEdgeKind k = inEdge->getEdgeKind();
127
+ u32_t num2 = inCFLEdges[k].erase(inEdge);
128
+
129
+ return num1 && num2;
130
+ }
131
+
132
+ inline bool removeCFLOutEdge(CFLEdge* outEdge)
133
+ {
134
+ u32_t num1 = removeOutgoingEdge(outEdge);
135
+
136
+ CFLEdge::GEdgeKind k = outEdge->getEdgeKind();
137
+ u32_t num2 = outCFLEdges[k].erase(outEdge);
138
+
139
+ return num1 && num2;
140
+ }
82
141
  };
83
142
 
84
143
  /// Edge-labeled graph for CFL Reachability analysis
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.1262",
3
+ "version": "1.0.1263",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {