X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=unittests%2FBitcode%2FBitReaderTest.cpp;h=420aca2443bb420eeb9f690e0f3d351e0e03bdf9;hb=f11617b0abb665433a65f40882ceaefda7bd8322;hp=d9e207e9ba3b856e2e9d48fc2b54d36b57ffc660;hpb=f96e27f256cc922633b1ff8c13a61b3ff28ae7e1;p=oota-llvm.git diff --git a/unittests/Bitcode/BitReaderTest.cpp b/unittests/Bitcode/BitReaderTest.cpp index d9e207e9ba3..420aca2443b 100644 --- a/unittests/Bitcode/BitReaderTest.cpp +++ b/unittests/Bitcode/BitReaderTest.cpp @@ -118,10 +118,12 @@ TEST(BitReaderTest, TestForEofAfterReadFailureOnDataStreamer) { // Jump to two bytes before end of stream. Cursor.JumpToBit((InputSize - 4) * CHAR_BIT); // Try to read 4 bytes when only 2 are present, resulting in error value 0. - constexpr size_t ReadErrorValue = 0; + const size_t ReadErrorValue = 0; EXPECT_EQ(ReadErrorValue, Cursor.Read(32)); // Should be at eof now. EXPECT_TRUE(Cursor.AtEndOfStream()); + + delete[] Text; } TEST(BitReaderTest, MateralizeForwardRefWithStream) { @@ -138,30 +140,6 @@ TEST(BitReaderTest, MateralizeForwardRefWithStream) { EXPECT_FALSE(M->getFunction("func")->empty()); } -TEST(BitReaderTest, DematerializeFunctionPreservesLinkageType) { - SmallString<1024> Mem; - - LLVMContext Context; - std::unique_ptr M = getLazyModuleFromAssembly( - Context, Mem, "define internal i32 @func() {\n" - "ret i32 0\n" - "}\n"); - - EXPECT_FALSE(verifyModule(*M, &dbgs())); - - M->getFunction("func")->materialize(); - EXPECT_FALSE(M->getFunction("func")->empty()); - EXPECT_TRUE(M->getFunction("func")->getLinkage() == - GlobalValue::InternalLinkage); - - // Check that the linkage type is preserved after dematerialization. - M->getFunction("func")->dematerialize(); - EXPECT_TRUE(M->getFunction("func")->empty()); - EXPECT_TRUE(M->getFunction("func")->getLinkage() == - GlobalValue::InternalLinkage); - EXPECT_FALSE(verifyModule(*M, &dbgs())); -} - // Tests that lazy evaluation can parse functions out of order. TEST(BitReaderTest, MaterializeFunctionsOutOfOrder) { SmallString<1024> Mem; @@ -238,10 +216,6 @@ TEST(BitReaderTest, MaterializeFunctionsForBlockAddr) { // PR11677 " unreachable\n" "}\n"); EXPECT_FALSE(verifyModule(*M, &dbgs())); - - // Try (and fail) to dematerialize @func. - M->getFunction("func")->dematerialize(); - EXPECT_FALSE(M->getFunction("func")->empty()); } TEST(BitReaderTest, MaterializeFunctionsForBlockAddrInFunctionBefore) { @@ -269,11 +243,6 @@ TEST(BitReaderTest, MaterializeFunctionsForBlockAddrInFunctionBefore) { EXPECT_FALSE(M->getFunction("func")->empty()); EXPECT_TRUE(M->getFunction("other")->empty()); EXPECT_FALSE(verifyModule(*M, &dbgs())); - - // Try (and fail) to dematerialize @func. - M->getFunction("func")->dematerialize(); - EXPECT_FALSE(M->getFunction("func")->empty()); - EXPECT_FALSE(verifyModule(*M, &dbgs())); } TEST(BitReaderTest, MaterializeFunctionsForBlockAddrInFunctionAfter) { @@ -301,11 +270,6 @@ TEST(BitReaderTest, MaterializeFunctionsForBlockAddrInFunctionAfter) { EXPECT_FALSE(M->getFunction("func")->empty()); EXPECT_TRUE(M->getFunction("other")->empty()); EXPECT_FALSE(verifyModule(*M, &dbgs())); - - // Try (and fail) to dematerialize @func. - M->getFunction("func")->dematerialize(); - EXPECT_FALSE(M->getFunction("func")->empty()); - EXPECT_FALSE(verifyModule(*M, &dbgs())); } } // end namespace