From 6d236cf44b65514335f6967aa52416dbd8a2b354 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Thu, 7 Jan 2021 14:17:24 -0800 Subject: [PATCH] Fixup Asserts+!AbiBreakingChecks fallout from db33f85c7124 --- include/llvm/IR/ValueHandle.h | 2 ++ unittests/IR/ValueHandleTest.cpp | 5 ++++- unittests/Support/DataExtractorTest.cpp | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/llvm/IR/ValueHandle.h b/include/llvm/IR/ValueHandle.h index 1324053800c..a88b28ac7e6 100644 --- a/include/llvm/IR/ValueHandle.h +++ b/include/llvm/IR/ValueHandle.h @@ -486,7 +486,9 @@ class PoisoningVH #endif ValueTy *getValPtr() const { +#if LLVM_ENABLE_ABI_BREAKING_CHECKS assert(!Poisoned && "Accessed a poisoned value handle!"); +#endif return static_cast(getRawValPtr()); } void setValPtr(ValueTy *P) { setRawValPtr(GetAsValue(P)); } diff --git a/unittests/IR/ValueHandleTest.cpp b/unittests/IR/ValueHandleTest.cpp index 1aed8e1a1ee..8eb6b5f89a4 100644 --- a/unittests/IR/ValueHandleTest.cpp +++ b/unittests/IR/ValueHandleTest.cpp @@ -186,7 +186,7 @@ TEST_F(ValueHandle, AssertingVH_ReducesToPointer) { EXPECT_EQ(sizeof(CastInst *), sizeof(AssertingVH)); } -#else // !NDEBUG +#elif LLVM_ENABLE_ABI_BREAKING_CHECKS // && !NDEBUG #ifdef GTEST_HAS_DEATH_TEST @@ -530,6 +530,7 @@ TEST_F(ValueHandle, TrackingVH_Tracks) { } #ifdef GTEST_HAS_DEATH_TEST +#if LLVM_ENABLE_ABI_BREAKING_CHECKS TEST_F(ValueHandle, PoisoningVH_Asserts) { PoisoningVH VH(BitcastV.get()); @@ -549,6 +550,8 @@ TEST_F(ValueHandle, PoisoningVH_Asserts) { // Don't clear anything out here as destroying the handles should be fine. } +#endif // LLVM_ENABLE_ABI_BREAKING_CHECKS + TEST_F(ValueHandle, TrackingVH_Asserts) { { TrackingVH VH(BitcastV.get()); diff --git a/unittests/Support/DataExtractorTest.cpp b/unittests/Support/DataExtractorTest.cpp index 278e5885916..41c40648b85 100644 --- a/unittests/Support/DataExtractorTest.cpp +++ b/unittests/Support/DataExtractorTest.cpp @@ -214,7 +214,8 @@ TEST(DataExtractorTest, Cursor_chaining) { EXPECT_THAT_ERROR(C.takeError(), Succeeded()); } -#if defined(GTEST_HAS_DEATH_TEST) && defined(_DEBUG) +#if defined(GTEST_HAS_DEATH_TEST) && defined(_DEBUG) && \ + LLVM_ENABLE_ABI_BREAKING_CHECKS TEST(DataExtractorDeathTest, Cursor) { DataExtractor DE(StringRef("AB"), false, 8);