xref: /llvm-project/clang/test/CodeGenObjC/asm.m (revision 94473f4db6a6f5f12d7c4081455b5b596094eac5)
1// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fblocks -fobjc-arc -emit-llvm -o - %s | FileCheck %s
2
3// CHECK: %[[STRUCT_A:.*]] = type { ptr }
4
5typedef struct {
6  id f;
7} A;
8
9id a;
10
11// Check that the compound literal is destructed at the end of the enclosing scope.
12
13// CHECK-LABEL: define void @foo0()
14// CHECK: %[[_COMPOUNDLITERAL:.*]] = alloca %[[STRUCT_A]], align 8
15// CHECK: getelementptr inbounds nuw %[[STRUCT_A]], ptr %[[_COMPOUNDLITERAL]], i32 0, i32 0
16// CHECK: %[[F1:.*]] = getelementptr inbounds nuw %[[STRUCT_A]], ptr %[[_COMPOUNDLITERAL]], i32 0, i32 0
17// CHECK: %[[V2:.*]] = load ptr, ptr %[[F1]], align 8
18// CHECK: call void asm sideeffect "", "r,~{dirflag},~{fpsr},~{flags}"(ptr %[[V2]])
19// CHECK: call void asm sideeffect "",
20// CHECK: call void @__destructor_8_s0(ptr %[[_COMPOUNDLITERAL]])
21
22void foo0() {
23  asm("" : : "r"(((A){a}).f) );
24  asm("");
25}
26