summaryrefslogtreecommitdiff
path: root/gcc/asan.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/asan.c')
-rw-r--r--gcc/asan.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/gcc/asan.c b/gcc/asan.c
index 3fe50ef2a09..9f298079d6b 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -2505,7 +2505,7 @@ public:
/* opt_pass methods: */
opt_pass * clone () { return new pass_asan (m_ctxt); }
virtual bool gate (function *) { return gate_asan (); }
- unsigned int execute () { return asan_instrument (); }
+ virtual unsigned int execute (function *) { return asan_instrument (); }
}; // class pass_asan
@@ -2543,7 +2543,7 @@ public:
/* opt_pass methods: */
virtual bool gate (function *) { return !optimize && gate_asan (); }
- unsigned int execute () { return asan_instrument (); }
+ virtual unsigned int execute (function *) { return asan_instrument (); }
}; // class pass_asan_O0
@@ -2557,12 +2557,42 @@ make_pass_asan_O0 (gcc::context *ctxt)
/* Perform optimization of sanitize functions. */
-static unsigned int
-execute_sanopt (void)
+namespace {
+
+const pass_data pass_data_sanopt =
+{
+ GIMPLE_PASS, /* type */
+ "sanopt", /* name */
+ OPTGROUP_NONE, /* optinfo_flags */
+ true, /* has_execute */
+ TV_NONE, /* tv_id */
+ ( PROP_ssa | PROP_cfg | PROP_gimple_leh ), /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ ( TODO_verify_flow | TODO_verify_stmts
+ | TODO_update_ssa ), /* todo_flags_finish */
+};
+
+class pass_sanopt : public gimple_opt_pass
+{
+public:
+ pass_sanopt (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_sanopt, ctxt)
+ {}
+
+ /* opt_pass methods: */
+ virtual bool gate (function *) { return flag_sanitize; }
+ virtual unsigned int execute (function *);
+
+}; // class pass_sanopt
+
+unsigned int
+pass_sanopt::execute (function *fun)
{
basic_block bb;
- FOR_EACH_BB_FN (bb, cfun)
+ FOR_EACH_BB_FN (bb, fun)
{
gimple_stmt_iterator gsi;
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
@@ -2593,36 +2623,6 @@ execute_sanopt (void)
return 0;
}
-namespace {
-
-const pass_data pass_data_sanopt =
-{
- GIMPLE_PASS, /* type */
- "sanopt", /* name */
- OPTGROUP_NONE, /* optinfo_flags */
- true, /* has_execute */
- TV_NONE, /* tv_id */
- ( PROP_ssa | PROP_cfg | PROP_gimple_leh ), /* properties_required */
- 0, /* properties_provided */
- 0, /* properties_destroyed */
- 0, /* todo_flags_start */
- ( TODO_verify_flow | TODO_verify_stmts
- | TODO_update_ssa ), /* todo_flags_finish */
-};
-
-class pass_sanopt : public gimple_opt_pass
-{
-public:
- pass_sanopt (gcc::context *ctxt)
- : gimple_opt_pass (pass_data_sanopt, ctxt)
- {}
-
- /* opt_pass methods: */
- virtual bool gate (function *) { return flag_sanitize; }
- unsigned int execute () { return execute_sanopt (); }
-
-}; // class pass_sanopt
-
} // anon namespace
gimple_opt_pass *