diff --git a/llvm/include/llvm/IR/ValueHandle.h b/llvm/include/llvm/IR/ValueHandle.h --- a/llvm/include/llvm/IR/ValueHandle.h +++ b/llvm/include/llvm/IR/ValueHandle.h @@ -258,13 +258,13 @@ /// class turns into a trivial wrapper around a pointer. template class AssertingVH -#ifndef NDEBUG - : public ValueHandleBase +#if LLVM_ENABLE_ABI_BREAKING_CHECKS + : public ValueHandleBase #endif - { +{ friend struct DenseMapInfo>; -#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 @@ 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 @@ /// class turns into a trivial wrapper around a pointer. template class PoisoningVH -#ifndef NDEBUG +#if LLVM_ENABLE_ABI_BREAKING_CHECKS final : public CallbackVH #endif { @@ -453,7 +453,7 @@ static Value *GetAsValue(Value *V) { return V; } static Value *GetAsValue(const Value *V) { return const_cast(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 @@ Poisoned = true; RemoveFromUseList(); } -#else // NDEBUG +#else // LLVM_ENABLE_ABI_BREAKING_CHECKS Value *ThePtr = nullptr; Value *getRawValPtr() const { return ThePtr; } @@ -493,7 +493,7 @@ 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) {}