1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -triple le32-unknown-nacl -emit-llvm -o - %s | FileCheck %s
2*0a6a1f1dSLionel Sambuc #include <stdarg.h>
3*0a6a1f1dSLionel Sambuc 
get_int(va_list * args)4*0a6a1f1dSLionel Sambuc int get_int(va_list *args) {
5*0a6a1f1dSLionel Sambuc   return va_arg(*args, int);
6*0a6a1f1dSLionel Sambuc }
7*0a6a1f1dSLionel Sambuc // CHECK: define i32 @get_int
8*0a6a1f1dSLionel Sambuc // CHECK: [[RESULT:%[a-z_0-9]+]] = va_arg {{.*}}, i32{{$}}
9*0a6a1f1dSLionel Sambuc // CHECK: ret i32 [[RESULT]]
10*0a6a1f1dSLionel Sambuc 
11*0a6a1f1dSLionel Sambuc struct Foo {
12*0a6a1f1dSLionel Sambuc   int x;
13*0a6a1f1dSLionel Sambuc };
14*0a6a1f1dSLionel Sambuc 
15*0a6a1f1dSLionel Sambuc struct Foo dest;
16*0a6a1f1dSLionel Sambuc 
get_struct(va_list * args)17*0a6a1f1dSLionel Sambuc void get_struct(va_list *args) {
18*0a6a1f1dSLionel Sambuc   dest = va_arg(*args, struct Foo);
19*0a6a1f1dSLionel Sambuc }
20*0a6a1f1dSLionel Sambuc // CHECK: define void @get_struct
21*0a6a1f1dSLionel Sambuc // CHECK: [[RESULT:%[a-z_0-9]+]] = va_arg {{.*}}, %struct.Foo{{$}}
22*0a6a1f1dSLionel Sambuc // CHECK: store %struct.Foo [[RESULT]], %struct.Foo* @dest
23*0a6a1f1dSLionel Sambuc 
skip_struct(va_list * args)24*0a6a1f1dSLionel Sambuc void skip_struct(va_list *args) {
25*0a6a1f1dSLionel Sambuc   va_arg(*args, struct Foo);
26*0a6a1f1dSLionel Sambuc }
27*0a6a1f1dSLionel Sambuc // CHECK: define void @skip_struct
28*0a6a1f1dSLionel Sambuc // CHECK: va_arg {{.*}}, %struct.Foo{{$}}
29