mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-24 14:05:49 -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
30 lines
1.0 KiB
C++
30 lines
1.0 KiB
C++
// RUN: %clang_cc1 -triple x86_64-unknown-linux -fsanitize=cfi-icall -fsanitize-trap=cfi-icall -emit-llvm -o - %s | FileCheck --check-prefix=CHECK --check-prefix=ITANIUM %s
|
|
// RUN: %clang_cc1 -triple x86_64-pc-windows-msvc -fsanitize=cfi-icall -fsanitize-trap=cfi-icall -emit-llvm -o - %s | FileCheck --check-prefix=CHECK --check-prefix=MS %s
|
|
|
|
// Tests that we assign unnamed metadata nodes to functions whose types have
|
|
// internal linkage.
|
|
|
|
namespace {
|
|
|
|
struct S {};
|
|
|
|
void f(S s) {
|
|
}
|
|
|
|
}
|
|
|
|
void g() {
|
|
struct S s;
|
|
void (*fp)(S) = f;
|
|
// CHECK: call i1 @llvm.type.test(i8* {{.*}}, metadata [[VOIDS1:![0-9]+]])
|
|
fp(s);
|
|
}
|
|
|
|
// ITANIUM: define internal void @_ZN12_GLOBAL__N_11fENS_1SE({{.*}} !type [[TS1:![0-9]+]] !type [[TS2:![0-9]+]]
|
|
// MS: define internal void @"?f@?A0x{{[^@]*}}@@YAXUS@?A0x{{[^@]*}}@@@Z"({{.*}} !type [[TS1:![0-9]+]] !type [[TS2:![0-9]+]]
|
|
|
|
// CHECK: [[VOIDS1]] = distinct !{}
|
|
// CHECK: [[TS1]] = !{i64 0, [[VOIDS1]]}
|
|
// CHECK: [[TS2]] = !{i64 0, [[VOIDS2:![0-9]+]]}
|
|
// CHECK: [[VOIDS2]] = distinct !{}
|