Fix for-loops opening branches without a full header
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
a88a57e2ec
commit
6ed38077c6
@ -121,7 +121,7 @@ bool OperationFinderAstVisitor::dataTraverseStmtPost(clang::Stmt* stmt)
|
|||||||
clang::Stmt* OperationFinderAstVisitor::_isBranchEntry(clang::Stmt* stmt)
|
clang::Stmt* OperationFinderAstVisitor::_isBranchEntry(clang::Stmt* stmt)
|
||||||
{
|
{
|
||||||
if (auto* loop = clang::dyn_cast<clang::ForStmt>(stmt);
|
if (auto* loop = clang::dyn_cast<clang::ForStmt>(stmt);
|
||||||
loop && loop->getInit())
|
loop && loop->getInit() && (loop->getInc() || loop->getCond()))
|
||||||
{
|
{
|
||||||
_loop_header.init = loop->getInit();
|
_loop_header.init = loop->getInit();
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ TEST_CASE("For loop with init only.", "[branches][for_loops]")
|
|||||||
|
|
||||||
const OperationLog& log = operations.front();
|
const OperationLog& log = operations.front();
|
||||||
|
|
||||||
REQUIRE(log.branch_number == 1);
|
REQUIRE(log.branch_number == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user