aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2009-04-30 00:19:40 +0000
committerMike Stump <mrs@apple.com>2009-04-30 00:19:40 +0000
commitea000bf621552252e41fc870346e7048646709dc (patch)
treee002bf02ee376eeeb2daef607bdae9a8518b5882 /lib/Sema/SemaDecl.cpp
parent6e9b8f6d571a6b5c6bdb3d0c0576fb47fbe5a03d (diff)
Sema checking for incorrect placement of __block. Radar 6441502
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70452 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r--lib/Sema/SemaDecl.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 4d6a103ccd..9e2bd444f8 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/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));
}
-