Skip to content

Commit b861621

Browse files
committed
Clang-format instrumentation code
1 parent 1c6f4b0 commit b861621

13 files changed

+885
-861
lines changed

src/taint-analysis/taint_security_scanner.cpp

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,24 @@
55

66
#include "taint_security_scanner.h"
77
#include "taint_config.h"
8-
#include "taint_program.h"
98
#include "taint_lvalue_numbering_maps.h"
9+
#include "taint_program.h"
10+
#include "taint_rules.h"
11+
#include "taint_serializer_traits.h"
1012
#include "taint_statistics.h"
13+
#include "taint_statistics_dump.h"
1114
#include "taint_summary.h"
12-
#include "taint_rules.h"
13-
#include "taint_tokens_propagation_graph.h"
1415
#include "taint_summary_dump.h"
15-
#include "taint_statistics_dump.h"
16+
#include "taint_tokens_propagation_graph.h"
17+
#include <chrono> // NOLINT(*) : Google has its own time library.
18+
#include <iomanip>
19+
#include <memory>
1620
#include <taint-instrumenter/instrumentation_driver.h>
1721
#include <util/config.h>
18-
#include <util/msgstream.h>
1922
#include <util/json_map_serializer.h>
23+
#include <util/msgstream.h>
2024
#include <util/tmprof.h>
21-
#include "taint_serializer_traits.h"
22-
#include <iomanip>
23-
#include <memory>
24-
#include <chrono> // NOLINT(*) : Google has its own time library.
25-
// So they suppress chrono.
25+
// So they suppress chrono.
2626

2727
/// \return true if the run was successful, false if there was a problem reading
2828
/// one of the input files could not be read
@@ -207,24 +207,21 @@ bool taint_do_security_scan(
207207
const std::string svg_path =
208208
(results_dir / "tokens_propagation_graph.svg").native();
209209

210-
logger.status()
211-
<< "Saving tokens propagation graph (see '"
212-
<< svg_path
213-
<< "')." << messaget::eom;
210+
logger.status() << "Saving tokens propagation graph (see '" << svg_path
211+
<< "')." << messaget::eom;
214212
auto ignore = std::system(
215213
(std::string("dot -Tsvg \"") +
216214
(results_dir / "tokens_propagation_graph.dot").native() + "\" -o \"" +
217215
(results_dir / "tokens_propagation_graph.svg").native() + "\"")
218-
.c_str());
216+
.c_str());
219217
(void)ignore; // We do not care about the return value, because
220218
// if the call fails, then the link to the SVG
221219
// image in the debug HTML output won't work.
222220
// That is all.
223221

