forked from OSchip/llvm-project
Add -f[no-]strict-overflow to the Clang driver. Use it to set the
default for -fwrapv if that flag isn't specified explicitly. We always prefer an explict setting of -fwrapv when present. Also adds support for -fno-wrapv to allow disabling -fwrapv even when -fno-strict-overflow is passed. llvm-svn: 128353
This commit is contained in:
parent
a172e08824
commit
6e50103acd
|
@ -355,12 +355,14 @@ def fno_show_source_location : Flag<"-fno-show-source-location">, Group<f_Group>
|
|||
def fno_spell_checking : Flag<"-fno-spell-checking">, Group<f_Group>;
|
||||
def fno_stack_protector : Flag<"-fno-stack-protector">, Group<f_Group>;
|
||||
def fno_strict_aliasing : Flag<"-fno-strict-aliasing">, Group<f_Group>;
|
||||
def fno_strict_overflow : Flag<"-fno-strict-overflow">, Group<f_Group>;
|
||||
def fno_threadsafe_statics : Flag<"-fno-threadsafe-statics">, Group<f_Group>;
|
||||
def fno_use_cxa_atexit : Flag<"-fno-use-cxa-atexit">, Group<f_Group>;
|
||||
def fno_unit_at_a_time : Flag<"-fno-unit-at-a-time">, Group<f_Group>;
|
||||
def fno_unwind_tables : Flag<"-fno-unwind-tables">, Group<f_Group>;
|
||||
def fno_verbose_asm : Flag<"-fno-verbose-asm">, Group<f_Group>;
|
||||
def fno_working_directory : Flag<"-fno-working-directory">, Group<f_Group>;
|
||||
def fno_wrapv : Flag<"-fno-wrapv">, Group<f_Group>;
|
||||
def fno_zero_initialized_in_bss : Flag<"-fno-zero-initialized-in-bss">, Group<f_Group>;
|
||||
def fobjc_atdefs : Flag<"-fobjc-atdefs">, Group<clang_ignored_f_Group>;
|
||||
def fobjc_call_cxx_cdtors : Flag<"-fobjc-call-cxx-cdtors">, Group<clang_ignored_f_Group>;
|
||||
|
@ -408,6 +410,7 @@ def fsigned_char : Flag<"-fsigned-char">, Group<f_Group>;
|
|||
def fstack_protector_all : Flag<"-fstack-protector-all">, Group<f_Group>;
|
||||
def fstack_protector : Flag<"-fstack-protector">, Group<f_Group>;
|
||||
def fstrict_aliasing : Flag<"-fstrict-aliasing">, Group<f_Group>;
|
||||
def fstrict_overflow : Flag<"-fstrict-overflow">, Group<f_Group>;
|
||||
def fsyntax_only : Flag<"-fsyntax-only">, Flags<[DriverOption]>;
|
||||
def ftabstop_EQ : Joined<"-ftabstop=">, Group<f_Group>;
|
||||
def ferror_limit_EQ : Joined<"-ferror-limit=">, Group<f_Group>;
|
||||
|
|
|
@ -1448,7 +1448,17 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
CmdArgs.push_back(A->getValue(Args));
|
||||
}
|
||||
|
||||
Args.AddLastArg(CmdArgs, options::OPT_fwrapv);
|
||||
// -fno-strict-overflow implies -fwrapv if it isn't disabled, but
|
||||
// -fstrict-overflow won't turn off an explicitly enabled -fwrapv.
|
||||
if (Arg *A = Args.getLastArg(options::OPT_fwrapv,
|
||||
options::OPT_fno_wrapv)) {
|
||||
if (A->getOption().matches(options::OPT_fwrapv))
|
||||
CmdArgs.push_back("-fwrapv");
|
||||
} else if (Arg *A = Args.getLastArg(options::OPT_fstrict_overflow,
|
||||
options::OPT_fno_strict_overflow)) {
|
||||
if (A->getOption().matches(options::OPT_fno_strict_overflow))
|
||||
CmdArgs.push_back("-fwrapv");
|
||||
}
|
||||
Args.AddLastArg(CmdArgs, options::OPT_fwritable_strings);
|
||||
Args.AddLastArg(CmdArgs, options::OPT_funroll_loops);
|
||||
|
||||
|
|
Loading…
Reference in New Issue