[cfe-commits] r98693 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/Sema/block-byref-args.c test/Sema/block-misc.c
Fariborz Jahanian
fjahanian at apple.com
Tue Mar 16 16:39:51 PDT 2010
Author: fjahanian
Date: Tue Mar 16 18:39:51 2010
New Revision: 98693
URL: http://llvm.org/viewvc/llvm-project?rev=98693&view=rev
Log:
Issue error when a byref array is accessed in a block
literal. Fixes radar 7760213.
Removed:
cfe/trunk/test/Sema/block-byref-args.c
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/Sema/block-misc.c
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=98693&r1=98692&r2=98693&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Mar 16 18:39:51 2010
@@ -1691,7 +1691,7 @@
return ExprError();
}
- if (VD->getType()->isArrayType() && !VD->hasAttr<BlocksAttr>()) {
+ if (VD->getType()->isArrayType()) {
Diag(Loc, diag::err_ref_array_type);
Diag(D->getLocation(), diag::note_declared_at);
return ExprError();
Removed: cfe/trunk/test/Sema/block-byref-args.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/block-byref-args.c?rev=98692&view=auto
==============================================================================
--- cfe/trunk/test/Sema/block-byref-args.c (original)
+++ cfe/trunk/test/Sema/block-byref-args.c (removed)
@@ -1,22 +0,0 @@
-// RUN: %clang_cc1 %s -fsyntax-only -verify -fblocks
-
-int printf(const char *, ...);
-
-int main(int argc, char **argv) {
- __block void(*bobTheFunction)(void);
- __block void(^bobTheBlock)(void);
-
- bobTheBlock = ^{;};
-
- __block int JJJJ;
- __attribute__((__blocks__(byref))) int III;
-
- 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;
-}
Modified: cfe/trunk/test/Sema/block-misc.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/block-misc.c?rev=98693&r1=98692&r2=98693&view=diff
==============================================================================
--- cfe/trunk/test/Sema/block-misc.c (original)
+++ cfe/trunk/test/Sema/block-misc.c Tue Mar 16 18:39:51 2010
@@ -214,8 +214,10 @@
// radr://7438948
void test21() {
int a[7]; // expected-note {{declared at}}
+ __block int b[10]; // expected-note {{declared at}}
a[1] = 1;
^{
(void)a[1]; // expected-error {{cannot refer to declaration with an array type inside block}}
+ (void)b[1]; // expected-error {{cannot refer to declaration with an array type inside block}}
}();
}
More information about the cfe-commits
mailing list