224222
logger.status() << "Saving call graph." << messaget::eom;
225223
dump_callgraph_in_svg(
226-
program.get_call_graph(),
227-
(results_dir / "call_graph.svg").native());
224+
program.get_call_graph(), (results_dir / "call_graph.svg").native());
228225
logger.status() << "Saving inverted call graph." << messaget::eom;
229226
dump_callgraph_in_svg(
230227
program.get_inverted_call_graph(),
@@ -234,7 +231,8 @@ bool taint_do_security_scan(
234231
else
235232
{
236233
logger.error() << "Instrumentation was skipped due to timeout. Continuing "
237-
"to dump output if requested" << messaget::eom;
234+
"to dump output if requested"
235+
<< messaget::eom;
238236
}
239237

240238
if(config.is_html_dump_of_summaries_enabled())

src/taint-instrumenter/instrumentation_driver.cpp

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
/// The module implements instrumentation of the passed GOTO program according
55
/// to propagation of tainted data through it.
66

7+
#include <algorithm>
8+
#include <fstream>
9+
#include <summaries/summary_dump.h>
710
#include <taint-instrumenter/instrumentation_driver.h>
8-
#include <taint-instrumenter/search_for_rule_applications.h>
911
#include <taint-instrumenter/instrumentation_props.h>
10-
#include <taint-instrumenter/instrumenter.h>
1112
#include <taint-instrumenter/instrumented_goto_binary_builder.h>
12-
#include <util/msgstream.h>
13+
#include <taint-instrumenter/instrumenter.h>
14+
#include <taint-instrumenter/search_for_rule_applications.h>
1315
#include <util/file_util.h>
16+
#include <util/msgstream.h>
1417
#include <util/tmprof.h>
15-
#include <summaries/summary_dump.h>
16-
#include <algorithm>
17-
#include <fstream>
1818

1919
taint_instrumentation_drivert::taint_instrumentation_drivert(
2020
const taint_programt &program,
@@ -49,12 +49,11 @@ void taint_instrumentation_drivert::run(
4949

5050
statistics.begin_search_for_rule_applications();
5151

52-
logger.status()
53-
<< "Starting instrumenter on the analysed program." << messaget::eom;
52+
logger.status() << "Starting instrumenter on the analysed program."
53+
<< messaget::eom;
5454

5555
logger.status() << " Searching for rule applications." << messaget::eom;
56-
rule_application_sitest
57-
map_from_functions_to_rule_application_sites;
56+
rule_application_sitest map_from_functions_to_rule_application_sites;
5857
taint_search_for_rule_applications(
5958
summaries, map_from_functions_to_rule_application_sites, program);
6059

@@ -72,8 +71,8 @@ void taint_instrumentation_drivert::run(
7271
statistics.end_search_for_rule_applications();
7372
statistics.begin_instrumentation_props();
7473

75-
logger.status()
76-
<< " Collecting the instrumentation properties." << messaget::eom;
74+
logger.status() << " Collecting the instrumentation properties."
75+
<< messaget::eom;
7776

7877
taint_instrumentation_propst instrumentation_props(
7978
map_from_functions_to_rule_application_sites,
@@ -83,8 +82,8 @@ void taint_instrumentation_drivert::run(
8382

8483
// Dump computed instrumentation props into JSON files.
8584
{
86-
logger.status()
87-
<< " Saving instrumentation properties as JSON." << messaget::eom;
85+
logger.status() << " Saving instrumentation properties as JSON."
86+
<< messaget::eom;
8887
json_objectt jobj;
8988
dump_as_json(instrumentation_props, jobj);
9089
std::ofstream ostr((results_dir / "instrumentation_props.json").native());
@@ -109,11 +108,10 @@ void taint_instrumentation_drivert::run(
109108
statistics.end_instrumenter();
110109
statistics.begin_instrumented_goto_binary_build();
111110

112-
logger.status()
113-
<< " Starting the builder of the instrumented GOTO binary."
114-
<< messaget::eom;
111+
logger.status() << " Starting the builder of the instrumented GOTO binary."
112+
<< messaget::eom;
115113

116-
const std::pair<taint_instrumented_goto_binary_infot,std::string>
114+
const std::pair<taint_instrumented_goto_binary_infot, std::string>
117115
task_valid = build_instrumented_goto_binary(
118116
instrumentation_props,
119117
instrumenter,
@@ -126,13 +124,12 @@ void taint_instrumentation_drivert::run(
126124
string_refinement_enabled);
127125
if(task_valid.second.empty())
128126
{
129-
logger.status()
130-
<< " Saving info JSON file about the saved GOTO binary."
131-
<< messaget::eom;
127+
logger.status() << " Saving info JSON file about the saved GOTO binary."
128+
<< messaget::eom;
132129

133130
json_objectt jtask;
134131
dump_as_json(task_valid.first, jtask);
135-
std::ofstream ostr(
132+
std::ofstream ostr(
136133
(results_dir / "instrumented_goto_program.json").native());
137134
ostr << jtask;
138135
}

src/taint-instrumenter/instrumentation_driver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
#define CPROVER_TAINT_INSTRUMENTER_INSTRUMENTATION_DRIVER_H
1111

1212
#include <taint-analysis/taint_program.h>
13-
#include <taint-analysis/taint_tokens_propagation_graph.h>
1413
#include <taint-analysis/taint_summary.h>
14+
#include <taint-analysis/taint_tokens_propagation_graph.h>
1515
#include <util/message.h>
1616

1717
#include <boost/filesystem.hpp>

0 commit comments

Comments
 (0)