diff options
author | Chris Lattner <sabre@nondot.org> | 2009-04-21 06:01:00 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-04-21 06:01:00 +0000 |
commit | c70dd56477016528c5f49b8618644bf8a6845f89 (patch) | |
tree | 3ee8b02f56c1621bb31b0c11d8687019d7b18a7e /clang/lib/Sema/JumpDiagnostics.cpp | |
parent | e08c43a3b0dc9ffed28e3db886a21bf89e9a0a42 (diff) | |
download | bcm5719-llvm-c70dd56477016528c5f49b8618644bf8a6845f89.tar.gz bcm5719-llvm-c70dd56477016528c5f49b8618644bf8a6845f89.zip |
add support for goto checking and @synchronized blocks,
rdar://6810106
llvm-svn: 69667
Diffstat (limited to 'clang/lib/Sema/JumpDiagnostics.cpp')
-rw-r--r-- | clang/lib/Sema/JumpDiagnostics.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/lib/Sema/JumpDiagnostics.cpp b/clang/lib/Sema/JumpDiagnostics.cpp index 82db0bbd2c3..b812f06f76b 100644 --- a/clang/lib/Sema/JumpDiagnostics.cpp +++ b/clang/lib/Sema/JumpDiagnostics.cpp @@ -168,6 +168,22 @@ void JumpScopeChecker::BuildScopeInformation(Stmt *S, unsigned ParentScope) { continue; } + // Disallow jumps into the protected statement of an @synchronized, but + // allow jumps into the object expression it protects. + if (ObjCAtSynchronizedStmt *AS = dyn_cast<ObjCAtSynchronizedStmt>(SubStmt)){ + // Recursively walk the AST for the @synchronized object expr, it is + // evaluated in the normal scope. + BuildScopeInformation(AS->getSynchExpr(), ParentScope); + + // Recursively walk the AST for the @synchronized part, protected by a new + // scope. + Scopes.push_back(GotoScope(ParentScope, + diag::note_protected_by_objc_synchronized, + AS->getAtSynchronizedLoc())); + BuildScopeInformation(AS->getSynchBody(), Scopes.size()-1); + continue; + } + // Recursively walk the AST. BuildScopeInformation(SubStmt, ParentScope); } |