x86_64-arguments.cpp revision 117e3f4cd4d6ea41c3202da8729f94168c5c8239
1// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s 2 3// Basic base class test. 4struct f0_s0 { unsigned a; }; 5struct f0_s1 : public f0_s0 { void *b; }; 6// CHECK: define void @_Z2f05f0_s1(i64 %a0.coerce0, i8* %a0.coerce1) 7void f0(f0_s1 a0) { } 8 9// Check with two eight-bytes in base class. 10struct f1_s0 { unsigned a; unsigned b; float c; }; 11struct f1_s1 : public f1_s0 { float d;}; 12// CHECK: define void @_Z2f15f1_s1(i64 %a0.coerce0, double %a0.coerce1) 13void f1(f1_s1 a0) { } 14 15// Check with two eight-bytes in base class and merge. 16struct f2_s0 { unsigned a; unsigned b; float c; }; 17struct f2_s1 : public f2_s0 { char d;}; 18// CHECK: define void @_Z2f25f2_s1(i64 %a0.coerce0, i64 %a0.coerce1) 19void f2(f2_s1 a0) { } 20 21// PR5831 22// CHECK: define void @_Z2f34s3_1(i64 %x.coerce) 23struct s3_0 {}; 24struct s3_1 { struct s3_0 a; long b; }; 25void f3(struct s3_1 x) {} 26 27// CHECK: define i64 @_Z4f4_0M2s4i(i64 %a) 28// CHECK: define {{.*}} @_Z4f4_1M2s4FivE(i64 %a.coerce0, i64 %a.coerce1) 29struct s4 {}; 30typedef int s4::* s4_mdp; 31typedef int (s4::*s4_mfp)(); 32s4_mdp f4_0(s4_mdp a) { return a; } 33s4_mfp f4_1(s4_mfp a) { return a; } 34 35 36namespace PR7523 { 37struct StringRef { 38 char *a; 39}; 40 41void AddKeyword(StringRef, int x); 42 43void foo() { 44 // CHECK: define void @_ZN6PR75233fooEv() 45 // CHECK: call void @_ZN6PR752310AddKeywordENS_9StringRefEi(i8* {{.*}}, i32 4) 46 AddKeyword(StringRef(), 4); 47} 48} 49 50namespace PR7742 { // Also rdar://8250764 51 struct s2 { 52 float a[2]; 53 }; 54 55 struct c2 : public s2 {}; 56 57 // CHECK: define double @_ZN6PR77423fooEPNS_2c2E(%"struct.PR7742::c2"* %P) 58 c2 foo(c2 *P) { 59 } 60 61} 62 63namespace PR5179 { 64 struct B {}; 65 66 struct B1 : B { 67 int* pa; 68 }; 69 70 struct B2 : B { 71 B1 b1; 72 }; 73 74 // CHECK: define i8* @_ZN6PR51793barENS_2B2E(i32* %b2.coerce) 75 const void *bar(B2 b2) { 76 return b2.b1.pa; 77 } 78} 79