[ubsan] Implement the -fcatch-undefined-behavior flag using a trapping

implementation; this is much more inline with the original implementation
(i.e., pre-ubsan) and does not require run-time library support.

The trapping implementation can be invoked using either '-fcatch-undefined-behavior'
or '-fsanitize=undefined-trap -fsanitize-undefined-trap-on-error', with the latter
being preferred.  Eventually, the -fcatch-undefined-behavior' flag will be removed.

llvm-svn: 173848
This commit is contained in:
Chad Rosier
2013-01-29 23:31:22 +00:00
parent 01edb9d7d1
commit ae229d599b
12 changed files with 251 additions and 13 deletions

View File

@@ -392,6 +392,8 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
Args.hasArg(OPT_fsanitize_memory_track_origins);
Opts.SanitizeAddressZeroBaseShadow =
Args.hasArg(OPT_fsanitize_address_zero_base_shadow);
Opts.SanitizeUndefinedTrapOnError =
Args.hasArg(OPT_fsanitize_undefined_trap_on_error);
Opts.SSPBufferSize =
Args.getLastArgIntValue(OPT_stack_protector_buffer_size, 8, Diags);
Opts.StackRealignment = Args.hasArg(OPT_mstackrealign);