xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/mrtd.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -mrtd -triple i386-unknown-unknown -std=c89 -emit-llvm -o - %s 2>&1 | FileCheck %s
2*0a6a1f1dSLionel Sambuc 
3*0a6a1f1dSLionel Sambuc // CHECK: mrtd.c:10:3: warning: function with no prototype cannot use the stdcall calling convention
4f4a2713aSLionel Sambuc 
5f4a2713aSLionel Sambuc void baz(int arg);
6f4a2713aSLionel Sambuc 
7f4a2713aSLionel Sambuc // CHECK: define x86_stdcallcc void @foo(i32 %arg) [[NUW:#[0-9]+]]
foo(int arg)8f4a2713aSLionel Sambuc void foo(int arg) {
9f4a2713aSLionel Sambuc // CHECK: call x86_stdcallcc i32 bitcast (i32 (...)* @bar to i32 (i32)*)(
10f4a2713aSLionel Sambuc   bar(arg);
11f4a2713aSLionel Sambuc // CHECK: call x86_stdcallcc void @baz(i32
12f4a2713aSLionel Sambuc   baz(arg);
13f4a2713aSLionel Sambuc }
14f4a2713aSLionel Sambuc 
15f4a2713aSLionel Sambuc // CHECK: declare x86_stdcallcc i32 @bar(...)
16f4a2713aSLionel Sambuc 
17f4a2713aSLionel Sambuc // CHECK: declare x86_stdcallcc void @baz(i32)
18f4a2713aSLionel Sambuc 
qux(int arg,...)19f4a2713aSLionel Sambuc void qux(int arg, ...) { }
20f4a2713aSLionel Sambuc // CHECK: define void @qux(i32 %arg, ...)
21f4a2713aSLionel Sambuc 
quux(int a1,int a2,int a3)22f4a2713aSLionel Sambuc void quux(int a1, int a2, int a3) {
23f4a2713aSLionel Sambuc   qux(a1, a2, a3);
24f4a2713aSLionel Sambuc }
25f4a2713aSLionel Sambuc // CHECK-LABEL: define x86_stdcallcc void @quux
26f4a2713aSLionel Sambuc // CHECK: call void (i32, ...)* @qux
27f4a2713aSLionel Sambuc 
28f4a2713aSLionel Sambuc // CHECK: attributes [[NUW]] = { nounwind{{.*}} }
29