Index: include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h =================================================================== --- include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h +++ include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h @@ -453,10 +453,6 @@ Expected getEntry(uint64_t *Offset) const; - // A temporarily method to preserve compatibility with existing code. - // Will be removed when the migration to 64-bit offsets is finished. - Expected getEntry(uint32_t *Offset) const; - /// Look up all entries in this Name Index matching \c Key. iterator_range equal_range(StringRef Key) const; Index: include/llvm/DebugInfo/DWARF/DWARFFormValue.h =================================================================== --- include/llvm/DebugInfo/DWARF/DWARFFormValue.h +++ include/llvm/DebugInfo/DWARF/DWARFFormValue.h @@ -147,28 +147,6 @@ uint64_t *OffsetPtr, const dwarf::FormParams FormParams); - // The following methods are temporarily kept in order to preserve - // compatibility with existing code and migrate to 64-bit offsets smoothly. - // They will be removed when the migration is finished. - // Please do not use them in new code. - static DWARFFormValue createFromUnit(dwarf::Form F, const DWARFUnit *Unit, - uint32_t *OffsetPtr); - bool extractValue(const DWARFDataExtractor &Data, uint32_t *OffsetPtr, - dwarf::FormParams FormParams, - const DWARFContext *Context = nullptr, - const DWARFUnit *Unit = nullptr); - bool extractValue(const DWARFDataExtractor &Data, uint32_t *OffsetPtr, - dwarf::FormParams FormParams, const DWARFUnit *U) { - return extractValue(Data, OffsetPtr, FormParams, nullptr, U); - } - bool skipValue(DataExtractor DebugInfoData, uint32_t *OffsetPtr, - const dwarf::FormParams Params) const { - return DWARFFormValue::skipValue(Form, DebugInfoData, OffsetPtr, Params); - } - static bool skipValue(dwarf::Form Form, DataExtractor DebugInfoData, - uint32_t *OffsetPtr, - const dwarf::FormParams FormParams); - private: void dumpString(raw_ostream &OS) const; }; Index: include/llvm/Support/DataExtractor.h =================================================================== --- include/llvm/Support/DataExtractor.h +++ include/llvm/Support/DataExtractor.h @@ -420,29 +420,6 @@ bool isValidOffsetForAddress(uint64_t offset) const { return isValidOffsetForDataOfSize(offset, AddressSize); } - - // The following methods are temporarily kept in order to preserve - // compatibility with existing code and migrate to 64-bit offsets smoothly. - // They will be removed when the migration is finished. - // Please do not use them in new code. - const char *getCStr(uint32_t *offset_ptr) const; - StringRef getCStrRef(uint32_t *offset_ptr) const; - uint64_t getUnsigned(uint32_t *offset_ptr, uint32_t byte_size) const; - int64_t getSigned(uint32_t *offset_ptr, uint32_t size) const; - uint64_t getAddress(uint32_t *offset_ptr) const { - return getUnsigned(offset_ptr, AddressSize); - } - uint8_t getU8(uint32_t *offset_ptr) const; - uint8_t *getU8(uint32_t *offset_ptr, uint8_t *dst, uint32_t count) const; - uint16_t getU16(uint32_t *offset_ptr) const; - uint16_t *getU16(uint32_t *offset_ptr, uint16_t *dst, uint32_t count) const; - uint32_t getU24(uint32_t *offset_ptr) const; - uint32_t getU32(uint32_t *offset_ptr) const; - uint32_t *getU32(uint32_t *offset_ptr, uint32_t *dst, uint32_t count) const; - uint64_t getU64(uint32_t *offset_ptr) const; - uint64_t *getU64(uint32_t *offset_ptr, uint64_t *dst, uint32_t count) const; - int64_t getSLEB128(uint32_t *offset_ptr) const; - uint64_t getULEB128(uint32_t *offset_ptr) const; }; } // namespace llvm Index: lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp =================================================================== --- lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp +++ lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp @@ -622,16 +622,6 @@ return std::move(E); } -// A temporarily method to preserve compatibility with existing code. -// Will be removed when the migration to 64-bit offsets is finished. -Expected -DWARFDebugNames::NameIndex::getEntry(uint32_t *Offset) const { - uint64_t Offset64 = *Offset; - auto Result = getEntry(&Offset64); - *Offset = Offset64; - return std::move(Result); -} - DWARFDebugNames::NameTableEntry DWARFDebugNames::NameIndex::getNameTableEntry(uint32_t Index) const { assert(0 < Index && Index <= Hdr.NameCount); Index: lib/DebugInfo/DWARF/DWARFFormValue.cpp =================================================================== --- lib/DebugInfo/DWARF/DWARFFormValue.cpp +++ lib/DebugInfo/DWARF/DWARFFormValue.cpp @@ -718,40 +718,3 @@ return None; return Value.uval; } - -// The following is temporary code aimed to preserve compatibility with -// existing code which uses 32-bit offsets. -// It will be removed when migration to 64-bit offsets is finished. - -namespace { - -class WrapOffset { - uint64_t Offset64; - uint32_t *Offset32; - -public: - WrapOffset(uint32_t *Offset) - : Offset64(*Offset), Offset32(Offset) {} - ~WrapOffset() { *Offset32 = Offset64; } - operator uint64_t *() { return &Offset64; } -}; - -} - -DWARFFormValue DWARFFormValue::createFromUnit(dwarf::Form F, const DWARFUnit *U, - uint32_t *OffsetPtr) { - return createFromUnit(F, U, WrapOffset(OffsetPtr)); -} - -bool DWARFFormValue::skipValue(dwarf::Form Form, DataExtractor DebugInfoData, - uint32_t *OffsetPtr, - const dwarf::FormParams Params) { - return skipValue(Form, DebugInfoData, WrapOffset(OffsetPtr), Params); -} - -bool DWARFFormValue::extractValue(const DWARFDataExtractor &Data, - uint32_t *OffsetPtr, dwarf::FormParams FP, - const DWARFContext *Ctx, - const DWARFUnit *CU) { - return extractValue(Data, WrapOffset(OffsetPtr), FP, Ctx, CU); -} Index: lib/Support/DataExtractor.cpp =================================================================== --- lib/Support/DataExtractor.cpp +++ lib/Support/DataExtractor.cpp @@ -171,88 +171,3 @@ *offset_ptr += bytes_read; return result; } - -// The following is temporary code aimed to preserve compatibility with -// existing code which uses 32-bit offsets. -// It will be removed when migration to 64-bit offsets is finished. - -namespace { - -class WrapOffset { - uint64_t offset64; - uint32_t *offset32_ptr; - -public: - WrapOffset(uint32_t *offset_ptr) - : offset64(*offset_ptr), offset32_ptr(offset_ptr) {} - ~WrapOffset() { *offset32_ptr = offset64; } - operator uint64_t *() { return &offset64; } -}; - -} - -uint8_t DataExtractor::getU8(uint32_t *offset_ptr) const { - return getU8(WrapOffset(offset_ptr)); -} - -uint8_t * -DataExtractor::getU8(uint32_t *offset_ptr, uint8_t *dst, uint32_t count) const { - return getU8(WrapOffset(offset_ptr), dst, count); -} - -uint16_t DataExtractor::getU16(uint32_t *offset_ptr) const { - return getU16(WrapOffset(offset_ptr)); -} - -uint16_t *DataExtractor::getU16(uint32_t *offset_ptr, uint16_t *dst, - uint32_t count) const { - return getU16(WrapOffset(offset_ptr), dst, count); -} - -uint32_t DataExtractor::getU24(uint32_t *offset_ptr) const { - return getU24(WrapOffset(offset_ptr)); -} - -uint32_t DataExtractor::getU32(uint32_t *offset_ptr) const { - return getU32(WrapOffset(offset_ptr)); -} - -uint32_t *DataExtractor::getU32(uint32_t *offset_ptr, uint32_t *dst, - uint32_t count) const { - return getU32(WrapOffset(offset_ptr), dst, count); -} - -uint64_t DataExtractor::getU64(uint32_t *offset_ptr) const { - return getU64(WrapOffset(offset_ptr)); -} - -uint64_t *DataExtractor::getU64(uint32_t *offset_ptr, uint64_t *dst, - uint32_t count) const { - return getU64(WrapOffset(offset_ptr), dst, count); -} - -uint64_t -DataExtractor::getUnsigned(uint32_t *offset_ptr, uint32_t byte_size) const { - return getUnsigned(WrapOffset(offset_ptr), byte_size); -} - -int64_t -DataExtractor::getSigned(uint32_t *offset_ptr, uint32_t byte_size) const { - return getSigned(WrapOffset(offset_ptr), byte_size); -} - -const char *DataExtractor::getCStr(uint32_t *offset_ptr) const { - return getCStr(WrapOffset(offset_ptr)); -} - -StringRef DataExtractor::getCStrRef(uint32_t *offset_ptr) const { - return getCStrRef(WrapOffset(offset_ptr)); -} - -uint64_t DataExtractor::getULEB128(uint32_t *offset_ptr) const { - return getULEB128(WrapOffset(offset_ptr)); -} - -int64_t DataExtractor::getSLEB128(uint32_t *offset_ptr) const { - return getSLEB128(WrapOffset(offset_ptr)); -} Index: unittests/Support/DataExtractorTest.cpp =================================================================== --- unittests/Support/DataExtractorTest.cpp +++ unittests/Support/DataExtractorTest.cpp @@ -12,27 +12,19 @@ namespace { -// Test fixture -template -class DataExtractorTest : public ::testing::Test { }; - -// Test DataExtractor with both types which can be used for offsets. -typedef ::testing::Types TestTypes; -TYPED_TEST_CASE(DataExtractorTest, TestTypes); - const char numberData[] = "\x80\x90\xFF\xFF\x80\x00\x00\x00"; const char stringData[] = "hellohello\0hello"; const char leb128data[] = "\xA6\x49"; const char bigleb128data[] = "\xAA\xA9\xFF\xAA\xFF\xAA\xFF\x4A"; -TYPED_TEST(DataExtractorTest, OffsetOverflow) { +TEST(DataExtractorTest, OffsetOverflow) { DataExtractor DE(StringRef(numberData, sizeof(numberData)-1), false, 8); EXPECT_FALSE(DE.isValidOffsetForDataOfSize(-2U, 5)); } -TYPED_TEST(DataExtractorTest, UnsignedNumbers) { +TEST(DataExtractorTest, UnsignedNumbers) { DataExtractor DE(StringRef(numberData, sizeof(numberData)-1), false, 8); - TypeParam offset = 0; + uint64_t offset = 0; EXPECT_EQ(0x80U, DE.getU8(&offset)); EXPECT_EQ(1U, offset); @@ -78,9 +70,9 @@ EXPECT_EQ(8U, offset); } -TYPED_TEST(DataExtractorTest, SignedNumbers) { +TEST(DataExtractorTest, SignedNumbers) { DataExtractor DE(StringRef(numberData, sizeof(numberData)-1), false, 8); - TypeParam offset = 0; + uint64_t offset = 0; EXPECT_EQ(-128, DE.getSigned(&offset, 1)); EXPECT_EQ(1U, offset); @@ -95,9 +87,9 @@ EXPECT_EQ(8U, offset); } -TYPED_TEST(DataExtractorTest, Strings) { +TEST(DataExtractorTest, Strings) { DataExtractor DE(StringRef(stringData, sizeof(stringData)-1), false, 8); - TypeParam offset = 0; + uint64_t offset = 0; EXPECT_EQ(stringData, DE.getCStr(&offset)); EXPECT_EQ(11U, offset); @@ -105,9 +97,9 @@ EXPECT_EQ(11U, offset); } -TYPED_TEST(DataExtractorTest, LEB128) { +TEST(DataExtractorTest, LEB128) { DataExtractor DE(StringRef(leb128data, sizeof(leb128data)-1), false, 8); - TypeParam offset = 0; + uint64_t offset = 0; EXPECT_EQ(9382ULL, DE.getULEB128(&offset)); EXPECT_EQ(2U, offset); @@ -124,9 +116,9 @@ EXPECT_EQ(8U, offset); } -TYPED_TEST(DataExtractorTest, LEB128_error) { +TEST(DataExtractorTest, LEB128_error) { DataExtractor DE(StringRef("\x81"), false, 8); - TypeParam Offset = 0; + uint64_t Offset = 0; EXPECT_EQ(0U, DE.getULEB128(&Offset)); EXPECT_EQ(0U, Offset);