Skip to content

Commit a3aac85

Browse files
author
owen-jones-diffblue
authored
Merge pull request diffblue#346 from diffblue/owen-jones-diffblue/cmd-line-option-turn-off-precise-access-paths
Add command line option to turn off precise access paths
2 parents 2d80456 + 73570b8 commit a3aac85

File tree

5 files changed

+21
-1
lines changed

5 files changed

+21
-1
lines changed

src/driver/sec_driver_parse_options.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
#include <taint-analysis/taint_security_scanner.h>
6161

6262
#include <pointer-analysis/evs_pretty_printer.h>
63+
#include <pointer-analysis/local_value_set.h>
6364

6465
#include "sec_driver_parse_options.h"
6566

@@ -170,6 +171,11 @@ int sec_driver_parse_optionst::doit()
170171
return 6;
171172
}
172173

174+
if (cmdline.isset("do-not-use-precise-access-paths"))
175+
{
176+
local_value_sett::do_not_use_precise_access_paths = true;
177+
}
178+
173179
if (cmdline.isset("security-scanner"))
174180
{
175181
return taint_do_security_scan(

src/driver/sec_driver_parse_options.h

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class optionst;
4040
"(lvsa-summary-directory):" \
4141
"(local-value-set-analysis)(show-value-sets)(lvsa-function):" \
4242
"(security-scanner):" \
43+
"(do-not-use-precise-access-paths)" \
4344
"(rebuild-taint-cache)" \
4445
UI_MESSAGE_OPTIONS \
4546
JAVA_BYTECODE_LANGUAGE_OPTIONS \

src/pointer-analysis/external_value_set_expr.h

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <sstream>
1010
#include <util/std_expr.h>
11+
#include "local_value_set.h"
1112

1213
// An access path entry, indicating that an external object
1314
// was accessed using e.g. member-x--of-dereference (written
@@ -167,6 +168,8 @@ class external_value_set_exprt : public exprt
167168

168169
bool can_extend_to_precise() const
169170
{
171+
if(local_value_sett::do_not_use_precise_access_paths)
172+
return false;
170173
#ifdef DO_NOT_USE_PRECISE_EXTERNAL_VALUE_SETS
171174
return false;
172175
#else

src/pointer-analysis/local_value_set.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
/// Local value-set analysis
55

66
#include "local_value_set.h"
7+
#include "external_value_set_expr.h"
78

89
#include <util/simplify_expr_class.h>
910
#include <util/infix.h>
@@ -17,6 +18,8 @@
1718
// For documentation of members of `local_value_sett`, see the corresponding
1819
// header file, `local_value_set.h`.
1920

21+
bool local_value_sett::do_not_use_precise_access_paths = false;
22+
2023
void local_value_sett::make_union_adjusting_evs_types(
2124
object_mapt &dest,
2225
const object_mapt &src,

src/pointer-analysis/local_value_set.h

+8-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
#include <pointer-analysis/value_set.h>
1010
#include <util/json.h>
11-
#include "external_value_set_expr.h"
1211

1312
class local_value_sett : public value_sett
1413
{
@@ -18,13 +17,21 @@ class local_value_sett : public value_sett
1817
public:
1918
typedef value_sett baset;
2019

20+
/// Quick hack to allow turning of precise access paths via a command line
21+
/// option. If this is still in the code in 2019 then shoot Chris Smowton
22+
/// and Nathan Phillips for allowing me to do it.
23+
static bool do_not_use_precise_access_paths;
24+
25+
2126
mutable bool precise_evs_curtailed_because_of_loop = false;
2227

2328
/// Determines whether we should export precise or per_field external value
2429
/// sets in function summaries.
2530
/// \return
2631
bool should_export_precise_external_value_sets() const
2732
{
33+
if(do_not_use_precise_access_paths)
34+
return false;
2835
#ifdef DO_NOT_USE_PRECISE_EXTERNAL_VALUE_SETS
2936
return false;
3037
#else

0 commit comments

Comments
 (0)