[cfe-commits] r70601 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaDecl.cpp test/Sema/block-misc.c
Mike Stump
mrs at apple.com
Fri May 1 16:41:48 PDT 2009
Author: mrs
Date: Fri May 1 18:41:47 2009
New Revision: 70601
URL: http://llvm.org/viewvc/llvm-project?rev=70601&view=rev
Log:
Add Sema checking for __block on vm declarations. Radar 6441502
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/Sema/block-misc.c
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=70601&r1=70600&r2=70601&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri May 1 18:41:47 2009
@@ -1625,6 +1625,8 @@
"block declared 'noreturn' should not return">;
def err_block_on_nonlocal : Error<
"__block attribute not allowed, only allowed on local variables">;
+def err_block_on_vm : Error<
+ "__block attribute not allowed on declaration with a variably modified type">;
def err_shufflevector_non_vector : Error<
"first two arguments to __builtin_shufflevector must be vectors">;
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=70601&r1=70600&r2=70601&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri May 1 18:41:47 2009
@@ -1916,6 +1916,11 @@
return NewVD->setInvalidDecl();
}
+ if (isVM && NewVD->hasAttr<BlocksAttr>()) {
+ Diag(NewVD->getLocation(), diag::err_block_on_vm);
+ return NewVD->setInvalidDecl();
+ }
+
if (PrevDecl) {
Redeclaration = true;
MergeVarDecl(NewVD, PrevDecl);
Modified: cfe/trunk/test/Sema/block-misc.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/block-misc.c?rev=70601&r1=70600&r2=70601&view=diff
==============================================================================
--- cfe/trunk/test/Sema/block-misc.c (original)
+++ cfe/trunk/test/Sema/block-misc.c Fri May 1 18:41:47 2009
@@ -150,7 +150,9 @@
__block int test16i; // expected-error {{__block attribute not allowed, only allowed on local variables}}
void test16(__block int i) { // expected-error {{__block attribute not allowed, only allowed on local variables}}
+ int size = 5;
extern __block double extern_var; // expected-error {{__block attribute not allowed, only allowed on local variables}}
static __block char * pch; // expected-error {{__block attribute not allowed, only allowed on local variables}}
+ __block int a[size]; // expected-error {{__block attribute not allowed on declaration with a variably modified type}}
+ __block int (*ap)[size]; // expected-error {{__block attribute not allowed on declaration with a variably modified type}}
}
-
More information about the cfe-commits
mailing list