Skip to content

Commit 17903ee

Browse files
committed
Updates requested in the PR.
1 parent 6eaa4e3 commit 17903ee

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

src/taint-slicer/instrumentation_props.cpp

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ instrumentation_props data structure.
3232
bool is_primitive_type(const typet &type)
3333
{
3434
return type==java_boolean_type() ||
35-
type==java_boolean_type() ||
3635
type==java_byte_type() ||
3736
type==java_char_type() ||
3837
type==java_short_type() ||
@@ -42,12 +41,12 @@ bool is_primitive_type(const typet &type)
4241
type==java_double_type();
4342
}
4443

45-
std::string parse_type_name(const typet &type, const namespacet &ns)
44+
std::string unwrap_type_name(const typet &type, const namespacet &ns)
4645
{
4746
if(type.id()==ID_pointer)
48-
return parse_type_name(to_pointer_type(type).subtype(), ns);
47+
return unwrap_type_name(to_pointer_type(type).subtype(), ns);
4948
if(type.id()==ID_array)
50-
return parse_type_name(to_array_type(type).subtype(), ns);
49+
return unwrap_type_name(to_array_type(type).subtype(), ns);
5150
if(type.id()==ID_symbol)
5251
return as_string(to_symbol_type(type).get_identifier());
5352
const std::string result=type2java(type, ns);
@@ -175,6 +174,11 @@ Function: build_map_from_typenames_to_tokennames
175174
Outputs:
176175
177176
Purpose:
177+
The function fills in the member map "datatypes" so that for each
178+
data type (identified by its type name, see "unwrap_type_name") to be
179+
instrumented by a shadow variable there is computed an instance of
180+
"taint_instrumentation_propst::datatype_infot" type holding details
181+
about the instrumentation of the shadow variable into that type.
178182
179183
\*******************************************************************/
180184
void taint_instrumentation_propst::build_map_from_typenames_to_tokennames(
@@ -192,7 +196,6 @@ void taint_instrumentation_propst::build_map_from_typenames_to_tokennames(
192196
const std::string callee_ident = as_string(callee_id);
193197
const code_typet &fn_type =
194198
program.get_functions().function_map.at(callee_id).type;
195-
(void)fn_type;
196199

197200
std::set<argidx_and_tokennamet> to_process;
198201
for(const auto &elem : loc.get_assumption())
@@ -204,16 +207,18 @@ void taint_instrumentation_propst::build_map_from_typenames_to_tokennames(
204207

205208
for(const auto& arg_token : to_process)
206209
{
207-
assert(arg_token.get_argidx()!=
208-
taint_tokens_propagation_grapht::get_void_loc());
210+
assert(
211+
arg_token.get_argidx()!=
212+
taint_tokens_propagation_grapht::get_void_loc());
209213
std::string datatype;
210214
typet type;
211215
if(arg_token.get_argidx()==-1) // Return value?
212216
type=get_return_type_from_function_name(
213-
callee_ident, program.get_symbol_table());
217+
callee_ident,
218+
program.get_symbol_table());
214219
else
215220
type=fn_type.parameters().at(arg_token.get_argidx()).type();
216-
datatype=parse_type_name(type, program.get_namespace());
221+
datatype=unwrap_type_name(type, program.get_namespace());
217222
auto it=datatypes.find(datatype);
218223
if(it!=datatypes.end())
219224
{

src/taint-slicer/instrumentation_props.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ void taint_build_instrumentation_props(
155155
std::vector<taint_instrumentation_propst> &output);
156156

157157
bool is_primitive_type(const typet &type);
158-
std::string parse_type_name(const typet &type, const namespacet &ns);
158+
std::string unwrap_type_name(const typet &type, const namespacet &ns);
159159
bool is_java_array_type_name(const std::string &datatype);
160160
bool does_instrumentation_of_type_require_subclass(
161161
const std::string &datatype, const typet &type);

0 commit comments

Comments
 (0)