Skip to content

Commit f2d6949

Browse files
committed
Added more attributes (due to requirements of modules not PRed yet).
1 parent 8c84178 commit f2d6949

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

src/taint-slicer/instrumentation_props.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ instrumentation_props data structure.
2929
#include <util/msgstream.h>
3030
#include <deque>
3131

32-
static bool is_primitive_type(const typet type)
32+
bool is_primitive_type(const typet type)
3333
{
3434
return type==java_boolean_type() ||
3535
type==java_boolean_type() ||
@@ -42,7 +42,7 @@ static bool is_primitive_type(const typet type)
4242
type==java_double_type() ;
4343
}
4444

45-
static std::string parse_type_name(const typet &type, const namespacet &ns)
45+
std::string parse_type_name(const typet &type, const namespacet &ns)
4646
{
4747
if(type.id()==ID_pointer)
4848
return parse_type_name(to_pointer_type(type).subtype(), ns);
@@ -58,12 +58,12 @@ static std::string parse_type_name(const typet &type, const namespacet &ns)
5858
return result;
5959
}
6060

61-
static bool is_java_array_type_name(const std::string &datatype)
61+
bool is_java_array_type_name(const std::string &datatype)
6262
{
6363
return has_prefix(datatype, "java::array[") && *datatype.rbegin()==']';
6464
}
6565

66-
static bool does_instrumentation_of_type_require_subclass(
66+
bool does_instrumentation_of_type_require_subclass(
6767
const std::string &datatype, const typet &type)
6868
{
6969
return is_primitive_type(type) ||
@@ -229,6 +229,8 @@ void taint_instrumentation_propst::build_map_from_typenames_to_tokennames(
229229
{
230230
datatype,
231231
{
232+
datatype,
233+
type,
232234
does_instrumentation_of_type_require_subclass(datatype, type),
233235
is_primitive_type(type),
234236
{ arg_token.get_token_name() }

src/taint-slicer/instrumentation_props.h

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,26 @@ class taint_instrumentation_propst
5252
{
5353
public:
5454
datatype_infot(
55+
const taint_datatype_idt &id,
56+
const typet type,
5557
const bool requires_subclass,
5658
const bool is_primitive_type,
5759
const std::set<taint_tokent::namet> &tokens)
58-
: requires_subclass(requires_subclass)
60+
: id(id)
61+
, type(type)
62+
, requires_subclass(requires_subclass)
5963
, is_primitive_type(is_primitive_type)
6064
, tokens(tokens)
6165
{}
66+
const taint_datatype_idt &get_id() const { return id; }
67+
typet get_type() const { return type; }
6268
bool subclass_required() const { return requires_subclass; }
6369
bool is_primitive() const { return is_primitive_type; }
6470
const std::set<taint_tokent::namet> &get_tokens() const { return tokens; }
6571
void add_token(const taint_tokent::namet &tname) { tokens.insert(tname); }
6672
private:
73+
taint_datatype_idt id;
74+
typet type;
6775
bool requires_subclass;
6876
bool is_primitive_type;
6977
std::set<taint_tokent::namet> tokens;
@@ -125,6 +133,8 @@ class taint_instrumentation_propst
125133
from_typenames_to_tokennames_mapt datatypes;
126134
};
127135

136+
typedef taint_instrumentation_propst::datatype_infot taint_datatype_infot;
137+
128138
/*******************************************************************\
129139
130140
Function: taint_build_instrumentation_props
@@ -144,6 +154,12 @@ void taint_build_instrumentation_props(
144154
const taint_programt &program,
145155
std::vector<taint_instrumentation_propst> &output);
146156

157+
bool is_primitive_type(const typet type);
158+
std::string parse_type_name(const typet &type, const namespacet &ns);
159+
bool is_java_array_type_name(const std::string &datatype);
160+
bool does_instrumentation_of_type_require_subclass(
161+
const std::string &datatype, const typet &type);
162+
147163
void dump_as_json(const taint_instrumentation_propst &props, json_objectt &out);
148164

149165
#endif

0 commit comments

Comments
 (0)