summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/JumpDiagnostics.cpp
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@apple.com>2017-04-19 17:54:08 +0000
committerAkira Hatanaka <ahatanaka@apple.com>2017-04-19 17:54:08 +0000
commit3901377c229725a0d04a9971a1a0e945afb8286e (patch)
tree4e24f0ea7043887046769a25d3e247f1c7573a95 /clang/lib/Sema/JumpDiagnostics.cpp
parente25268de9d957a9aef7aa623fb81a71f19d224c1 (diff)
downloadbcm5719-llvm-3901377c229725a0d04a9971a1a0e945afb8286e.tar.gz
bcm5719-llvm-3901377c229725a0d04a9971a1a0e945afb8286e.zip
[Sema][ObjC] Disallow jumping into ObjC fast enumeration loops.
rdar://problem/31635406 Differential Revision: https://reviews.llvm.org/D32187 llvm-svn: 300722
Diffstat (limited to 'clang/lib/Sema/JumpDiagnostics.cpp')
-rw-r--r--clang/lib/Sema/JumpDiagnostics.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/Sema/JumpDiagnostics.cpp b/clang/lib/Sema/JumpDiagnostics.cpp
index 899d3fa83cc..865aea9e228 100644
--- a/clang/lib/Sema/JumpDiagnostics.cpp
+++ b/clang/lib/Sema/JumpDiagnostics.cpp
@@ -287,6 +287,15 @@ void JumpScopeChecker::BuildScopeInformation(Stmt *S,
IndirectJumpTargets.push_back(cast<AddrLabelExpr>(S)->getLabel());
break;
+ case Stmt::ObjCForCollectionStmtClass: {
+ auto *CS = cast<ObjCForCollectionStmt>(S);
+ unsigned Diag = diag::note_protected_by_objc_fast_enumeration;
+ unsigned NewParentScope = Scopes.size();
+ Scopes.push_back(GotoScope(ParentScope, Diag, 0, S->getLocStart()));
+ BuildScopeInformation(CS->getBody(), NewParentScope);
+ return;
+ }
+
case Stmt::IndirectGotoStmtClass:
// "goto *&&lbl;" is a special case which we treat as equivalent
// to a normal goto. In addition, we don't calculate scope in the
OpenPOWER on IntegriCloud