[cfe-commits] r97863 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/Sema/block-byref-args.c
Fariborz Jahanian
fjahanian at apple.com
Fri Mar 5 17:58:53 PST 2010
Author: fjahanian
Date: Fri Mar 5 19:58:53 2010
New Revision: 97863
URL: http://llvm.org/viewvc/llvm-project?rev=97863&view=rev
Log:
Allow use of byref (__block attributed) arrays inside
the block. Fixes radar 7671883.
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/Sema/block-byref-args.c
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=97863&r1=97862&r2=97863&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Fri Mar 5 19:58:53 2010
@@ -1691,7 +1691,7 @@
return ExprError();
}
- if (VD->getType()->isArrayType()) {
+ if (VD->getType()->isArrayType() && !VD->hasAttr<BlocksAttr>()) {
Diag(Loc, diag::err_ref_array_type);
Diag(D->getLocation(), diag::note_declared_at);
return ExprError();
Modified: cfe/trunk/test/Sema/block-byref-args.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/block-byref-args.c?rev=97863&r1=97862&r2=97863&view=diff
==============================================================================
--- cfe/trunk/test/Sema/block-byref-args.c (original)
+++ cfe/trunk/test/Sema/block-byref-args.c Fri Mar 5 19:58:53 2010
@@ -13,6 +13,10 @@
int (^XXX)(void) = ^{ return III+JJJJ; };
+ // rdar 7671883
+ __block char array[10] = {'a', 'b', 'c', 'd'};
+ char (^ch)() = ^{ array[1] = 'X'; return array[5]; };
+ ch();
+
return 0;
}
-
More information about the cfe-commits
mailing list