Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Keep source-remapped diagnostics within proven original spans

オープン
#40 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
cpp
領域
backend

調査の方向性

Start with src/Driver/SourceRemap.cpp and trace parseSourceRemap, remapInsideEntry, and the public remapSourceLocation path. Reproduce the reported schema-1 case, then inspect how standalone remaps and report, text/JSON, and package debug outputs represent provenance. Done means the requested distinctions and bounds policy are consistent across those paths, with coverage for the listed span, newline, Unicode, synthetic, and exact-map cases.

索引モデルが issue の本文から書いたものです。

説明

Problem

remapSourceLocation can return an originalLocation outside the declared original span. On dev at d43047c2a407a9bd1a90f21d1df0dd94507a698d, remapInsideEntry translates offsets and line/column deltas without checking the original bounds or mapping fidelity.

This affects repository porting generally. CrossTL emits file-level provenance when a translation does not preserve source lines. Treating that association as an affine byte mapping produces false diagnostic locations, particularly for generated helpers. The defect was found while reviewing MLX translation evidence, but the reproducer has no MLX dependency.

Reproduction

Parse this schema-1 document with parseSourceRemap:

{
  "schemaVersion": 1,
  "generatedFile": "generated.cgl",
  "mappings": [{
    "generated": {"file":"generated.cgl","line":1,"column":1,"offset":0,"length":100,"endLine":1,"endColumn":101,"endOffset":100},
    "original": {"file":"original.metal","line":1,"column":1,"offset":0,"length":10,"endLine":1,"endColumn":11,"endOffset":10}
  }]
}

Call remapSourceLocation with SourceLocation{"generated.cgl", 1, 81, 80, 5, 1, 86, 85}. Parsing succeeds without diagnostics. The result is original.metal, offsets 80:85, columns 81:86, even though the entire original span is 0:10, columns 1:11.

Reproduced locally with both the existing compiler library and a fresh compilation of src/Driver/SourceRemap.cpp from the stated commit linked to the library's support code. The source reducer calls the public parser and remapper directly.

Requested Contract

  • Never produce a remapped diagnostic outside its original span. Preserve the generated location when correspondence is not established; clamping to the original end is not an accurate fix.
  • Distinguish exact diagnostic correspondence from coarse file provenance, heuristic candidates, synthetic code and unmapped code. Specify how standalone sidecars carry that distinction, since schema 1 has no granularity field.
  • Apply the same policy to standalone remaps, report metadata, text/JSON diagnostics and package debug metadata. Preserve provenance without presenting it as an exact originalLocation.
  • Retain compatibility for valid exact schema-1 maps. Document behavior for legacy unequal spans rather than assuming equal span length proves semantic correspondence.
  • Cover shorter original spans, multiline expansion, newline normalization, Unicode byte offsets, synthetic helpers and unchanged exact mappings.

Related tracking: #27. Translator-side defect: CrossGL/crosstl#2131. CrossTL is correcting its guessed line mappings independently; compiler release availability is not required for that correction.

主要言語
C++
スター
0
フォーク
0
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

CrossGL/compiler のほかの issue

CrossGL/compiler の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。