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

Alexey Samsonov vonosmas at gmail.com
Fri May 8 15:42:28 PDT 2015


Thanks for doing this! Feel free to apply after addressing comments below.


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

================
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) &&
----------------
Please add parens: (Sanitizers.Mask & NeedsUbsanRt)

================
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;
 }
----------------
ditto

================
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
----------------
Consider using `SanitizerMask` type for local variables where appropriate

================
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))
----------------
clang-format this patch

http://reviews.llvm.org/D9618

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






More information about the cfe-commits mailing list