[PATCH] Unify sanitizer kind representation between the driver and the rest of the compiler.No functional change.
Alexey Samsonov
vonosmas at gmail.com
Fri May 8 13:33:06 PDT 2015
================
Comment at: include/clang/Basic/Sanitizers.h:28
@@ +27,3 @@
+// bit positions.
+enum : uint64_t {
+#define SANITIZER(NAME, ID) SO_##ID,
----------------
Leave this named as SanitizerOrdinal, so that SO_ prefix makes sense.
================
Comment at: include/clang/Basic/Sanitizers.h:49
@@ -31,2 +48,3 @@
/// \brief Check if a certain sanitizer is enabled.
+ bool has(SanitizerMask K) const;
----------------
Fix comments to reflect that we're checking/setting sets of sanitizers now. However, I think we might still use two different entities for SanitizerKind and SanitizerMask....
================
Comment at: include/clang/Basic/Sanitizers.h:62
@@ -43,1 +61,3 @@
+ /// \brief Bitmask of enabled sanitizers.
+ SanitizerMask Mask;
};
----------------
Any reason to make this public?
================
Comment at: lib/CodeGen/CGExpr.cpp:2246
@@ -2245,3 +2245,3 @@
-static CheckRecoverableKind getRecoverableKind(SanitizerKind Kind) {
+static CheckRecoverableKind getRecoverableKind(SanitizerMask Kind) {
switch (Kind) {
----------------
That's the problem I see with using `SanitizerMask` instead of `SanitizerKind` class enum - sometimes (like in this case) we want to distinguish between a *single* sanitizer kind and a set of sanitizers. Here, for example, what should we return if Kind contains both Vptr and Return? Add a method that would tell you if SanitizerMask contains a single kind, and assert in this function?
================
Comment at: lib/CodeGen/CGExpr.cpp:2304
@@ -2303,3 +2303,3 @@
llvm::Value *&Cond =
CGM.getCodeGenOpts().SanitizeRecover.has(Checked[i].second)
? RecoverableCond
----------------
Same here - what if SanitizeRecover is defined for some bits in Checked[i].second, and not defined for another?
http://reviews.llvm.org/D9618
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the cfe-commits
mailing list