diff options
author | Mike Stump <mrs@apple.com> | 2009-04-30 00:19:40 +0000 |
---|---|---|
committer | Mike Stump <mrs@apple.com> | 2009-04-30 00:19:40 +0000 |
commit | e9efa80c003e23d02d8d3bf917d30bef118f236e (patch) | |
tree | fcea44b3c158abc2f64b8efeeb6cd1db495dba70 /clang/lib | |
parent | 29405d836b29e040740bdaf80c9c7615796a22b1 (diff) | |
download | bcm5719-llvm-e9efa80c003e23d02d8d3bf917d30bef118f236e.tar.gz bcm5719-llvm-e9efa80c003e23d02d8d3bf917d30bef118f236e.zip |
Sema checking for incorrect placement of __block. Radar 6441502
llvm-svn: 70452
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 4d6a103ccd7..9e2bd444f85 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -1909,6 +1909,11 @@ void Sema::CheckVariableDeclaration(VarDecl *NewVD, NamedDecl *PrevDecl, return NewVD->setInvalidDecl(); } + if (!NewVD->hasLocalStorage() && NewVD->hasAttr<BlocksAttr>()) { + Diag(NewVD->getLocation(), diag::err_block_on_nonlocal); + return NewVD->setInvalidDecl(); + } + if (PrevDecl) { Redeclaration = true; MergeVarDecl(NewVD, PrevDecl); @@ -2818,6 +2823,10 @@ Sema::ActOnParamDeclarator(Scope *S, Declarator &D) { IdResolver.AddDecl(New); ProcessDeclAttributes(New, D); + + if (New->hasAttr<BlocksAttr>()) { + Diag(New->getLocation(), diag::err_block_on_nonlocal); + } return DeclPtrTy::make(New); } @@ -4256,4 +4265,3 @@ Sema::DeclPtrTy Sema::ActOnFileScopeAsmDecl(SourceLocation Loc, return DeclPtrTy::make(FileScopeAsmDecl::Create(Context, CurContext, Loc, AsmString)); } - |