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