[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CodeGen / cfi-icall.c
blob90c04320de3fe1a3f199563f7b51acb67e06b2cb
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
4 // Tests that we assign appropriate identifiers to unprototyped functions.
6 // CHECK: define {{(dso_local )?}}void @f({{.*}} !type [[TVOID:![0-9]+]] !type [[TVOID_GENERALIZED:![0-9]+]]
7 void f() {
10 void xf();
12 // CHECK: define {{(dso_local )?}}void @g({{.*}} !type [[TINT:![0-9]+]] !type [[TINT_GENERALIZED:![0-9]+]]
13 void g(int b) {
14 void (*fp)() = b ? f : xf;
15 // ITANIUM: call i1 @llvm.type.test(ptr {{.*}}, metadata !"_ZTSFvE")
16 fp();
19 // CHECK: declare !type [[TVOID]] !type [[TVOID_GENERALIZED]] {{(dso_local )?}}void @xf({{.*}}
21 // ITANIUM-DAG: [[TVOID]] = !{i64 0, !"_ZTSFvE"}
22 // ITANIUM-DAG: [[TVOID_GENERALIZED]] = !{i64 0, !"_ZTSFvE.generalized"}
23 // ITANIUM-DAG: [[TINT]] = !{i64 0, !"_ZTSFviE"}
24 // ITANIUM-DAG: [[TINT_GENERALIZED]] = !{i64 0, !"_ZTSFviE.generalized"}
25 // MS-DAG: [[TVOID]] = !{i64 0, !"?6AX@Z"}
26 // MS-DAG: [[TVOID_GENERALIZED]] = !{i64 0, !"?6AX@Z.generalized"}
27 // MS-DAG: [[TINT]] = !{i64 0, !"?6AXH@Z"}
28 // MS-DAG: [[TINT_GENERALIZED]] = !{i64 0, !"?6AXH@Z.generalized"}