summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/DebugInfo/DWARF
diff options
context:
space:
mode:
authorPaul Robinson <paul.robinson@sony.com>2018-08-01 20:43:47 +0000
committerPaul Robinson <paul.robinson@sony.com>2018-08-01 20:43:47 +0000
commit143eaeab539b1f8cff3e4ea139aaf219ee117da6 (patch)
tree6146f25714f1f3395afa7c7f6f214cd8b90507d7 /llvm/unittests/DebugInfo/DWARF
parent624169f72e89b9f688a9ff4b74c357f6584ae185 (diff)
downloadbcm5719-llvm-143eaeab539b1f8cff3e4ea139aaf219ee117da6.tar.gz
bcm5719-llvm-143eaeab539b1f8cff3e4ea139aaf219ee117da6.zip
[DebugInfo/DWARF] [1/4] De-templatize DWARFUnitSection. NFC
This is patch 1 of 4 NFC refactorings to handle type units and compile units more consistently and with less concern about the object-file section that they came from. Patch 1 replaces the templated DWARFUnitSection with a non-templated version. That is, instead of being a SmallVector of pointers to a specific unit kind, it is not a SmallVector of pointers to the base class for both type and compile units. Virtual methods are magic. Differential Revision: https://reviews.llvm.org/D49741 llvm-svn: 338628
Diffstat (limited to 'llvm/unittests/DebugInfo/DWARF')
-rw-r--r--llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp36
-rw-r--r--llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp4
2 files changed, 26 insertions, 14 deletions
diff --git a/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
index 273809fcbd3..0d299c9d840 100644
--- a/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
+++ b/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
@@ -231,7 +231,8 @@ void TestAllForms() {
std::unique_ptr<DWARFContext> DwarfContext = DWARFContext::create(**Obj);
uint32_t NumCUs = DwarfContext->getNumCompileUnits();
EXPECT_EQ(NumCUs, 1u);
- DWARFCompileUnit *U = DwarfContext->getCompileUnitAtIndex(0);
+ DWARFCompileUnit *U =
+ cast<DWARFCompileUnit>(DwarfContext->getUnitAtIndex(0));
auto DieDG = U->getUnitDIE(false);
EXPECT_TRUE(DieDG.isValid());
@@ -496,7 +497,8 @@ template <uint16_t Version, class AddrType> void TestChildren() {
// Verify the number of compile units is correct.
uint32_t NumCUs = DwarfContext->getNumCompileUnits();
EXPECT_EQ(NumCUs, 1u);
- DWARFCompileUnit *U = DwarfContext->getCompileUnitAtIndex(0);
+ DWARFCompileUnit *U =
+ cast<DWARFCompileUnit>(DwarfContext->getUnitAtIndex(0));
// Get the compile unit DIE is valid.
auto DieDG = U->getUnitDIE(false);
@@ -672,8 +674,10 @@ template <uint16_t Version, class AddrType> void TestReferences() {
// Verify the number of compile units is correct.
uint32_t NumCUs = DwarfContext->getNumCompileUnits();
EXPECT_EQ(NumCUs, 2u);
- DWARFCompileUnit *U1 = DwarfContext->getCompileUnitAtIndex(0);
- DWARFCompileUnit *U2 = DwarfContext->getCompileUnitAtIndex(1);
+ DWARFCompileUnit *U1 =
+ cast<DWARFCompileUnit>(DwarfContext->getUnitAtIndex(0));
+ DWARFCompileUnit *U2 =
+ cast<DWARFCompileUnit>(DwarfContext->getUnitAtIndex(1));
// Get the compile unit DIE is valid.
auto Unit1DieDG = U1->getUnitDIE(false);
@@ -880,7 +884,8 @@ template <uint16_t Version, class AddrType> void TestAddresses() {
// Verify the number of compile units is correct.
uint32_t NumCUs = DwarfContext->getNumCompileUnits();
EXPECT_EQ(NumCUs, 1u);
- DWARFCompileUnit *U = DwarfContext->getCompileUnitAtIndex(0);
+ DWARFCompileUnit *U =
+ cast<DWARFCompileUnit>(DwarfContext->getUnitAtIndex(0));
// Get the compile unit DIE is valid.
auto DieDG = U->getUnitDIE(false);
@@ -1055,7 +1060,8 @@ TEST(DWARFDebugInfo, TestRelations) {
// Verify the number of compile units is correct.
uint32_t NumCUs = DwarfContext->getNumCompileUnits();
EXPECT_EQ(NumCUs, 1u);
- DWARFCompileUnit *U = DwarfContext->getCompileUnitAtIndex(0);
+ DWARFCompileUnit *U =
+ cast<DWARFCompileUnit>(DwarfContext->getUnitAtIndex(0));
// Get the compile unit DIE is valid.
auto CUDie = U->getUnitDIE(false);
@@ -1222,7 +1228,8 @@ TEST(DWARFDebugInfo, TestChildIterators) {
// Verify the number of compile units is correct.
uint32_t NumCUs = DwarfContext->getNumCompileUnits();
EXPECT_EQ(NumCUs, 1u);
- DWARFCompileUnit *U = DwarfContext->getCompileUnitAtIndex(0);
+ DWARFCompileUnit *U =
+ cast<DWARFCompileUnit>(DwarfContext->getUnitAtIndex(0));
// Get the compile unit DIE is valid.
auto CUDie = U->getUnitDIE(false);
@@ -1284,7 +1291,8 @@ TEST(DWARFDebugInfo, TestEmptyChildren) {
// Verify the number of compile units is correct.
uint32_t NumCUs = DwarfContext->getNumCompileUnits();
EXPECT_EQ(NumCUs, 1u);
- DWARFCompileUnit *U = DwarfContext->getCompileUnitAtIndex(0);
+ DWARFCompileUnit *U =
+ cast<DWARFCompileUnit>(DwarfContext->getUnitAtIndex(0));
// Get the compile unit DIE is valid.
auto CUDie = U->getUnitDIE(false);
@@ -1331,7 +1339,8 @@ TEST(DWARFDebugInfo, TestAttributeIterators) {
// Verify the number of compile units is correct.
uint32_t NumCUs = DwarfContext->getNumCompileUnits();
EXPECT_EQ(NumCUs, 1u);
- DWARFCompileUnit *U = DwarfContext->getCompileUnitAtIndex(0);
+ DWARFCompileUnit *U =
+ cast<DWARFCompileUnit>(DwarfContext->getUnitAtIndex(0));
// Get the compile unit DIE is valid.
auto CUDie = U->getUnitDIE(false);
@@ -1399,7 +1408,8 @@ TEST(DWARFDebugInfo, TestFindRecurse) {
// Verify the number of compile units is correct.
uint32_t NumCUs = DwarfContext->getNumCompileUnits();
EXPECT_EQ(NumCUs, 1u);
- DWARFCompileUnit *U = DwarfContext->getCompileUnitAtIndex(0);
+ DWARFCompileUnit *U =
+ cast<DWARFCompileUnit>(DwarfContext->getUnitAtIndex(0));
// Get the compile unit DIE is valid.
auto CUDie = U->getUnitDIE(false);
@@ -1606,7 +1616,8 @@ TEST(DWARFDebugInfo, TestFindAttrs) {
// Verify the number of compile units is correct.
uint32_t NumCUs = DwarfContext->getNumCompileUnits();
EXPECT_EQ(NumCUs, 1u);
- DWARFCompileUnit *U = DwarfContext->getCompileUnitAtIndex(0);
+ DWARFCompileUnit *U =
+ cast<DWARFCompileUnit>(DwarfContext->getUnitAtIndex(0));
// Get the compile unit DIE is valid.
auto CUDie = U->getUnitDIE(false);
@@ -1665,7 +1676,8 @@ TEST(DWARFDebugInfo, TestImplicitConstAbbrevs) {
auto Obj = object::ObjectFile::createObjectFile(FileBuffer);
EXPECT_TRUE((bool)Obj);
std::unique_ptr<DWARFContext> DwarfContext = DWARFContext::create(**Obj);
- DWARFCompileUnit *U = DwarfContext->getCompileUnitAtIndex(0);
+ DWARFCompileUnit *U =
+ cast<DWARFCompileUnit>(DwarfContext->getUnitAtIndex(0));
EXPECT_TRUE((bool)U);
const auto *Abbrevs = U->getAbbreviations();
diff --git a/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
index 99ed118e539..ad6b1ea84ce 100644
--- a/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
+++ b/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
@@ -129,8 +129,8 @@ struct CommonFixture {
Error Unrecoverable;
std::function<void(Error)> RecordUnrecoverable;
- SmallVector<std::unique_ptr<DWARFCompileUnit>, 2> CUs;
- std::deque<DWARFUnitSection<DWARFTypeUnit>> TUs;
+ SmallVector<std::unique_ptr<DWARFUnit>, 2> CUs;
+ std::deque<DWARFUnitSection> TUs;
};
// Fixtures must derive from "Test", but parameterised fixtures from
OpenPOWER on IntegriCloud