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.
|
/// class turns into a trivial wrapper around a pointer.
|
||||||
template <typename ValueTy>
|
template <typename ValueTy>
|
||||||
class AssertingVH
|
class AssertingVH
|
||||||
#ifndef NDEBUG
|
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
|
||||||
: public ValueHandleBase
|
: public ValueHandleBase
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
friend struct DenseMapInfo<AssertingVH<ValueTy>>;
|
friend struct DenseMapInfo<AssertingVH<ValueTy>>;
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
|
||||||
Value *getRawValPtr() const { return ValueHandleBase::getValPtr(); }
|
Value *getRawValPtr() const { return ValueHandleBase::getValPtr(); }
|
||||||
void setRawValPtr(Value *P) { ValueHandleBase::operator=(P); }
|
void setRawValPtr(Value *P) { ValueHandleBase::operator=(P); }
|
||||||
#else
|
#else
|
||||||
|
@ -280,7 +280,7 @@ class AssertingVH
|
||||||
void setValPtr(ValueTy *P) { setRawValPtr(GetAsValue(P)); }
|
void setValPtr(ValueTy *P) { setRawValPtr(GetAsValue(P)); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
#ifndef NDEBUG
|
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
|
||||||
AssertingVH() : ValueHandleBase(Assert) {}
|
AssertingVH() : ValueHandleBase(Assert) {}
|
||||||
AssertingVH(ValueTy *P) : ValueHandleBase(Assert, GetAsValue(P)) {}
|
AssertingVH(ValueTy *P) : ValueHandleBase(Assert, GetAsValue(P)) {}
|
||||||
AssertingVH(const AssertingVH &RHS) : ValueHandleBase(Assert, RHS) {}
|
AssertingVH(const AssertingVH &RHS) : ValueHandleBase(Assert, RHS) {}
|
||||||
|
@ -443,7 +443,7 @@ public:
|
||||||
/// class turns into a trivial wrapper around a pointer.
|
/// class turns into a trivial wrapper around a pointer.
|
||||||
template <typename ValueTy>
|
template <typename ValueTy>
|
||||||
class PoisoningVH
|
class PoisoningVH
|
||||||
#ifndef NDEBUG
|
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
|
||||||
final : public CallbackVH
|
final : public CallbackVH
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
@ -453,7 +453,7 @@ class PoisoningVH
|
||||||
static Value *GetAsValue(Value *V) { return V; }
|
static Value *GetAsValue(Value *V) { return V; }
|
||||||
static Value *GetAsValue(const Value *V) { return const_cast<Value *>(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.
|
/// A flag tracking whether this value has been poisoned.
|
||||||
///
|
///
|
||||||
/// On delete and RAUW, we leave the value pointer alone so that as a raw
|
/// On delete and RAUW, we leave the value pointer alone so that as a raw
|
||||||
|
@ -478,7 +478,7 @@ class PoisoningVH
|
||||||
Poisoned = true;
|
Poisoned = true;
|
||||||
RemoveFromUseList();
|
RemoveFromUseList();
|
||||||
}
|
}
|
||||||
#else // NDEBUG
|
#else // LLVM_ENABLE_ABI_BREAKING_CHECKS
|
||||||
Value *ThePtr = nullptr;
|
Value *ThePtr = nullptr;
|
||||||
|
|
||||||
Value *getRawValPtr() const { return ThePtr; }
|
Value *getRawValPtr() const { return ThePtr; }
|
||||||
|
@ -493,7 +493,7 @@ class PoisoningVH
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PoisoningVH() = default;
|
PoisoningVH() = default;
|
||||||
#ifndef NDEBUG
|
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
|
||||||
PoisoningVH(ValueTy *P) : CallbackVH(GetAsValue(P)) {}
|
PoisoningVH(ValueTy *P) : CallbackVH(GetAsValue(P)) {}
|
||||||
PoisoningVH(const PoisoningVH &RHS)
|
PoisoningVH(const PoisoningVH &RHS)
|
||||||
: CallbackVH(RHS), Poisoned(RHS.Poisoned) {}
|
: CallbackVH(RHS), Poisoned(RHS.Poisoned) {}
|
||||||
|
|
Loading…
Reference in New Issue