Unify clang/llvm attributes for asan/tsan/msan (LLVM part)
These are two related changes (one in llvm, one in clang).
LLVM:
- rename address_safety => sanitize_address (the enum value is the same, so we preserve binary compatibility with old bitcode)
- rename thread_safety => sanitize_thread
- rename no_uninitialized_checks -> sanitize_memory
CLANG:
- add __attribute__((no_sanitize_address)) as a synonym for __attribute__((no_address_safety_analysis))
- add __attribute__((no_sanitize_thread))
- add __attribute__((no_sanitize_memory))
for S in address thread memory
If -fsanitize=S is present and __attribute__((no_sanitize_S)) is not
set llvm attribute sanitize_S
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176075 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/IR/Attributes.cpp b/lib/IR/Attributes.cpp
index 11ed82d..6eb51f0 100644
--- a/lib/IR/Attributes.cpp
+++ b/lib/IR/Attributes.cpp
@@ -153,8 +153,8 @@
std::string Attribute::getAsString(bool InAttrGrp) const {
if (!pImpl) return "";
- if (hasAttribute(Attribute::AddressSafety))
- return "address_safety";
+ if (hasAttribute(Attribute::SanitizeAddress))
+ return "sanitize_address";
if (hasAttribute(Attribute::AlwaysInline))
return "alwaysinline";
if (hasAttribute(Attribute::ByVal))
@@ -207,10 +207,10 @@
return "sspstrong";
if (hasAttribute(Attribute::StructRet))
return "sret";
- if (hasAttribute(Attribute::ThreadSafety))
- return "thread_safety";
- if (hasAttribute(Attribute::UninitializedChecks))
- return "uninitialized_checks";
+ if (hasAttribute(Attribute::SanitizeThread))
+ return "sanitize_thread";
+ if (hasAttribute(Attribute::SanitizeMemory))
+ return "sanitize_memory";
if (hasAttribute(Attribute::UWTable))
return "uwtable";
if (hasAttribute(Attribute::ZExt))
@@ -386,12 +386,12 @@
case Attribute::ReturnsTwice: return 1 << 29;
case Attribute::UWTable: return 1 << 30;
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;
}
llvm_unreachable("Unsupported attribute type");
@@ -1119,9 +1119,9 @@
.removeAttribute(Attribute::UWTable)
.removeAttribute(Attribute::NonLazyBind)
.removeAttribute(Attribute::ReturnsTwice)
- .removeAttribute(Attribute::AddressSafety)
- .removeAttribute(Attribute::ThreadSafety)
- .removeAttribute(Attribute::UninitializedChecks)
+ .removeAttribute(Attribute::SanitizeAddress)
+ .removeAttribute(Attribute::SanitizeThread)
+ .removeAttribute(Attribute::SanitizeMemory)
.removeAttribute(Attribute::MinSize)
.removeAttribute(Attribute::NoDuplicate)
.removeAttribute(Attribute::NoBuiltin);
diff --git a/lib/IR/Verifier.cpp b/lib/IR/Verifier.cpp
index 33e8ec6..8bfbb32 100644
--- a/lib/IR/Verifier.cpp
+++ b/lib/IR/Verifier.cpp
@@ -650,9 +650,9 @@
!Attrs.hasAttribute(Idx, Attribute::UWTable) &&
!Attrs.hasAttribute(Idx, Attribute::NonLazyBind) &&
!Attrs.hasAttribute(Idx, Attribute::ReturnsTwice) &&
- !Attrs.hasAttribute(Idx, Attribute::AddressSafety) &&
- !Attrs.hasAttribute(Idx, Attribute::ThreadSafety) &&
- !Attrs.hasAttribute(Idx, Attribute::UninitializedChecks) &&
+ !Attrs.hasAttribute(Idx, Attribute::SanitizeAddress) &&
+ !Attrs.hasAttribute(Idx, Attribute::SanitizeThread) &&
+ !Attrs.hasAttribute(Idx, Attribute::SanitizeMemory) &&
!Attrs.hasAttribute(Idx, Attribute::MinSize) &&
!Attrs.hasAttribute(Idx, Attribute::NoBuiltin),
"Some attributes in '" + Attrs.getAsString(Idx) +