Skip to content

Commit db33f85

Browse files
[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
1 parent e881a25 commit db33f85

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

llvm/include/llvm/IR/ValueHandle.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -258,13 +258,13 @@ template <> struct simplify_type<const WeakTrackingVH> {
258258
/// class turns into a trivial wrapper around a pointer.
259259
template <typename ValueTy>
260260
class AssertingVH
261-
#ifndef NDEBUG
262-
: public ValueHandleBase
261+
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
262+
: public ValueHandleBase
263263
#endif
264-
{
264+
{
265265
friend struct DenseMapInfo<AssertingVH<ValueTy>>;
266266

267-
#ifndef NDEBUG
267+
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
268268
Value *getRawValPtr() const { return ValueHandleBase::getValPtr(); }
269269
void setRawValPtr(Value *P) { ValueHandleBase::operator=(P); }
270270
#else
@@ -280,7 +280,7 @@ class AssertingVH
280280
void setValPtr(ValueTy *P) { setRawValPtr(GetAsValue(P)); }
281281

282282
public:
283-
#ifndef NDEBUG
283+
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
284284
AssertingVH() : ValueHandleBase(Assert) {}
285285
AssertingVH(ValueTy *P) : ValueHandleBase(Assert, GetAsValue(P)) {}
286286
AssertingVH(const AssertingVH &RHS) : ValueHandleBase(Assert, RHS) {}
@@ -443,7 +443,7 @@ class CallbackVH : public ValueHandleBase {
443443
/// class turns into a trivial wrapper around a pointer.
444444
template <typename ValueTy>
445445
class PoisoningVH
446-
#ifndef NDEBUG
446+
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
447447
final : public CallbackVH
448448
#endif
449449
{
@@ -453,7 +453,7 @@ class PoisoningVH
453453
static Value *GetAsValue(Value *V) { return V; }
454454
static Value *GetAsValue(const Value *V) { return const_cast<Value *>(V); }
455455

456-
#ifndef NDEBUG
456+
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
457457
/// A flag tracking whether this value has been poisoned.
458458
///
459459
/// On delete and RAUW, we leave the value pointer alone so that as a raw
@@ -478,7 +478,7 @@ class PoisoningVH
478478
Poisoned = true;
479479
RemoveFromUseList();
480480
}
481-
#else // NDEBUG
481+
#else // LLVM_ENABLE_ABI_BREAKING_CHECKS
482482
Value *ThePtr = nullptr;
483483

484484
Value *getRawValPtr() const { return ThePtr; }
@@ -493,7 +493,7 @@ class PoisoningVH
493493

494494
public:
495495
PoisoningVH() = default;
496-
#ifndef NDEBUG
496+
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
497497
PoisoningVH(ValueTy *P) : CallbackVH(GetAsValue(P)) {}
498498
PoisoningVH(const PoisoningVH &RHS)
499499
: CallbackVH(RHS), Poisoned(RHS.Poisoned) {}

0 commit comments

Comments
 (0)