1 // RUN: %clang_cc1 -triple %ms_abi_triple -fms-extensions -std=c++11 -emit-llvm -O2 -o - %s | FileCheck %s
4 void (*func_ptr
)() = &target_func
;
6 // The "guard_nocf" attribute must be added.
7 __declspec(guard(nocf
)) void nocf0() {
11 // CHECK: call{{.*}}[[NOCF:#[0-9]+]]
13 // The "guard_nocf" attribute must *not* be added.
18 // CHECK: call{{.*}}[[CF:#[0-9]+]]
20 // If the modifier is present on either the function declaration or definition,
21 // the "guard_nocf" attribute must be added.
22 __declspec(guard(nocf
)) void nocf1();
27 // CHECK: call{{.*}}[[NOCF:#[0-9]+]]
30 __declspec(guard(nocf
)) void nocf2() {
34 // CHECK: call{{.*}}[[NOCF:#[0-9]+]]
36 // When inlining a function, the "guard_nocf" attribute on indirect calls must
42 // CHECK: call{{.*}}[[NOCF:#[0-9]+]]
44 // When inlining into a function marked as __declspec(guard(nocf)), the
45 // "guard_nocf" attribute must *not* be added to the inlined calls.
46 __declspec(guard(nocf
)) void cf1() {
50 // CHECK: call{{.*}}[[CF:#[0-9]+]]
52 // When the __declspec(guard(nocf)) modifier is present on an override function,
53 // the "guard_nocf" attribute must be added.
58 struct Derived
: Base
{
59 __declspec(guard(nocf
)) void nocf4() override
{
65 // CHECK: call{{.*}}[[NOCF:#[0-9]+]]
67 // When the modifier is not present on an override function, the "guard_nocf"
68 // attribute must *not* be added, even if the modifier is present on the virtual
71 __declspec(guard(nocf
)) virtual void cf2();
74 struct Derived1
: Base1
{
81 // CHECK: call{{.*}}[[CF:#[0-9]+]]
83 // CHECK: attributes [[NOCF]] = { {{.*}}"guard_nocf"{{.*}} }
84 // CHECK-NOT: attributes [[CF]] = { {{.*}}"guard_nocf"{{.*}} }