C++: Simplify noThrowInTryBlock.

This commit is contained in:
Mathias Vorreiter Pedersen
2021-05-06 18:36:09 +02:00
parent 7c1720a1d1
commit 856d512aa6

View File

@@ -182,9 +182,7 @@ class BadAllocCatchBlock extends CatchBlock {
*/
predicate noThrowInTryBlock(NewOrNewArrayExpr newExpr, BadAllocCatchBlock catchBlock) {
exists(TryStmt try |
forall(Expr cand | cand.getEnclosingBlock().getEnclosingBlock*() = try.getStmt() |
not convertedExprMayThrow(cand)
) and
not stmtMayThrow(try.getStmt()) and
try.getACatchClause() = catchBlock and
newExpr.getEnclosingBlock().getEnclosingBlock*() = try.getStmt()
)