diff options
author | Chris Lattner <sabre@nondot.org> | 2009-07-19 20:17:11 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-07-19 20:17:11 +0000 |
commit | 9662cd32276053c5843f98b1e61807be5dc850ab (patch) | |
tree | c65eb4b870934a00902ec45e6be62619d36fa54b /clang/lib | |
parent | be853b7b5d170b02ce9f10c76d268f0983444418 (diff) | |
download | bcm5719-llvm-9662cd32276053c5843f98b1e61807be5dc850ab.tar.gz bcm5719-llvm-9662cd32276053c5843f98b1e61807be5dc850ab.zip |
enhance the goto checker to reject jumps across __block variable definitions.
llvm-svn: 76376
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Sema/JumpDiagnostics.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Sema/JumpDiagnostics.cpp b/clang/lib/Sema/JumpDiagnostics.cpp index ae863f2df1e..853adaa3368 100644 --- a/clang/lib/Sema/JumpDiagnostics.cpp +++ b/clang/lib/Sema/JumpDiagnostics.cpp @@ -83,6 +83,8 @@ static unsigned GetDiagForGotoScopeDecl(const Decl *D) { return diag::note_protected_by_vla; if (VD->hasAttr<CleanupAttr>()) return diag::note_protected_by_cleanup; + if (VD->hasAttr<BlocksAttr>()) + return diag::note_protected_by___block; } else if (const TypedefDecl *TD = dyn_cast<TypedefDecl>(D)) { if (TD->getUnderlyingType()->isVariablyModifiedType()) return diag::note_protected_by_vla_typedef; diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index bc497aa1421..28ac9d1982a 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -1954,7 +1954,8 @@ void Sema::CheckVariableDeclaration(VarDecl *NewVD, NamedDecl *PrevDecl, Diag(NewVD->getLocation(), diag::warn_attribute_weak_on_local); bool isVM = T->isVariablyModifiedType(); - if (isVM || NewVD->hasAttr<CleanupAttr>()) + if (isVM || NewVD->hasAttr<CleanupAttr>() || + NewVD->hasAttr<BlocksAttr>()) CurFunctionNeedsScopeChecking = true; if ((isVM && NewVD->hasLinkage()) || |