[cfe-commits] r69165 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/SemaObjC/scope-check-try-catch.m
Steve Naroff
snaroff at apple.com
Wed Apr 15 07:38:36 PDT 2009
Author: snaroff
Date: Wed Apr 15 09:38:36 2009
New Revision: 69165
URL: http://llvm.org/viewvc/llvm-project?rev=69165&view=rev
Log:
Fix <rdar://problem/6791490> [clang10 regression] [sema] invalid illegal jump diagnostic.
caused by: <rdar://problem/6252084> [sema] jumps into Obj-C exception blocks should be disallowed.
Sema::RecursiveCalcLabelScopes() and Sema::RecursiveCalcJumpScopes() need to pop the ScopeStack within the statement iteration loop (was outside the loop).
Eli, please review (thanks).
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/SemaObjC/scope-check-try-catch.m
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=69165&r1=69164&r2=69165&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Apr 15 09:38:36 2009
@@ -2935,11 +2935,11 @@
Stmt* CurCompound = isa<CompoundStmt>(*i) ? *i : ParentCompoundStmt;
RecursiveCalcLabelScopes(LabelScopeMap, PopScopeMap, ScopeStack,
*i, CurCompound);
+ while (ScopeStack.size() && PopScopeMap[ScopeStack.back()] == CurStmt) {
+ ScopeStack.pop_back();
+ }
}
- while (ScopeStack.size() && PopScopeMap[ScopeStack.back()] == CurStmt) {
- ScopeStack.pop_back();
- }
}
void Sema::RecursiveCalcJumpScopes(llvm::DenseMap<Stmt*, void*>& LabelScopeMap,
@@ -2970,10 +2970,9 @@
if (isa<DeclStmt>(*i)) continue;
RecursiveCalcJumpScopes(LabelScopeMap, PopScopeMap, GotoScopeMap,
ScopeStack, *i);
- }
-
- while (ScopeStack.size() && PopScopeMap[ScopeStack.back()] == CurStmt) {
- ScopeStack.pop_back();
+ while (ScopeStack.size() && PopScopeMap[ScopeStack.back()] == CurStmt) {
+ ScopeStack.pop_back();
+ }
}
}
Modified: cfe/trunk/test/SemaObjC/scope-check-try-catch.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/scope-check-try-catch.m?rev=69165&r1=69164&r2=69165&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/scope-check-try-catch.m (original)
+++ cfe/trunk/test/SemaObjC/scope-check-try-catch.m Wed Apr 15 09:38:36 2009
@@ -16,3 +16,11 @@
L3: ;
}
}
+
+void f0(int a) {
+ if (a) goto L0;
+ @try {} @finally {}
+ L0:
+ return;
+}
+
More information about the cfe-commits
mailing list