[cfe-commits] r139041 - in /cfe/trunk: lib/CodeGen/CGExprComplex.cpp test/CodeGen/capture-complex-expr-in-block.c
jahanian
fjahanian at apple.com
Fri Sep 2 14:42:57 PDT 2011
On Sep 2, 2011, at 2:41 PM, Eli Friedman wrote:
> On Fri, Sep 2, 2011 at 2:33 PM, Fariborz Jahanian <fjahanian at apple.com> wrote:
>> Author: fjahanian
>> Date: Fri Sep 2 16:33:44 2011
>> New Revision: 139041
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=139041&view=rev
>> Log:
>> blocks: Support capturing complex variable in block.
>> // rdar://10033896
>>
>> Added:
>> cfe/trunk/test/CodeGen/capture-complex-expr-in-block.c
>> Modified:
>> cfe/trunk/lib/CodeGen/CGExprComplex.cpp
>>
>> Modified: cfe/trunk/lib/CodeGen/CGExprComplex.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprComplex.cpp?rev=139041&r1=139040&r2=139041&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/CodeGen/CGExprComplex.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGExprComplex.cpp Fri Sep 2 16:33:44 2011
>> @@ -119,6 +119,7 @@
>>
>> // 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);
>> }
>>
>> Added: cfe/trunk/test/CodeGen/capture-complex-expr-in-block.c
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/capture-complex-expr-in-block.c?rev=139041&view=auto
>> ==============================================================================
>> --- cfe/trunk/test/CodeGen/capture-complex-expr-in-block.c (added)
>> +++ cfe/trunk/test/CodeGen/capture-complex-expr-in-block.c Fri Sep 2 16:33:44 2011
>> @@ -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
>
> These checks will fail on a Release build.
Thanks for forewarning me (I noticed they failed before). I will take a look.
- Fariborz
>
> -Eli
More information about the cfe-commits
mailing list