1 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm %s -fms-extensions -o - | FileCheck %s
5 [[clang::nomerge
]] A();
6 [[clang::nomerge
]] virtual ~A();
7 [[clang::nomerge
]] void f();
8 [[clang::nomerge
]] virtual void g();
9 [[clang::nomerge
]] static void f1();
18 [[clang::nomerge
]] void f(bool, bool);
19 [[clang::nomerge
]] void (*fptr
)(void);
21 void foo(int i
, A
*ap
, B
*bp
) {
22 [[clang::nomerge
]] bar();
23 [[clang::nomerge
]] (i
= 4, bar());
24 [[clang::nomerge
]] (void)(bar());
27 [[clang::nomerge
]] [] { bar(); bar(); }(); // nomerge only applies to the anonymous function call
28 [[clang::nomerge
]] for (bar(); bar(); bar()) {}
29 [[clang::nomerge
]] { asm("nop"); }
45 [[clang::nomerge
]] __builtin_trap();
46 [[clang::nomerge
]] __debugbreak();
47 [[clang::nomerge
]] __builtin_verbose_trap("check null", "Argument must not be null.");
56 [[clang::nomerge
]] int g(int i
);
58 void something_else() {
62 int g(int i
) { return i
; }
64 void something_else_again() {
68 // CHECK: call noundef{{.*}} i1 @_Z3barv() #[[ATTR0:[0-9]+]]
69 // CHECK: call noundef{{.*}} i1 @_Z3barv() #[[ATTR0]]
70 // CHECK: call noundef{{.*}} i1 @_Z3barv() #[[ATTR0]]
71 // CHECK: call noundef{{.*}} i1 @_Z3barv(){{$}}
72 // CHECK: call noundef{{.*}} i1 @_Z3barv(){{$}}
73 // CHECK: call void @_Z1fbb({{.*}}) #[[ATTR0]]
74 // CHECK: %[[FPTR:.*]] = load ptr, ptr @fptr
75 // CHECK-NEXT: call void %[[FPTR]]() #[[ATTR0]]
76 // CHECK: call void @"_ZZ3fooiP1AP1BENK3$_0clEv"{{.*}} #[[ATTR0]]
77 // CHECK: call noundef{{.*}} i1 @_Z3barv() #[[ATTR0]]
78 // CHECK-LABEL: for.cond:
79 // CHECK: call noundef{{.*}} i1 @_Z3barv() #[[ATTR0]]
80 // CHECK-LABEL: for.inc:
81 // CHECK: call noundef{{.*}} i1 @_Z3barv() #[[ATTR0]]
82 // CHECK: call void asm sideeffect "nop"{{.*}} #[[ATTR1:[0-9]+]]
83 // CHECK: call noundef{{.*}} i1 @_Z3barv(){{$}}
84 // CHECK: load ptr, ptr
85 // CHECK: load ptr, ptr
86 // CHECK: %[[AG:.*]] = load ptr, ptr
87 // CHECK-NEXT: call void %[[AG]](ptr {{.*}}) #[[ATTR0]]
88 // CHECK: load ptr, ptr
89 // CHECK: load ptr, ptr
90 // CHECK: %[[BG:.*]] = load ptr, ptr
91 // CHECK-NEXT: call void %[[BG]](ptr noundef{{.*}}
92 // CHECK: call void @_ZN1AC1Ev({{.*}}) #[[ATTR0]]
93 // CHECK: call void @_ZN1A1fEv({{.*}}) #[[ATTR0]]
94 // CHECK: call void @_ZN1A1gEv({{.*}}) #[[ATTR0]]
95 // CHECK: call void @_ZN1A2f1Ev() #[[ATTR0]]
96 // CHECK: call void @_ZN1BC1Ev({{.*}}){{$}}
97 // CHECK: call void @_ZN1B1gEv({{.*}}){{$}}
98 // CHECK: call void @_ZN1BC1Ev({{.*}}){{$}}
99 // CHECK: load ptr, ptr
100 // CHECK: load ptr, ptr
101 // CHECK: %[[AG:.*]] = load ptr, ptr
102 // CHECK-NEXT: call void %[[AG]](ptr {{.*}}) #[[ATTR1]]
103 // CHECK: call void @llvm.trap() #[[ATTR0]]
104 // CHECK: call void @llvm.debugtrap() #[[ATTR0]]
105 // CHECK: call void @llvm.trap() #[[ATTR0]]
106 // CHECK: call void @_ZN1AD1Ev(ptr {{.*}}) #[[ATTR1]]
108 // CHECK-DAG: attributes #[[ATTR0]] = {{{.*}}nomerge{{.*}}}
109 // CHECK-DAG: attributes #[[ATTR1]] = {{{.*}}nomerge{{.*}}}