Write output only after successful compilation

オープン 初心者向け
#6 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
85/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
cpp
領域
build-system

調査の方向性

compiler/main.cppから始め、アセンブリの検証と最後の書き込みに対して、出力ストリームがどの時点で開かれるかを追ってください。コンパイラの既存の検証経路と、失敗の報告方法を確認してください。検証が成功するまで出力の作成を遅らせ、無効な入力では既存の出力が変更されず、コンパイルが成功した場合は期待される出力が書き込まれることを確認してください。

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

説明

bug copilot enhancement

Summary

The compiler opens the output file before it has finished validating the assembly and before it knows whether the program is valid.

Problem

If parsing fails, the program may leave an existing output file partially or incorrectly initialized, even though no successful compilation happened.

Expected behavior

  • Validate the entire source before opening or writing the output file.
  • Keep the output file closed until a successful compile is confirmed.
  • Prefer a temp-file-and-rename strategy for safer writes.

Relevant code

  • compiler/main.cpp where the output stream is created before validation completes.

Suggested fix

Move std::ofstream output_file(output); to just before the final write, after all validation passes. Use a temporary output path and rename it on success if atomic updates are important.

主要言語
C++
スター
0
フォーク
0
平均マージ
1分
マージ済み PR(30日)
4

環境構築

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

はじめの一歩

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

DavidSkillman/LittleManCompiler のほかの issue

DavidSkillman/LittleManCompiler の issue をすべて見る

似ている issue

C++ の issue をもっと見る

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

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