1// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck %s
2
3// rdar://7309675
4// PR4678
5namespace test0 {
6  // test1 should be compmiled to be a varargs function in the IR even
7  // though there is no way to do a va_begin.  Otherwise, the optimizer
8  // will warn about 'dropped arguments' at the call site.
9
10  // CHECK-LABEL: define i32 @_ZN5test05test1Ez(...)
11  int test1(...) {
12    return -1;
13  }
14
15  // CHECK: call i32 (...)* @_ZN5test05test1Ez(i32 0)
16  void test() {
17    test1(0);
18  }
19}
20
21namespace test1 {
22  struct A {
23    int x;
24    int y;
25  };
26
27  void foo(...);
28
29  void test() {
30    A x;
31    foo(x);
32  }
33  // CHECK-LABEL:    define void @_ZN5test14testEv()
34  // CHECK:      [[X:%.*]] = alloca [[A:%.*]], align 4
35  // CHECK-NEXT: [[TMP:%.*]] = alloca [[A]], align 4
36  // CHECK-NEXT: [[T0:%.*]] = bitcast [[A]]* [[TMP]] to i8*
37  // CHECK-NEXT: [[T1:%.*]] = bitcast [[A]]* [[X]] to i8*
38  // CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[T0]], i8* [[T1]], i64 8, i32 4, i1 false)
39  // CHECK-NEXT: [[T0:%.*]] = bitcast [[A]]* [[TMP]] to i64*
40  // CHECK-NEXT: [[T1:%.*]] = load i64* [[T0]], align 1
41  // CHECK-NEXT: call void (...)* @_ZN5test13fooEz(i64 [[T1]])
42  // CHECK-NEXT: ret void
43}
44