//===- llvm/unittest/CodeGen/DIEHashTest.cpp ------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "../lib/CodeGen/AsmPrinter/DIEHash.h" #include "TestAsmPrinter.h" #include "llvm/ADT/STLExtras.h" #include "llvm/BinaryFormat/Dwarf.h" #include "llvm/CodeGen/DIE.h" #include "llvm/CodeGen/DwarfStringPoolEntry.h" #include "llvm/Support/Debug.h" #include "llvm/Support/Format.h" #include "llvm/TargetParser/Host.h" #include "llvm/Testing/Support/Error.h" #include "gtest/gtest.h" usingnamespacellvm; namespace { // Test fixture class DIEHashTest : public testing::Test { … }; TEST_F(DIEHashTest, Data1) { … } // struct {}; TEST_F(DIEHashTest, TrivialType) { … } // struct foo { }; TEST_F(DIEHashTest, NamedType) { … } // namespace space { struct foo { }; } TEST_F(DIEHashTest, NamespacedType) { … } // struct { int member; }; TEST_F(DIEHashTest, TypeWithMember) { … } // struct foo { int mem1, mem2; }; TEST_F(DIEHashTest, ReusedType) { … } // struct foo { static foo f; }; TEST_F(DIEHashTest, RecursiveType) { … } // struct foo { foo *mem; }; TEST_F(DIEHashTest, Pointer) { … } // struct foo { foo &mem; }; TEST_F(DIEHashTest, Reference) { … } // struct foo { foo &&mem; }; TEST_F(DIEHashTest, RValueReference) { … } // struct foo { foo foo::*mem; }; TEST_F(DIEHashTest, PtrToMember) { … } // Check that the hash for a pointer-to-member matches regardless of whether the // pointed-to type is a declaration or a definition. // // struct bar; // { }; // struct foo { bar foo::*mem; }; TEST_F(DIEHashTest, PtrToMemberDeclDefMatch) { … } // Check that the hash for a pointer-to-member matches regardless of whether the // pointed-to type is a declaration or a definition. // // struct bar; // { }; // struct foo { bar bar::*mem; }; TEST_F(DIEHashTest, PtrToMemberDeclDefMisMatch) { … } // struct { } a; // struct foo { decltype(a) mem; }; TEST_F(DIEHashTest, RefUnnamedType) { … } // struct { struct foo { }; }; TEST_F(DIEHashTest, NestedType) { … } // struct { static void func(); }; TEST_F(DIEHashTest, MemberFunc) { … } // struct A { // static void func(); // }; TEST_F(DIEHashTest, MemberFuncFlag) { … } // Derived from: // struct A { // const static int PI = -3; // }; // A a; TEST_F(DIEHashTest, MemberSdata) { … } // Derived from: // struct A { // const static float PI = 3.14; // }; // A a; TEST_F(DIEHashTest, MemberBlock) { … } }