1 // 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
2 // 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
3 
4 // Tests that we assign unnamed metadata nodes to functions whose types have
5 // internal linkage.
6 
7 namespace {
8 
9 struct S {};
10 
11 void f(S *s) {
12 }
13 
14 }
15 
16 void g() {
17   void (*fp)(S *) = f;
18   // CHECK: call i1 @llvm.type.test(i8* {{.*}}, metadata [[VOIDS:![0-9]+]])
19   fp(0);
20 }
21 
22 // ITANIUM: define internal void @_ZN12_GLOBAL__N_11fEPNS_1SE({{.*}} !type [[TS:![0-9]+]]
23 // MS: define internal void @"\01?f@?A@@YAXPEAUS@?A@@@Z"({{.*}} !type [[TS:![0-9]+]]
24 
25 // CHECK: [[VOIDS]] = distinct !{}
26 // CHECK: [[TS]] = !{i64 0, [[VOIDS]]}
27