forked from OSchip/llvm-project
[IR] Use LLVM_ENABLE_ABI_BREAKING_CHECKS to guard ABI changes.
Incorrect usage of NDEBUG to guard ABI changes can prevent clients from enabling assertions for their C++ code while having assertions in LLVM turned off. So we use LLVM_ENABLE_ABI_BREAKING_CHECKS instead, as described in llvm/docs/ProgrammersManual.rst. Most types already use this macro, however, there were a couple of stragglers in ValueHandle.h, which are fixed by this revision. Reviewed By: dblaikie, dexonsmith Differential Revision: https://reviews.llvm.org/D93433
This commit is contained in:
parent
e881a25f1e
commit
db33f85c71
|
@ -258,13 +258,13 @@ template <> struct simplify_type<const WeakTrackingVH> {
|
|||
/// class turns into a trivial wrapper around a pointer.
|
||||
template <typename ValueTy>
|
||||
class AssertingVH
|
||||
#ifndef NDEBUG
|
||||
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
|
||||
: public ValueHandleBase
|
||||
#endif
|
||||
{
|
||||
{
|
||||
friend struct DenseMapInfo<AssertingVH<ValueTy>>;
|
||||
|
||||
#ifndef NDEBUG
|
||||
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
|
||||
Value *getRawValPtr() const { return ValueHandleBase::getValPtr(); }
|
||||
void setRawValPtr(Value *P) { ValueHandleBase::operator=(P); }
|
||||
#else
|
||||
|
@ -280,7 +280,7 @@ class AssertingVH
|
|||
void setValPtr(ValueTy *P) { setRawValPtr(GetAsValue(P)); }
|
||||
|
||||
public:
|
||||
#ifndef NDEBUG
|
||||
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
|
||||
AssertingVH() : ValueHandleBase(Assert) {}
|
||||
AssertingVH(ValueTy *P) : ValueHandleBase(Assert, GetAsValue(P)) {}
|
||||
AssertingVH(const AssertingVH &RHS) : ValueHandleBase(Assert, RHS) {}
|
||||
|
@ -443,7 +443,7 @@ public:
|
|||
/// class turns into a trivial wrapper around a pointer.
|
||||
template <typename ValueTy>
|
||||
class PoisoningVH
|
||||
#ifndef NDEBUG
|
||||
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
|
||||
final : public CallbackVH
|
||||
#endif
|
||||
{
|
||||
|
@ -453,7 +453,7 @@ class PoisoningVH
|
|||
static Value *GetAsValue(Value *V) { return V; }
|
||||
static Value *GetAsValue(const Value *V) { return const_cast<Value *>(V); }
|
||||
|
||||
#ifndef NDEBUG
|
||||
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
|
||||
/// A flag tracking whether this value has been poisoned.
|
||||
///
|
||||
/// On delete and RAUW, we leave the value pointer alone so that as a raw
|
||||
|
@ -478,7 +478,7 @@ class PoisoningVH
|
|||
Poisoned = true;
|
||||
RemoveFromUseList();
|
||||
}
|
||||
#else // NDEBUG
|
||||
#else // LLVM_ENABLE_ABI_BREAKING_CHECKS
|
||||
Value *ThePtr = nullptr;
|
||||
|
||||
Value *getRawValPtr() const { return ThePtr; }
|
||||
|
@ -493,7 +493,7 @@ class PoisoningVH
|
|||
|
||||
public:
|
||||
PoisoningVH() = default;
|
||||
#ifndef NDEBUG
|
||||
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
|
||||
PoisoningVH(ValueTy *P) : CallbackVH(GetAsValue(P)) {}
|
||||
PoisoningVH(const PoisoningVH &RHS)
|
||||
: CallbackVH(RHS), Poisoned(RHS.Poisoned) {}
|
||||
|
|
Loading…
Reference in New Issue