xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/empty-nontrivially-copyable.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple armv7-apple-ios -x c++ -emit-llvm -o - %s | FileCheck %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc // According to the Itanium ABI (3.1.1), types with non-trivial copy
4*f4a2713aSLionel Sambuc // constructors passed by value should be passed indirectly, with the caller
5*f4a2713aSLionel Sambuc // creating a temporary.
6*f4a2713aSLionel Sambuc 
7*f4a2713aSLionel Sambuc struct Empty;
8*f4a2713aSLionel Sambuc 
9*f4a2713aSLionel Sambuc struct Empty {
10*f4a2713aSLionel Sambuc   Empty(const Empty &e);
11*f4a2713aSLionel Sambuc   bool check();
12*f4a2713aSLionel Sambuc };
13*f4a2713aSLionel Sambuc 
14*f4a2713aSLionel Sambuc bool foo(Empty e) {
15*f4a2713aSLionel Sambuc // CHECK: @_Z3foo5Empty(%struct.Empty* %e)
16*f4a2713aSLionel Sambuc // CHECK: call {{.*}} @_ZN5Empty5checkEv(%struct.Empty* %e)
17*f4a2713aSLionel Sambuc   return e.check();
18*f4a2713aSLionel Sambuc }
19*f4a2713aSLionel Sambuc 
20*f4a2713aSLionel Sambuc void caller(Empty &e) {
21*f4a2713aSLionel Sambuc // CHECK: @_Z6callerR5Empty(%struct.Empty* %e)
22*f4a2713aSLionel Sambuc // CHECK: call {{.*}} @_ZN5EmptyC1ERKS_(%struct.Empty* [[NEWTMP:%.*]], %struct.Empty*
23*f4a2713aSLionel Sambuc // CHECK: call {{.*}} @_Z3foo5Empty(%struct.Empty* [[NEWTMP]])
24*f4a2713aSLionel Sambuc   foo(e);
25*f4a2713aSLionel Sambuc }
26