1 // RUN: %clang_cc1 -triple i386-unknown-unknown -fblocks -emit-llvm %s -o - | FileCheck %s
3 // CHECK: %[[STRUCT_A:.*]] = type { i8 }
13 // CHECK: call void asm
14 asm("" : : "r"(foo(a
)) );
15 // CHECK: call void @_ZN1AD1Ev
18 namespace TestTemplate
{
19 // Check that the temporary is destructed after the first asm statement.
21 // CHECK: define {{.*}}void @_ZN12TestTemplate4foo0IvEEvR1A(
22 // CHECK: %[[AGG_TMP:.*]] = alloca %[[STRUCT_A]],
23 // CHECK: %[[CALL:.*]] = call noundef i32 @_Z3foo1A({{.*}}%[[AGG_TMP]])
24 // CHECK: call void asm sideeffect "", "r,~{dirflag},~{fpsr},~{flags}"(i32 %[[CALL]])
25 // CHECK: call void @_ZN1AD1Ev({{.*}}%[[AGG_TMP]])
26 // CHECK: call void asm sideeffect "",
30 asm("" : : "r"(foo(a
)) );
34 void test0(A
&a
) { foo0
<void>(a
); }
36 // Check that the block capture is destructed at the end of the enclosing scope.
38 // CHECK: define {{.*}}void @_ZN12TestTemplate4foo1IvEEv1A(
39 // CHECK: %[[BLOCK:.*]] = alloca <{ ptr, i32, i32, ptr, ptr, %[[STRUCT_A]] }>, align 4
40 // CHECK: %[[BLOCK_CAPTURED:.*]] = getelementptr inbounds nuw <{ ptr, i32, i32, ptr, ptr, %[[STRUCT_A]] }>, ptr %[[BLOCK]], i32 0, i32 5
41 // CHECK: call void asm sideeffect "", "r,~{dirflag},~{fpsr},~{flags}"(i32 %{{.*}})
42 // CHECK: call void asm sideeffect "", "~{dirflag},~{fpsr},~{flags}"()
43 // CHECK: call void @_ZN1AD1Ev({{.*}} %[[BLOCK_CAPTURED]])
47 asm("" : : "r"(^{ (void)a
; return 0; }()));
51 void test1(A
&a
) { foo1
<void>(a
); }
52 } // namespace TestTemplate