This repository has been archived by the owner on Nov 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from ericrannaud/incoming
Handle va_arg on struct types for the le32 target (PNaCl and Emscripten)
- Loading branch information
Showing
2 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// RUN: %clang_cc1 -triple le32-unknown-nacl -emit-llvm -o - %s | FileCheck %s | ||
#include <stdarg.h> | ||
|
||
int get_int(va_list *args) { | ||
return va_arg(*args, int); | ||
} | ||
// CHECK: define i32 @get_int | ||
// CHECK: [[RESULT:%[a-z_0-9]+]] = va_arg {{.*}}, i32{{$}} | ||
// CHECK: ret i32 [[RESULT]] | ||
|
||
struct Foo { | ||
int x; | ||
}; | ||
|
||
struct Foo dest; | ||
|
||
void get_struct(va_list *args) { | ||
dest = va_arg(*args, struct Foo); | ||
} | ||
// CHECK: define void @get_struct | ||
// CHECK: [[RESULT:%[a-z_0-9]+]] = va_arg {{.*}}, %struct.Foo{{$}} | ||
// CHECK: store %struct.Foo [[RESULT]], %struct.Foo* @dest | ||
|
||
void skip_struct(va_list *args) { | ||
va_arg(*args, struct Foo); | ||
} | ||
// CHECK: define void @skip_struct | ||
// CHECK: va_arg {{.*}}, %struct.Foo{{$}} |