Related to https://reviews.llvm.org/D50455
There is some code here and there that assume that no sane output is required if a fatal error has occurred. When using clangd/libclang, it's no longer true: diagnostics might still be requested, and AST might still be required for other IDE/tooling features, so it has to be as complete as possible.
Here I try to separate the following use cases:
- Some clients check hasFatalErrorOccurred() because they are known to work unstable in presence of compile errors and want to mitigate it - they'll work as before
- However, we don't want to take shortcuts in PP and Sema and still want to process include directives and instantiate templates
Note: I've found out that initially the flag in DiagnosticsEngine (which is now called SuppressAfterFatalError) had different meaning and was just demoting all fatal errors to non-fatal (https://reviews.llvm.org/rL262318). This would also fix this issue, however, it was partly reverted in https://reviews.llvm.org/rL301992 to the current state. Maybe we should go with the old approach instead (I assume the issue was that this flag was not serialized/restored, but probably should?)
Looks like this line wasn't formatted with clang-format.