@@ -18,50 +18,20 @@ to the summary based taint analysis.
18
18
#include < algorithm>
19
19
20
20
21
- cond_suppression_idt get_fresh_cond_suppression_id ()
22
- {
23
- static cond_suppression_idt id = 0ULL ;
24
- return ++id;
25
- }
26
-
27
- taint_token_suppressiont::taint_token_suppressiont (
28
- const taint_set_of_svarst &in_vars,
29
- const cond_suppression_idt in_cond_suppression_id
30
- )
31
- : vars(in_vars)
32
- , cond_suppression_id(in_cond_suppression_id)
33
- {}
34
-
35
- void taint_token_suppressiont::insert (const taint_set_of_svarst &in_vars)
36
- {
37
- vars.insert (in_vars.cbegin (),in_vars.cend ());
38
- }
39
-
40
-
41
21
taint_svaluet::taint_svaluet (
42
22
const taint_set_of_tokenst &in_tokens,
43
23
const taint_set_of_svarst &in_vars,
44
- const taint_set_of_condst &in_conds,
45
- const taint_set_of_token_suppressionst &in_suppressions
46
- )
47
- : tokens(in_tokens)
48
- , vars(in_vars)
49
- , conds(in_conds.cbegin(),in_conds.cend())
50
- , suppressions(in_suppressions)
24
+ const taint_set_of_condst &in_conds)
25
+ : tokens(in_tokens), vars(in_vars), conds(in_conds.cbegin(),in_conds.cend())
51
26
{}
52
27
53
28
taint_svaluet::taint_svaluet ()
54
- : tokens()
55
- , vars()
56
- , conds()
57
- , suppressions()
29
+ : tokens(), vars(), conds()
58
30
{}
59
31
60
32
taint_svaluet::taint_svaluet (const taint_svaluet &other)
61
- : tokens(other.get_tokens())
62
- , vars(other.get_vars())
63
- , conds(other.get_conds().cbegin(),other.get_conds().cend())
64
- , suppressions(other.get_suppressions())
33
+ : tokens(other.get_tokens()), vars(other.get_vars()),
34
+ conds(other.get_conds().cbegin(),other.get_conds().cend())
65
35
{
66
36
}
67
37
@@ -71,49 +41,14 @@ void taint_svaluet::join(const taint_svaluet &other)
71
41
tokens.insert (other.get_tokens ().cbegin (),other.get_tokens ().cend ());
72
42
vars.insert (other.get_vars ().cbegin (),other.get_vars ().cend ());
73
43
conds.insert (conds.end (),other.get_conds ().cbegin (),other.get_conds ().cend ());
74
- suppressions.insert (other.get_suppressions ().cbegin (),
75
- other.get_suppressions ().cend ());
76
- }
77
-
78
- void taint_svaluet::suppress (const taint_tokent token)
79
- {
80
- tokens.erase (token);
81
-
82
- cond_suppression_idt cond_suppression_id;
83
- auto it = suppressions.find (token);
84
- if (it == suppressions.end ())
85
- {
86
- cond_suppression_id = get_fresh_cond_suppression_id ();
87
- it = suppressions.insert ({token,{get_vars (),cond_suppression_id}}).first ;
88
- }
89
- else
90
- {
91
- cond_suppression_id = it->second .get_cond_suppression_id ();
92
- it->second .insert (get_vars ());
93
- }
94
-
95
- taint_set_of_condst new_conds;
96
- for (auto & cond : conds)
97
- {
98
- taint_condt tmp = cond;
99
- tmp.insert (cond_suppression_id);
100
- new_conds.push_back (tmp);
101
- }
102
- using std::swap;
103
- swap (new_conds,conds);
104
44
}
105
45
106
46
107
47
taint_condt::taint_condt (
108
48
const std::vector<taint_tokent> &in_tested_symbols,
109
49
const std::vector<taint_svaluet> &in_conditionals,
110
- const taint_svaluet &in_result,
111
- const taint_set_of_cond_suppression_idst in_suppression_ids
112
- )
113
- : tested_symbols(in_tested_symbols)
114
- , conditionals(in_conditionals)
115
- , result(in_result)
116
- , suppression_ids(in_suppression_ids)
50
+ const taint_svaluet &in_result)
51
+ : tested_symbols(in_tested_symbols), conditionals(in_conditionals), result(in_result)
117
52
{}
118
53
119
54
@@ -125,22 +60,20 @@ taint_svaluet taint_make_symbol()
125
60
126
61
taint_svaluet taint_make_symbol (const taint_symbolic_variablet svar)
127
62
{
128
- return {{},{svar},{},{} };
63
+ return {{},{svar},{}};
129
64
}
130
65
131
66
132
67
taint_svaluet taint_make_bottom ()
133
68
{
134
- return {{},{},{},{} };
69
+ return {{},{},{}};
135
70
}
136
71
137
72
bool equal (const taint_svaluet &a, const taint_svaluet &b)
138
73
{
139
74
return a.get_tokens () == b.get_tokens () &&
140
75
a.get_vars () == b.get_vars () &&
141
- a.get_conds () == b.get_conds () &&
142
- a.get_suppressions () == b.get_suppressions ()
143
- ;
76
+ a.get_conds () == b.get_conds ();
144
77
}
145
78
146
79
bool proper_subset (const taint_svaluet &a, const taint_svaluet &b)
@@ -171,10 +104,6 @@ bool proper_subset(const taint_svaluet &a, const taint_svaluet &b)
171
104
if (find (b.get_conds ().begin (),b.get_conds ().end (),elem) == b.get_conds ().end ())
172
105
return false ;
173
106
174
- // TODO: this condition should be improved!
175
- if (!(a.get_suppressions () == b.get_suppressions ()))
176
- return false ;
177
-
178
107
return true ;
179
108
}
180
109
@@ -185,80 +114,18 @@ taint_svaluet join(const taint_svaluet &a, const taint_svaluet &b)
185
114
return result;
186
115
}
187
116
188
- taint_svaluet suppress (const taint_svaluet &a, const taint_tokent token)
189
- {
190
- taint_svaluet result=a;
191
- result.suppress (token);
192
- return result;
193
- }
194
-
195
-
196
117
bool operator ==(const taint_condt &a, const taint_condt &b)
197
118
{
198
119
return a.get_tested_symbols () == b.get_tested_symbols () &&
199
120
a.get_conditionals () == b.get_conditionals () &&
200
- a.get_result_expression () == b.get_result_expression () &&
201
- a.get_suppression_ids () == b.get_suppression_ids ()
202
- ;
203
- }
204
-
205
- bool operator ==(const taint_token_suppressiont &a,
206
- const taint_token_suppressiont &b)
207
- {
208
- return a.get_cond_suppression_id () == b.get_cond_suppression_id () &&
209
- a.get_vars () == a.get_vars ();
121
+ a.get_result_expression () == b.get_result_expression ();
210
122
}
211
123
212
-
213
- // taint_svaluet suppression(
214
- // taint_svaluet const& a,
215
- // taint_svaluet::supressiont const& sub)
216
- // {
217
- // if (a.is_bottom() || a.is_top() || sub.empty())
218
- // return a;
219
-
220
- // taint_set_of_svarst result_set;
221
- // std::vector<taint_symbolic_variablet> result_vector;
222
- // std::set_difference(
223
- // a.get_vars().cbegin(),a.get_vars().cend(),
224
- // sub.cbegin(),sub.cend(),
225
- // std::inserter(result_vector,result_vector.end())
226
- // );
227
- // #ifdef USE_BOOST
228
- // result_set.insert(boost::container::ordered_unique_range_t(),result_vector.begin(),result_vector.end());
229
- // #else
230
- // result.insert(result_vector.begin(),result_vector.end());
231
- // #endif
232
-
233
- // if (result_set.empty())
234
- // return taint_make_bottom();
235
-
236
- // taint_svaluet::supressiont result_suppression;
237
- // std::set_union(
238
- // a.suppression().cbegin(),a.suppression().cend(),
239
- // sub.cbegin(),sub.cend(),
240
- // std::inserter(result_suppression,result_suppression.end())
241
- // );
242
-
243
- // return {result_set,result_suppression,false,false};
244
- // }
245
-
246
124
// void taint_svaluet::add_all(const taint_svaluet& other)
247
125
// {
248
126
// if(m_is_top)
249
127
// return;
250
128
// if(other.m_expression.size())
251
129
// m_is_bottom=false;
252
- // #ifdef USE_BOOST
253
- // m_expression.insert(boost::container::ordered_unique_range_t(),other.m_expression.begin(),other.m_expression.end());
254
- // #else
255
130
// m_expression.insert(other.m_expression.begin(),other.m_expression.end());
256
- // #endif
257
- // taint_svaluet::supressiont result_suppression;
258
- // std::set_intersection(
259
- // suppression().cbegin(),suppression().cend(),
260
- // other.suppression().cbegin(),other.suppression().cend(),
261
- // std::inserter(result_suppression,result_suppression.end())
262
- // );
263
- // m_suppression=std::move(result_suppression);
264
131
// }
0 commit comments