mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-19 19:45:40 -04:00

Summary: This is needed to avoid conflicts in mangled names for codeview types in anonymous namespaces. In CodeView, types refer to each other typically through forward declarations, which contain mangled names. These names have to be unique, otherwise the debugger will look up the mangled name and find the wrong definition. Furthermore, ThinLTO will deduplicate the types, and debug info verification can fail when the types have the wrong sizes. This is PR38608. Fixes PR38609. Reviewers: majnemer, inglorion, hans Subscribers: mehdi_amini, aprantl, JDevlieghere, dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D50877 llvm-svn: 340079
46 lines
1.6 KiB
C++
46 lines
1.6 KiB
C++
// RUN: %clang_cc1 -flto -triple x86_64-unknown-linux -fsanitize=cfi-vcall -fsanitize-cfi-cross-dso -emit-llvm -o - %s | FileCheck --check-prefix=CHECK --check-prefix=ITANIUM %s
|
|
// RUN: %clang_cc1 -flto -triple x86_64-pc-windows-msvc -fsanitize=cfi-vcall -fsanitize-cfi-cross-dso -emit-llvm -o - %s | FileCheck --check-prefix=CHECK --check-prefix=MS %s
|
|
|
|
struct A {
|
|
A();
|
|
virtual void f();
|
|
};
|
|
|
|
A::A() {}
|
|
void A::f() {}
|
|
|
|
void caller(A* a) {
|
|
a->f();
|
|
}
|
|
|
|
namespace {
|
|
struct B {
|
|
virtual void f();
|
|
};
|
|
|
|
void B::f() {}
|
|
} // namespace
|
|
|
|
void g() {
|
|
B b;
|
|
b.f();
|
|
}
|
|
|
|
// MS: @[[B_VTABLE:.*]] = private unnamed_addr constant { [2 x i8*] } {{.*}}@"??_R4B@?A0x{{[^@]*}}@@6B@"{{.*}}@"?f@B@?A0x{{[^@]*}}@@UEAAXXZ"
|
|
|
|
// CHECK: %[[VT:.*]] = load void (%struct.A*)**, void (%struct.A*)***
|
|
// CHECK: %[[VT2:.*]] = bitcast {{.*}}%[[VT]] to i8*, !nosanitize
|
|
// ITANIUM: %[[TEST:.*]] = call i1 @llvm.type.test(i8* %[[VT2]], metadata !"_ZTS1A"), !nosanitize
|
|
// MS: %[[TEST:.*]] = call i1 @llvm.type.test(i8* %[[VT2]], metadata !"?AUA@@"), !nosanitize
|
|
// CHECK: br i1 %[[TEST]], label %[[CONT:.*]], label %[[SLOW:.*]], {{.*}} !nosanitize
|
|
// CHECK: [[SLOW]]
|
|
// ITANIUM: call void @__cfi_slowpath_diag(i64 7004155349499253778, i8* %[[VT2]], {{.*}}) {{.*}} !nosanitize
|
|
// MS: call void @__cfi_slowpath_diag(i64 -8005289897957287421, i8* %[[VT2]], {{.*}}) {{.*}} !nosanitize
|
|
// CHECK: br label %[[CONT]], !nosanitize
|
|
// CHECK: [[CONT]]
|
|
// CHECK: call void %{{.*}}(%struct.A* %{{.*}})
|
|
|
|
// No hash-based bit set entry for (anonymous namespace)::B
|
|
// ITANIUM-NOT: !{i64 {{.*}}, [3 x i8*]* @_ZTVN12_GLOBAL__N_11BE,
|
|
// MS-NOT: !{i64 {{.*}}, [2 x i8*]* @[[B_VTABLE]],
|