mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-29 15:16:08 +00:00

This flag causes the compiler to emit bit set entries for functions as well as runtime bitset checks at indirect call sites. Depends on the new function bitset mechanism. Differential Revision: http://reviews.llvm.org/D11857 llvm-svn: 247238
24 lines
824 B
C++
24 lines
824 B
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() {
|
|
void (*fp)(S *) = f;
|
|
// CHECK: call i1 @llvm.bitset.test(i8* {{.*}}, metadata ![[VOIDS:[0-9]+]])
|
|
fp(0);
|
|
}
|
|
|
|
// ITANIUM: !{![[VOIDS]], void (%"struct.(anonymous namespace)::S"*)* @_ZN12_GLOBAL__N_11fEPNS_1SE, i64 0}
|
|
// MS: !{![[VOIDS]], void (%"struct.(anonymous namespace)::S"*)* @"\01?f@?A@@YAXPEAUS@?A@@@Z", i64 0}
|