[PATCH] Unify sanitizer kind representation between the driver and the rest of the compiler.

Peter Collingbourne peter at pcc.me.uk
Mon May 11 14:42:55 PDT 2015


REPOSITORY
  rL LLVM

================
Comment at: lib/CodeGen/CGExpr.cpp:3391
@@ -3389,1 +3390,3 @@
+      EmitCheck(std::make_pair(CalleeRTTIMatch,
+                               SanitizerMask(SanitizerKind::Function)),
                 "function_type_mismatch", StaticData, Callee);
----------------
samsonov wrote:
> Looks like you don't need this cast (you don't have them in other places).
Removed

================
Comment at: lib/Driver/SanitizerArgs.cpp:113
@@ -161,5 +112,3 @@
 bool SanitizerArgs::needsUbsanRt() const {
-  return !UbsanTrapOnError && hasOneOf(Sanitizers, NeedsUbsanRt) &&
-         !Sanitizers.has(SanitizerKind::Address) &&
-         !Sanitizers.has(SanitizerKind::Memory) &&
-         !Sanitizers.has(SanitizerKind::Thread);
+  return !UbsanTrapOnError && Sanitizers.Mask & NeedsUbsanRt &&
+         !Sanitizers.has(Address) &&
----------------
samsonov wrote:
> Please add parens: (Sanitizers.Mask & NeedsUbsanRt)
Done

================
Comment at: lib/Driver/SanitizerArgs.cpp:120
@@ -168,3 +119,3 @@
 bool SanitizerArgs::requiresPIE() const {
-  return AsanZeroBaseShadow || hasOneOf(Sanitizers, RequiresPIE);
+  return AsanZeroBaseShadow || Sanitizers.Mask & RequiresPIE;
 }
----------------
samsonov wrote:
> ditto
Done

================
Comment at: lib/Driver/SanitizerArgs.cpp:147
@@ -195,3 +146,3 @@
   clear();
   uint64_t AllRemove = 0;  // During the loop below, the accumulated set of
                            // sanitizers disabled by the current sanitizer
----------------
samsonov wrote:
> Consider using `SanitizerMask` type for local variables where appropriate
Done

================
Comment at: lib/Driver/SanitizerArgs.cpp:444
@@ -492,3 +443,3 @@
   // affect compilation.
-  if (Sanitizers.has(SanitizerKind::Memory) ||
-      Sanitizers.has(SanitizerKind::Address))
+  if (Sanitizers.has(Memory) ||
+      Sanitizers.has(Address))
----------------
samsonov wrote:
> clang-format this patch
Done

http://reviews.llvm.org/D9618

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list