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

    <tr>
        <th>Summary</th>
        <td>
            clang-include-fixer crashes when passed invalid code
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    With the below code saved in `a.c`:
```
a
```
Running `clang-include-fixer` will crash with the below output:
```
$ clang-include-fixer a.c
Error while trying to load a compilation database:
Could not auto-detect compilation database for file "a.c"
No compilation database found in /tmp or any parent directory
json-compilation-database: Error while opening JSON database: No such file or directory
fixed-compilation-database: Error while opening fixed database: No such file or directory
Running without flags.
Couldn't find YAML db: No such file or directory
Segmentation fault (core dumped)
```
No crash backtrace is shown. I'm using clang 13.0.1.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVU9tu1DAQ_ZrkZbRR1tl0m4c8LJRKICiIIiEeJ_EkcfHakS9d9u-ZeNWyoK1EJSvxbc45czzTWXlsv6swQZgIOtL2AL2VBB4fSYIykF2VWPT8zapdVt5k5W6Zn0Za4sXdr9EYZcYlvNdoxpUyvY6SVoP6RY534aC0ht6hn3j6lwAbwxzDS3yZ2MAFSFhUpgvvnLMODpPSBMEdFxXBgrYoATm5_aw0BmUNSAzYoadnprc2agnGBsAY7EpSoD5cDIGBKYaFIRNiYRbiBHFnX7ofzclPcRv2M3A4miPM6MgEkMoxk3XHE8iDt2Z1BrM6Uwrn6dmZkssf7j_fnacDLMPHfjpJ5Ov_ECyOyVcxpIjXUDwVwPK2_KAwaBx9ceazycSWtxXb8mP36SPI7j9Q72ncs2EncweMOrCh1711BDLuZ5KZaC5WzfIuqdY67H8Ghz2B8uAnezAFvGcpe4h-0ZtKC9ZVURbrIpdtJZuqwTyooKm9VHcJljz7RYbf0_vUN4-olUytlEen2ymE2S91Jm55jOxJ7Ar2nxdaPz79VrOzD5wuL5X3kTxP6k1VrfOpba5ELbfVdV9vryu5bUR91a2birBBHiXmGrl7fJvVb7gYDR0gQSyFWd_kqhWlEGW1Xpd1WVaiwGHY0qascCPqCrs625S0R6WLRUdh3Zi7Nknq4uj5UCsf_J9DTlONhijRMT73y2Rd-418YBO_sE0hT_xt0v8b8dJxPg">