зеркало из https://github.com/microsoft/clang-1.git
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). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69165 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
9faf50e62d
Коммит
b25ddfb155
|
@ -2935,13 +2935,13 @@ void Sema::RecursiveCalcLabelScopes(llvm::DenseMap<Stmt*, void*>& LabelScopeMap,
|
||||||
Stmt* CurCompound = isa<CompoundStmt>(*i) ? *i : ParentCompoundStmt;
|
Stmt* CurCompound = isa<CompoundStmt>(*i) ? *i : ParentCompoundStmt;
|
||||||
RecursiveCalcLabelScopes(LabelScopeMap, PopScopeMap, ScopeStack,
|
RecursiveCalcLabelScopes(LabelScopeMap, PopScopeMap, ScopeStack,
|
||||||
*i, CurCompound);
|
*i, CurCompound);
|
||||||
}
|
|
||||||
|
|
||||||
while (ScopeStack.size() && PopScopeMap[ScopeStack.back()] == CurStmt) {
|
while (ScopeStack.size() && PopScopeMap[ScopeStack.back()] == CurStmt) {
|
||||||
ScopeStack.pop_back();
|
ScopeStack.pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void Sema::RecursiveCalcJumpScopes(llvm::DenseMap<Stmt*, void*>& LabelScopeMap,
|
void Sema::RecursiveCalcJumpScopes(llvm::DenseMap<Stmt*, void*>& LabelScopeMap,
|
||||||
llvm::DenseMap<void*, Stmt*>& PopScopeMap,
|
llvm::DenseMap<void*, Stmt*>& PopScopeMap,
|
||||||
llvm::DenseMap<Stmt*, void*>& GotoScopeMap,
|
llvm::DenseMap<Stmt*, void*>& GotoScopeMap,
|
||||||
|
@ -2970,12 +2970,11 @@ void Sema::RecursiveCalcJumpScopes(llvm::DenseMap<Stmt*, void*>& LabelScopeMap,
|
||||||
if (isa<DeclStmt>(*i)) continue;
|
if (isa<DeclStmt>(*i)) continue;
|
||||||
RecursiveCalcJumpScopes(LabelScopeMap, PopScopeMap, GotoScopeMap,
|
RecursiveCalcJumpScopes(LabelScopeMap, PopScopeMap, GotoScopeMap,
|
||||||
ScopeStack, *i);
|
ScopeStack, *i);
|
||||||
}
|
|
||||||
|
|
||||||
while (ScopeStack.size() && PopScopeMap[ScopeStack.back()] == CurStmt) {
|
while (ScopeStack.size() && PopScopeMap[ScopeStack.back()] == CurStmt) {
|
||||||
ScopeStack.pop_back();
|
ScopeStack.pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Sema::DeclPtrTy Sema::ActOnFinishFunctionBody(DeclPtrTy D, StmtArg BodyArg) {
|
Sema::DeclPtrTy Sema::ActOnFinishFunctionBody(DeclPtrTy D, StmtArg BodyArg) {
|
||||||
Decl *dcl = D.getAs<Decl>();
|
Decl *dcl = D.getAs<Decl>();
|
||||||
|
|
|
@ -16,3 +16,11 @@ L2: ;
|
||||||
L3: ;
|
L3: ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void f0(int a) {
|
||||||
|
if (a) goto L0;
|
||||||
|
@try {} @finally {}
|
||||||
|
L0:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче