blocks: Support capturing complex variable in block.
// rdar://10033896 llvm-svn: 139041
This commit is contained in:
parent
a216debb37
commit
2bb8270e6f
|
@ -119,6 +119,7 @@ public:
|
|||
|
||||
// l-values.
|
||||
ComplexPairTy VisitDeclRefExpr(const Expr *E) { return EmitLoadOfLValue(E); }
|
||||
ComplexPairTy VisitBlockDeclRefExpr(const Expr *E) { return EmitLoadOfLValue(E); }
|
||||
ComplexPairTy VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) {
|
||||
return EmitLoadOfLValue(E);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
// RUN: %clang_cc1 %s -emit-llvm -o - -fblocks -triple x86_64-apple-darwin10 | FileCheck %s
|
||||
// rdar://10033986
|
||||
|
||||
typedef void (^BLOCK)(void);
|
||||
int main ()
|
||||
{
|
||||
_Complex double c;
|
||||
BLOCK b = ^() {
|
||||
_Complex double z;
|
||||
z = z + c;
|
||||
};
|
||||
b();
|
||||
}
|
||||
|
||||
// CHECK: define internal void @__main_block_invoke_0
|
||||
// CHECK: [[C1:%.*]] = alloca { double, double }, align 8
|
||||
// CHECK: [[C1]].realp = getelementptr inbounds { double, double }* [[C1]], i32 0, i32 0
|
||||
// CHECK-NEXT: [[C1]].real = load double* [[C1]].realp
|
||||
// CHECK-NEXT: [[C1]].imagp = getelementptr inbounds { double, double }* [[C1]], i32 0, i32 1
|
||||
// CHECK-NEXT: [[C1]].imag = load double* [[C1]].imagp
|
Loading…
Reference in New Issue