Author: Varun Gandhi Date: 2021-01-07T08:42:00-08:00 New Revision: db33f85c7124443e140d0118289fc141bab0c68d
URL: https://github.com/llvm/llvm-project/commit/db33f85c7124443e140d0118289fc141bab0c68d DIFF: https://github.com/llvm/llvm-project/commit/db33f85c7124443e140d0118289fc141bab0c68d.diff LOG: [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 Added: Modified: llvm/include/llvm/IR/ValueHandle.h Removed: ################################################################################ diff --git a/llvm/include/llvm/IR/ValueHandle.h b/llvm/include/llvm/IR/ValueHandle.h index badc1ca8d1f6..1324053800c7 100644 --- a/llvm/include/llvm/IR/ValueHandle.h +++ b/llvm/include/llvm/IR/ValueHandle.h @@ -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 - : public ValueHandleBase +#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 @@ class CallbackVH : public ValueHandleBase { /// 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) {} _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits