<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/56894>56894</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [C++20] [Modules] We should diagnose instead of crashing when compiling the module file of header units
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:modules
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          ChuanqiXu9
      </td>
    </tr>
</table>

<pre>
    Currently, when we compile the module file of header units. It would crash instead of diagnosing. It is not user friendly.

Reproducer:
```
clang++ -std=c++20 -xc++-system-header --precompile iostream -o iostream.pcm
clang++ -std=c++20 iostream.pcm -c -o iostream.o
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyNUk2TnCAQ_TV4obQUxNWDh92Z2qo95JJLcgVplRSC4WMn8--DH7O1ySWparSf3TTvPRRW3vtLdA5M0HdELvg2g8E3wINdVqUBhxnwYmVM6bhhO-IZuASHo1HBF_gt4JuNWuLBcT9jZXxI9a1PKj4Z65WZ9i7lsbEBR5_2jk6BkfpeoPKKyufj-RVWl04awCF6fkJNecYOB83NhMhLCpz7IBG9DgckJc5_nXnu74nDkp8883x18JCjrA8O-IJz-5EX67D8x_zP7Tgf_phg_6KbQV81rGMVbdsqkz2VHe14FlTQ0CP2cnlMReyKE_6yO-w39A2wn3dDT__gs6e7ycnR454OVRv8xzVl0el-DmH1m7XkNcWkwhxFkUYkoPX745Xcsj9gCAkq72MiRV5Z03Z1Nve1AMHGhnIhGWkpfWJ13ZEKumpkteA801yA9ptCRMjhJn1eTnGEJH2Z6klJSNmWNK26Lou0H9pRsKolT4PoGlSXsHCli41NYd2UuX4nJuLkU1Ern_67jyL3Xk0Gdlu3-TyG2br-Mkdufqrvsct2Gf2u4TfJm--w">