Sanitize debug source location tracking for implicit branch and return

This patch tries to attach debug location of a branch/return instruction to its predecessor or the closing brace. If none could be found, no debug info should be emitted.
This commit is contained in:
Qingyuan Zheng 2024-08-26 03:53:07 +00:00 committed by arcady-lunarg
parent b1fac200c4
commit a496a34b43
30 changed files with 4713 additions and 4253 deletions

View file

@ -3773,8 +3773,10 @@ compound_statement
--parseContext.statementNestingLevel;
}
RIGHT_BRACE {
if ($3 && $3->getAsAggregate())
if ($3 && $3->getAsAggregate()) {
$3->getAsAggregate()->setOperator(parseContext.intermediate.getDebugInfo() ? EOpScope : EOpSequence);
$3->getAsAggregate()->setEndLoc($5.loc);
}
$$ = $3;
}
;
@ -3810,8 +3812,10 @@ compound_statement_no_new_scope
$$ = 0;
}
| LEFT_BRACE statement_list RIGHT_BRACE {
if ($2 && $2->getAsAggregate())
if ($2 && $2->getAsAggregate()) {
$2->getAsAggregate()->setOperator(EOpSequence);
$2->getAsAggregate()->setEndLoc($3.loc);
}
$$ = $2;
}
;

File diff suppressed because it is too large Load diff