[PATCH] Introduce -fsanitize-trap= flag.
Peter Collingbourne
peter at pcc.me.uk
Thu Jun 18 17:04:24 PDT 2015
================
Comment at: lib/Driver/SanitizerArgs.cpp:147
@@ +146,3 @@
+ Add &= ~TrapRemove;
+ if ((Add & ~TrappingSupportedWithGroups) != 0) {
+ SanitizerSet S;
----------------
samsonov wrote:
> if (SanitizerMask InvalidValues = Add & ~TrappingSupportedWithGroups) {
> SanitizerSet S;
> S.Mask = InvalidValues;
> //....
> }
Done
================
Comment at: lib/Driver/SanitizerArgs.cpp:165
@@ +164,3 @@
+ Arg->claim();
+ TrapRemove |= Undefined | UndefinedGroup;
+ }
----------------
samsonov wrote:
> TrapRemove |= expandSanitizerGroups(UndefinedGroup);
Done
================
Comment at: lib/Driver/SanitizerArgs.cpp:239
@@ +238,3 @@
+ SanitizerMask KindsToDiagnose = Add & NotSupported & ~DiagnosedKinds;
+ if (KindsToDiagnose & Vptr) {
+ D.Diag(diag::err_drv_argument_not_allowed_with)
----------------
samsonov wrote:
> I don't think this is right. Suppose `-fsanitize=vptr` is not supported on target foo (by corresponding toolchain). Then
> clang -target foo -fsanitize=vptr a.cc
> would produce confusing
> "-fsanitize=vptr" is not allowed with "-fsanitize-trap=undefined"
>
> I think you would need separate clause for that
> if (SanitizerMask KindsToDiagnose = Add & TrappingKinds & NotAllowedWithTrap & ~DiagnosedKinds) {
> std::string Desc = describeSanitizeArg(*I, KindsToDiagnose);
> D.Diag(diag::err_drv_argument_not_allowed_with) << Desc << lastTrapArgumentForMask(KindsToDiagnose);
> DiagnosedKinds |= KindsToDiagnose;
> }
Done. (We know that the second argument to the diagnostic can only ever be `"-fsanitize-trap=undefined"`, so I've hard coded that for now.)
http://reviews.llvm.org/D10464
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the cfe-commits
mailing list