From f630ebefa0a4b75e95105af87f1b9bd75c7ff14d Mon Sep 17 00:00:00 2001 From: Fabian Schiebel Date: Sun, 21 Apr 2024 13:15:26 +0200 Subject: [PATCH] Fix vtable + transitive di th tests --- .../DIBasedTypeHierarchyTest.cpp | 130 +++++++++--------- 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/unittests/PhasarLLVM/TypeHierarchy/DIBasedTypeHierarchyTest.cpp b/unittests/PhasarLLVM/TypeHierarchy/DIBasedTypeHierarchyTest.cpp index 3205863a3..01f677363 100644 --- a/unittests/PhasarLLVM/TypeHierarchy/DIBasedTypeHierarchyTest.cpp +++ b/unittests/PhasarLLVM/TypeHierarchy/DIBasedTypeHierarchyTest.cpp @@ -819,19 +819,19 @@ TEST(DBTHTest, VTableConstruction_7) { DIBasedTypeHierarchy DBTH(IRDB); // check for all types - const auto &AType = DBTH.getType("A"); + const auto &AType = DBTH.getType("_ZTS1A"); ASSERT_NE(nullptr, AType); - const auto &BType = DBTH.getType("B"); + const auto &BType = DBTH.getType("_ZTS1B"); ASSERT_NE(nullptr, BType); - const auto &CType = DBTH.getType("C"); + const auto &CType = DBTH.getType("_ZTS1C"); ASSERT_NE(nullptr, CType); - const auto &DType = DBTH.getType("D"); + const auto &DType = DBTH.getType("_ZTS1D"); ASSERT_NE(nullptr, DType); - const auto &XType = DBTH.getType("X"); + const auto &XType = DBTH.getType("_ZTS1X"); ASSERT_NE(nullptr, XType); - const auto &YType = DBTH.getType("Y"); + const auto &YType = DBTH.getType("_ZTS1Y"); ASSERT_NE(nullptr, YType); - const auto &ZType = DBTH.getType("Z"); + const auto &ZType = DBTH.getType("_ZTS1Z"); ASSERT_NE(nullptr, ZType); const auto &VTableForAType = DBTH.getVFTable(AType); @@ -865,13 +865,13 @@ TEST(DBTHTest, VTableConstruction_7_b) { DIBasedTypeHierarchy DBTH(IRDB); // check for all types - const auto &AType = DBTH.getType("_ZTS1A"); + const auto &AType = DBTH.getType("A"); ASSERT_NE(nullptr, AType); const auto &CType = DBTH.getType("_ZTS1C"); ASSERT_NE(nullptr, CType); - const auto &XType = DBTH.getType("_ZTS1X"); + const auto &XType = DBTH.getType("X"); ASSERT_NE(nullptr, XType); - const auto &YType = DBTH.getType("vY"); + const auto &YType = DBTH.getType("_ZTS1Y"); ASSERT_NE(nullptr, YType); const auto &ZType = DBTH.getType("_ZTS1Z"); ASSERT_NE(nullptr, ZType); @@ -911,9 +911,9 @@ TEST(DBTHTest, VTableConstruction_8) { ASSERT_NE(nullptr, BaseType); const auto &ChildType = DBTH.getType("_ZTS5Child"); ASSERT_NE(nullptr, ChildType); - const auto &NonvirtualClassType = DBTH.getType("NonvirtualClass"); + const auto &NonvirtualClassType = DBTH.getType("_ZTS15NonvirtualClass"); EXPECT_NE(nullptr, NonvirtualClassType); - const auto &NonvirtualStructType = DBTH.getType("NonvirtualStruct"); + const auto &NonvirtualStructType = DBTH.getType("_ZTS16NonvirtualStruct"); EXPECT_NE(nullptr, NonvirtualStructType); const auto &VTableForBaseType = DBTH.getVFTable(BaseType); @@ -1042,9 +1042,9 @@ TEST(DBTHTest, VTableConstruction_12_b) { DIBasedTypeHierarchy DBTH(IRDB); // check for all types - const auto &BaseType = DBTH.getType("_ZTS4Base"); + const auto &BaseType = DBTH.getType("Base"); ASSERT_NE(nullptr, BaseType); - const auto &ChildType = DBTH.getType("_ZTS5Child"); + const auto &ChildType = DBTH.getType("Child"); ASSERT_NE(nullptr, ChildType); const auto &ChildsChildType = DBTH.getType("_ZTS11ChildsChild"); ASSERT_NE(nullptr, ChildsChildType); @@ -1070,7 +1070,7 @@ TEST(DBTHTest, VTableConstruction_12_c) { DIBasedTypeHierarchy DBTH(IRDB); // check for all types - const auto &ChildType = DBTH.getType("_ZTS5Child"); + const auto &ChildType = DBTH.getType("Child"); ASSERT_NE(nullptr, ChildType); const auto &ChildsChildType = DBTH.getType("_ZTS11ChildsChild"); ASSERT_NE(nullptr, ChildsChildType); @@ -1137,11 +1137,11 @@ TEST(DBTHTest, VTableConstruction_16) { ASSERT_NE(nullptr, BaseType); const auto &ChildType = DBTH.getType("_ZTS5Child"); ASSERT_NE(nullptr, ChildType); - const auto &ChildOfChildType = DBTH.getType("ChildOfChild"); + const auto &ChildOfChildType = DBTH.getType("_ZTS12ChildOfChild"); ASSERT_NE(nullptr, ChildOfChildType); - const auto &BaseTwoType = DBTH.getType("BaseTwo"); + const auto &BaseTwoType = DBTH.getType("_ZTS7BaseTwo"); ASSERT_NE(nullptr, BaseTwoType); - const auto &ChildTwoType = DBTH.getType("ChildTwo"); + const auto &ChildTwoType = DBTH.getType("_ZTS8ChildTwo"); ASSERT_NE(nullptr, ChildTwoType); const auto &VTableForBase = DBTH.getVFTable(BaseType); @@ -1184,9 +1184,9 @@ TEST(DBTHTest, VTableConstruction_17) { // Since Child2 is never used, it is sometimes optimized out by the compiler // const auto &Child2Type = DBTH.getType("Child2"); // ASSERT_NE(nullptr, Child2Type); - const auto &Base2Type = DBTH.getType("Base2"); + const auto &Base2Type = DBTH.getType("_ZTS5Base2"); ASSERT_NE(nullptr, Base2Type); - const auto &KidType = DBTH.getType("Kid"); + const auto &KidType = DBTH.getType("_ZTS3Kid"); ASSERT_NE(nullptr, KidType); const auto &VTableForBase = DBTH.getVFTable(BaseType); @@ -1233,9 +1233,9 @@ TEST(DBTHTest, VTableConstruction_18) { ASSERT_NE(nullptr, BaseType); const auto &ChildType = DBTH.getType("_ZTS5Child"); ASSERT_NE(nullptr, ChildType); - const auto &Child2Type = DBTH.getType("Child_2"); + const auto &Child2Type = DBTH.getType("_ZTS7Child_2"); ASSERT_NE(nullptr, Child2Type); - const auto &Child3Type = DBTH.getType("Child_3"); + const auto &Child3Type = DBTH.getType("_ZTS7Child_3"); ASSERT_NE(nullptr, Child3Type); const auto &VTableForBase = DBTH.getVFTable(BaseType); @@ -1276,13 +1276,13 @@ TEST(DBTHTest, VTableConstruction_19) { ASSERT_NE(nullptr, BaseType); const auto &ChildType = DBTH.getType("_ZTS5Child"); ASSERT_NE(nullptr, ChildType); - const auto &FooType = DBTH.getType("Foo"); + const auto &FooType = DBTH.getType("_ZTS3Foo"); ASSERT_NE(nullptr, FooType); - const auto &BarType = DBTH.getType("Bar"); + const auto &BarType = DBTH.getType("_ZTS3Bar"); ASSERT_NE(nullptr, BarType); - const auto &LoremType = DBTH.getType("Lorem"); + const auto &LoremType = DBTH.getType("_ZTS5Lorem"); ASSERT_NE(nullptr, LoremType); - const auto &ImpsumType = DBTH.getType("Impsum"); + const auto &ImpsumType = DBTH.getType("_ZTS6Impsum"); ASSERT_NE(nullptr, ImpsumType); const auto &VTableForBase = DBTH.getVFTable(BaseType); @@ -1327,7 +1327,7 @@ TEST(DBTHTest, VTableConstruction_20) { // check for all types const auto &BaseType = DBTH.getType("_ZTS4Base"); ASSERT_NE(nullptr, BaseType); - const auto &Base2Type = DBTH.getType("Base2"); + const auto &Base2Type = DBTH.getType("_ZTS5Base2"); ASSERT_NE(nullptr, Base2Type); const auto &ChildType = DBTH.getType("_ZTS5Child"); ASSERT_NE(nullptr, ChildType); @@ -1360,13 +1360,13 @@ TEST(DBTHTest, VTableConstruction_21) { // check for all types const auto &BaseType = DBTH.getType("_ZTS4Base"); ASSERT_NE(nullptr, BaseType); - const auto &Base2Type = DBTH.getType("Base2"); + const auto &Base2Type = DBTH.getType("_ZTS5Base2"); ASSERT_NE(nullptr, Base2Type); - const auto &Base3Type = DBTH.getType("Base3"); + const auto &Base3Type = DBTH.getType("_ZTS5Base3"); ASSERT_NE(nullptr, Base3Type); const auto &ChildType = DBTH.getType("_ZTS5Child"); ASSERT_NE(nullptr, ChildType); - const auto &Child2Type = DBTH.getType("Child2"); + const auto &Child2Type = DBTH.getType("_ZTS6Child2"); ASSERT_NE(nullptr, Child2Type); const auto &VTableForBase = DBTH.getVFTable(BaseType); @@ -1559,19 +1559,19 @@ TEST(DBTHTest, TransitivelyReachableTypes_7) { DIBasedTypeHierarchy DBTH(IRDB); // check for all types - const auto &AType = DBTH.getType("A"); + const auto &AType = DBTH.getType("_ZTS1A"); ASSERT_NE(nullptr, AType); - const auto &BType = DBTH.getType("B"); + const auto &BType = DBTH.getType("_ZTS1B"); ASSERT_NE(nullptr, BType); - const auto &CType = DBTH.getType("C"); + const auto &CType = DBTH.getType("_ZTS1C"); ASSERT_NE(nullptr, CType); - const auto &DType = DBTH.getType("D"); + const auto &DType = DBTH.getType("_ZTS1D"); ASSERT_NE(nullptr, DType); - const auto &XType = DBTH.getType("X"); + const auto &XType = DBTH.getType("_ZTS1X"); ASSERT_NE(nullptr, XType); - const auto &YType = DBTH.getType("Y"); + const auto &YType = DBTH.getType("_ZTS1Y"); ASSERT_NE(nullptr, YType); - const auto &ZType = DBTH.getType("Z"); + const auto &ZType = DBTH.getType("_ZTS1Z"); ASSERT_NE(nullptr, ZType); auto ReachableTypesA = DBTH.getSubTypes(AType); @@ -1655,15 +1655,15 @@ TEST(DBTHTest, TransitivelyReachableTypes_7_b) { // check for all types const auto &AType = DBTH.getType("A"); ASSERT_NE(nullptr, AType); - const auto &CType = DBTH.getType("C"); + const auto &CType = DBTH.getType("_ZTS1C"); ASSERT_NE(nullptr, CType); const auto &XType = DBTH.getType("X"); ASSERT_NE(nullptr, XType); - const auto &YType = DBTH.getType("Y"); + const auto &YType = DBTH.getType("_ZTS1Y"); ASSERT_NE(nullptr, YType); - const auto &ZType = DBTH.getType("Z"); + const auto &ZType = DBTH.getType("_ZTS1Z"); ASSERT_NE(nullptr, ZType); - const auto &OmegaType = DBTH.getType("Omega"); + const auto &OmegaType = DBTH.getType("_ZTS5Omega"); ASSERT_NE(nullptr, OmegaType); auto ReachableTypesA = DBTH.getSubTypes(AType); @@ -1733,9 +1733,9 @@ TEST(DBTHTest, TransitivelyReachableTypes_8) { ASSERT_NE(nullptr, BaseType); const auto &ChildType = DBTH.getType("_ZTS5Child"); ASSERT_NE(nullptr, ChildType); - const auto &NonvirtualClassType = DBTH.getType("NonvirtualClass"); + const auto &NonvirtualClassType = DBTH.getType("_ZTS15NonvirtualClass"); ASSERT_NE(nullptr, NonvirtualClassType); - const auto &NonvirtualStructType = DBTH.getType("NonvirtualStruct"); + const auto &NonvirtualStructType = DBTH.getType("_ZTS16NonvirtualStruct"); ASSERT_NE(nullptr, NonvirtualStructType); auto ReachableTypesBase = DBTH.getSubTypes(BaseType); @@ -1863,11 +1863,11 @@ TEST(DBTHTest, TransitivelyReachableTypes_12_b) { DIBasedTypeHierarchy DBTH(IRDB); // check for all types - const auto &BaseType = DBTH.getType("_ZTS4Base"); + const auto &BaseType = DBTH.getType("Base"); ASSERT_NE(nullptr, BaseType); - const auto &ChildType = DBTH.getType("_ZTS5Child"); + const auto &ChildType = DBTH.getType("Child"); ASSERT_NE(nullptr, ChildType); - const auto &ChildsChildType = DBTH.getType("ChildsChild"); + const auto &ChildsChildType = DBTH.getType("_ZTS11ChildsChild"); ASSERT_NE(nullptr, ChildsChildType); auto ReachableTypesBase = DBTH.getSubTypes(BaseType); @@ -1894,9 +1894,9 @@ TEST(DBTHTest, TransitivelyReachableTypes_12_c) { DIBasedTypeHierarchy DBTH(IRDB); // check for all types - const auto &ChildType = DBTH.getType("_ZTS5Child"); + const auto &ChildType = DBTH.getType("Child"); ASSERT_NE(nullptr, ChildType); - const auto &ChildsChildType = DBTH.getType("ChildsChild"); + const auto &ChildsChildType = DBTH.getType("_ZTS11ChildsChild"); ASSERT_NE(nullptr, ChildsChildType); auto ReachableTypesChild = DBTH.getSubTypes(ChildType); @@ -1922,7 +1922,7 @@ TEST(DBTHTest, TransitivelyReachableTypes_14) { DIBasedTypeHierarchy DBTH(IRDB); // check for all types - const auto &BaseType = DBTH.getType("_ZTS4Base"); + const auto &BaseType = DBTH.getType("Base"); ASSERT_NE(nullptr, BaseType); auto ReachableTypesBase = DBTH.getSubTypes(BaseType); @@ -1937,9 +1937,9 @@ TEST(DBTHTest, TransitivelyReachableTypes_15) { DIBasedTypeHierarchy DBTH(IRDB); // check for all types - const auto &BaseType = DBTH.getType("_ZTS4Base"); + const auto &BaseType = DBTH.getType("Base"); ASSERT_NE(nullptr, BaseType); - const auto &ChildType = DBTH.getType("_ZTS5Child"); + const auto &ChildType = DBTH.getType("Child"); ASSERT_NE(nullptr, ChildType); auto ReachableTypesBase = DBTH.getSubTypes(BaseType); @@ -1966,9 +1966,9 @@ TEST(DBTHTest, TransitivelyReachableTypes_16) { // const auto &ChildsChildType = DBTH.getType("ChildsChild"); // Since ChildsChild is never used, it is optimized out // ASSERT_EQ(nullptr, ChildsChildType); - const auto &BaseTwoType = DBTH.getType("BaseTwo"); + const auto &BaseTwoType = DBTH.getType("_ZTS7BaseTwo"); ASSERT_NE(nullptr, BaseTwoType); - const auto &ChildTwoType = DBTH.getType("ChildTwo"); + const auto &ChildTwoType = DBTH.getType("_ZTS8ChildTwo"); ASSERT_NE(nullptr, ChildTwoType); auto ReachableTypesBase = DBTH.getSubTypes(BaseType); @@ -2011,9 +2011,9 @@ TEST(DBTHTest, TransitivelyReachableTypes_17) { // const auto &Child2Type = DBTH.getType("Child2"); // Since Child2 is never used, it is optimized out // ASSERT_EQ(nullptr, Child2Type); - const auto &Base2Type = DBTH.getType("Base2"); + const auto &Base2Type = DBTH.getType("_ZTS5Base2"); ASSERT_NE(nullptr, Base2Type); - const auto &KidType = DBTH.getType("Kid"); + const auto &KidType = DBTH.getType("_ZTS3Kid"); ASSERT_NE(nullptr, KidType); auto ReachableTypesBase = DBTH.getSubTypes(BaseType); @@ -2053,9 +2053,9 @@ TEST(DBTHTest, TransitivelyReachableTypes_18) { ASSERT_NE(nullptr, BaseType); const auto &ChildType = DBTH.getType("_ZTS5Child"); ASSERT_NE(nullptr, ChildType); - const auto &Child2Type = DBTH.getType("Child_2"); + const auto &Child2Type = DBTH.getType("_ZTS7Child_2"); ASSERT_NE(nullptr, Child2Type); - const auto &Child3Type = DBTH.getType("Child_3"); + const auto &Child3Type = DBTH.getType("_ZTS7Child_3"); ASSERT_NE(nullptr, Child3Type); auto ReachableTypesBase = DBTH.getSubTypes(BaseType); @@ -2091,13 +2091,13 @@ TEST(DBTHTest, TransitivelyReachableTypes_19) { ASSERT_NE(nullptr, BaseType); const auto &ChildType = DBTH.getType("_ZTS5Child"); ASSERT_NE(nullptr, ChildType); - const auto &FooType = DBTH.getType("Foo"); + const auto &FooType = DBTH.getType("_ZTS3Foo"); ASSERT_NE(nullptr, FooType); - const auto &BarType = DBTH.getType("Bar"); + const auto &BarType = DBTH.getType("_ZTS3Bar"); ASSERT_NE(nullptr, BarType); - const auto &LoremType = DBTH.getType("Lorem"); + const auto &LoremType = DBTH.getType("_ZTS5Lorem"); ASSERT_NE(nullptr, LoremType); - const auto &ImpsumType = DBTH.getType("Impsum"); + const auto &ImpsumType = DBTH.getType("_ZTS6Impsum"); ASSERT_NE(nullptr, ImpsumType); auto ReachableTypesBase = DBTH.getSubTypes(BaseType); @@ -2138,7 +2138,7 @@ TEST(DBTHTest, TransitivelyReachableTypes_20) { // check for all types const auto &BaseType = DBTH.getType("_ZTS4Base"); ASSERT_NE(nullptr, BaseType); - const auto &Base2Type = DBTH.getType("Base2"); + const auto &Base2Type = DBTH.getType("_ZTS5Base2"); ASSERT_NE(nullptr, Base2Type); const auto &ChildType = DBTH.getType("_ZTS5Child"); ASSERT_NE(nullptr, ChildType); @@ -2168,13 +2168,13 @@ TEST(DBTHTest, TransitivelyReachableTypes_21) { // check for all types const auto &BaseType = DBTH.getType("_ZTS4Base"); ASSERT_NE(nullptr, BaseType); - const auto &Base2Type = DBTH.getType("Base2"); + const auto &Base2Type = DBTH.getType("_ZTS5Base2"); ASSERT_NE(nullptr, Base2Type); - const auto &Base3Type = DBTH.getType("Base3"); + const auto &Base3Type = DBTH.getType("_ZTS5Base3"); ASSERT_NE(nullptr, Base3Type); const auto &ChildType = DBTH.getType("_ZTS5Child"); ASSERT_NE(nullptr, ChildType); - const auto &Child2Type = DBTH.getType("Child2"); + const auto &Child2Type = DBTH.getType("_ZTS6Child2"); ASSERT_NE(nullptr, Child2Type); auto ReachableTypesBase = DBTH.getSubTypes(BaseType);