================
@@ -1233,7 +1233,27 @@ bool CheckConstraints(ParseTreeAnalyzer
&&parseTreeAnalysis) {
return !context.AnyFatalError();
}
-bool ValidateLabels(SemanticsContext &context, const parser::Program &program)
{
- return CheckConstraints(LabelAnalysis(context, program));
+// Record the statements that a branch may name, for lowering to consult when
+// it records the targets of a branch. Statements are identified by source
+// position because a label is only unique within one program unit.
+static void RecordBranchTargets(
+ const ParseTreeAnalyzer &analysis, SemanticsContext &context) {
+ for (const auto &programUnit : analysis.ProgramUnits()) {
+ for (const auto &[label, info] : programUnit.targetStmts) {
+ if (info.labeledStmtClassificationSet.test(TargetStatementEnum::Branch))
{
+ context.RecordBranchTarget(info.parserCharBlock);
----------------
ergawy wrote:
Fixing position tracking for end statements fixes this issue
(https://github.com/llvm/llvm-project/pull/217842). Please let me know if I
missed anything.
https://github.com/llvm/llvm-project/pull/217220
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits