[PATCH] Unify clang/llvm attributes for asan/tsan/msan (LLVM part)

Chandler Carruth chandlerc at gmail.com
Fri Feb 22 05:29:09 PST 2013


  Assuming my final comment about bitcode encoding is correct, this looks good once the sorting comments below are addressed. Feel free to submit.

  If my final comment about bitcode encoding isn't correct, we'll need to dig into the encoding...


================
Comment at: include/llvm/IR/Attributes.h:66
@@ -65,3 +65,3 @@
     None,                  ///< No attributes have been set
-    AddressSafety,         ///< Address safety checking is on.
+    SanitizeAddress,       ///< AddressSanitizer is on.
     Alignment,             ///< Alignment of parameter (5 bits)
----------------
It seems a bit strange that these were ever sorted... I'm not sure how that could possibly work if the enum values are what is actually used in the bitcode.

Maybe the bitcode represents these things differently? I'm blanking on this, and would have to dig through the code.

================
Comment at: lib/AsmParser/LLLexer.cpp:565
@@ -564,3 +564,3 @@
 
-  KEYWORD(address_safety);
+  KEYWORD(sanitize_address);
   KEYWORD(alwaysinline);
----------------
These should definitely be sorted.

================
Comment at: lib/AsmParser/LLParser.cpp:910
@@ -909,3 +909,3 @@
     }
-    case lltok::kw_address_safety:  B.addAttribute(Attribute::AddressSafety); break;
+    case lltok::kw_sanitize_address: B.addAttribute(Attribute::SanitizeAddress); break;
     case lltok::kw_alwaysinline:    B.addAttribute(Attribute::AlwaysInline); break;
----------------
I would sort all of the switch cases as well, and pad everything out to line up...

================
Comment at: lib/IR/Attributes.cpp:389-394
@@ -388,8 +388,8 @@
   case Attribute::NonLazyBind:     return 1U << 31;
-  case Attribute::AddressSafety:   return 1ULL << 32;
+  case Attribute::SanitizeAddress: return 1ULL << 32;
   case Attribute::MinSize:         return 1ULL << 33;
   case Attribute::NoDuplicate:     return 1ULL << 34;
   case Attribute::StackProtectStrong: return 1ULL << 35;
-  case Attribute::ThreadSafety:    return 1ULL << 36;
-  case Attribute::UninitializedChecks: return 1ULL << 37;
+  case Attribute::SanitizeThread:  return 1ULL << 36;
+  case Attribute::SanitizeMemory:  return 1ULL << 37;
   case Attribute::NoBuiltin:       return 1ULL << 38;
----------------
Ahh, I suspect this is what actually defines the bitcode encoding. If so, then I would go and sort the other enum which shouldn't matter.


http://llvm-reviews.chandlerc.com/D450



More information about the llvm-commits mailing list