diff options
author | Jan Svoboda <jan_svoboda@apple.com> | 2022-01-26 11:21:49 +0100 |
---|---|---|
committer | Jan Svoboda <jan_svoboda@apple.com> | 2022-01-26 11:21:51 +0100 |
commit | 76cb4cd074a6816f3801fd4a2bd8854597748239 (patch) | |
tree | 9a0684c0e4960a6e6e46c48950577080fb70e554 /llvm/lib/TextAPI/Architecture.cpp | |
parent | 600c6714ac77915b7b656b860cf71494a7c9ec7f (diff) | |
download | llvm-76cb4cd074a6816f3801fd4a2bd8854597748239.zip llvm-76cb4cd074a6816f3801fd4a2bd8854597748239.tar.gz llvm-76cb4cd074a6816f3801fd4a2bd8854597748239.tar.bz2 |
[clang] Fix serialized diagnostics edge-cases
The Clang frontend sometimes fails on the following assertion when launched with `-serialize-diagnostic-file <x>`:
```
Assertion failed: (BlockScope.empty() && CurAbbrevs.empty() && "Block imbalance"), function ~BitstreamWriter, file BitstreamWriter.h, line 125.
```
This was first noticed when passing an unknown command-line argument to `-cc1`.
It turns out the `DiagnosticConsumer::finish()` function should be called as soon as processing of all source files ends, but there are some code paths where that doesn't happen:
1. when command line parsing fails in `cc1_main()`,
2. when `!Act.PrepareToExecute(*this)` or `!createTarget()` evaluate to `true` in `CompilerInstance::ExecuteAction` and the function returns early.
This patch ensures `finish()` is called in all those code paths.
Reviewed By: Bigcheese
Differential Revision: https://reviews.llvm.org/D118150
Diffstat (limited to 'llvm/lib/TextAPI/Architecture.cpp')
0 files changed, 0 insertions, 0 deletions