2015-09-10 10:17:40 +08:00
|
|
|
// 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 {};
|
|
|
|
|
2017-11-01 06:39:44 +08:00
|
|
|
void f(S s) {
|
2015-09-10 10:17:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void g() {
|
2017-11-01 06:39:44 +08:00
|
|
|
struct S s;
|
|
|
|
void (*fp)(S) = f;
|
|
|
|
// CHECK: call i1 @llvm.type.test(i8* {{.*}}, metadata [[VOIDS1:![0-9]+]])
|
|
|
|
fp(s);
|
2015-09-10 10:17:40 +08:00
|
|
|
}
|
|
|
|
|
2017-11-01 06:39:44 +08:00
|
|
|
// ITANIUM: define internal void @_ZN12_GLOBAL__N_11fENS_1SE({{.*}} !type [[TS1:![0-9]+]] !type [[TS2:![0-9]+]]
|
[MS] Mangle a hash of the main file path into anonymous namespaces
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
2018-08-18 04:59:27 +08:00
|
|
|
// MS: define internal void @"?f@?A0x{{[^@]*}}@@YAXUS@?A0x{{[^@]*}}@@@Z"({{.*}} !type [[TS1:![0-9]+]] !type [[TS2:![0-9]+]]
|
2016-06-25 05:21:46 +08:00
|
|
|
|
2017-11-01 06:39:44 +08:00
|
|
|
// CHECK: [[VOIDS1]] = distinct !{}
|
|
|
|
// CHECK: [[TS1]] = !{i64 0, [[VOIDS1]]}
|
|
|
|
// CHECK: [[TS2]] = !{i64 0, [[VOIDS2:![0-9]+]]}
|
|
|
|
// CHECK: [[VOIDS2]] = distinct !{}
|