1f5c3a2521972e9d70d0ec5450cc65472d63ec89fTim Northover// RUN: %clang_cc1 -triple armv7-apple-ios -x c++ -emit-llvm -o - %s | FileCheck %s 2651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines// RUN: %clang_cc1 -triple arm64-apple-ios -x c++ -emit-llvm -o - %s | FileCheck %s 3f5c3a2521972e9d70d0ec5450cc65472d63ec89fTim Northover 4f5c3a2521972e9d70d0ec5450cc65472d63ec89fTim Northover// According to the Itanium ABI (3.1.1), types with non-trivial copy 5f5c3a2521972e9d70d0ec5450cc65472d63ec89fTim Northover// constructors passed by value should be passed indirectly, with the caller 6f5c3a2521972e9d70d0ec5450cc65472d63ec89fTim Northover// creating a temporary. 7f5c3a2521972e9d70d0ec5450cc65472d63ec89fTim Northover 8f5c3a2521972e9d70d0ec5450cc65472d63ec89fTim Northoverstruct Empty; 9f5c3a2521972e9d70d0ec5450cc65472d63ec89fTim Northover 10f5c3a2521972e9d70d0ec5450cc65472d63ec89fTim Northoverstruct Empty { 11f5c3a2521972e9d70d0ec5450cc65472d63ec89fTim Northover Empty(const Empty &e); 12f5c3a2521972e9d70d0ec5450cc65472d63ec89fTim Northover bool check(); 13f5c3a2521972e9d70d0ec5450cc65472d63ec89fTim Northover}; 14f5c3a2521972e9d70d0ec5450cc65472d63ec89fTim Northover 15f5c3a2521972e9d70d0ec5450cc65472d63ec89fTim Northoverbool foo(Empty e) { 16f5c3a2521972e9d70d0ec5450cc65472d63ec89fTim Northover// CHECK: @_Z3foo5Empty(%struct.Empty* %e) 17f5c3a2521972e9d70d0ec5450cc65472d63ec89fTim Northover// CHECK: call {{.*}} @_ZN5Empty5checkEv(%struct.Empty* %e) 18f5c3a2521972e9d70d0ec5450cc65472d63ec89fTim Northover return e.check(); 19f5c3a2521972e9d70d0ec5450cc65472d63ec89fTim Northover} 20f5c3a2521972e9d70d0ec5450cc65472d63ec89fTim Northover 21f5c3a2521972e9d70d0ec5450cc65472d63ec89fTim Northovervoid caller(Empty &e) { 22ef8225444452a1486bd721f3285301fe84643b00Stephen Hines// CHECK: @_Z6callerR5Empty(%struct.Empty* nonnull %e) 23f5c3a2521972e9d70d0ec5450cc65472d63ec89fTim Northover// CHECK: call {{.*}} @_ZN5EmptyC1ERKS_(%struct.Empty* [[NEWTMP:%.*]], %struct.Empty* 24f5c3a2521972e9d70d0ec5450cc65472d63ec89fTim Northover// CHECK: call {{.*}} @_Z3foo5Empty(%struct.Empty* [[NEWTMP]]) 25f5c3a2521972e9d70d0ec5450cc65472d63ec89fTim Northover foo(e); 26f5c3a2521972e9d70d0ec5450cc65472d63ec89fTim Northover} 27