Diagnostics are unconditionally suppressed after fatal error

Currently it's not possible for a clang library client to obtain the
diagnostics generated after the first fatal error.

The attached (trivial) patch add a flag to control this behaviour.

Please commit.

Diagnostic.patch (2.11 KB)

I'm not sure I understand. The idea of a fatal error is that it is the last one emitted. If your library client doesn't want diagnostics to be discarded, it should map things that default to fatal to Error instead.

-Chris

Chris Lattner wrote:

Currently it's not possible for a clang library client to obtain the
diagnostics generated after the first fatal error.

The attached (trivial) patch add a flag to control this behaviour.

I'm not sure I understand. The idea of a fatal error is that it is
the last one emitted. If your library client doesn't want diagnostics

> to be discarded, it should map things that default to fatal to Error instead.

-Chris

We thought that it was not possible to map a fatal diagnostic to error.
Actually, we tried and we got the following assertion failure:

[Thread 1]
/llvm/tools/clang/include/clang/Basic/Diagnostic.h:333: void clang::Diagnostic::setDiagnosticMapping(clang::diag::kind, clang::diag::Mapping): Assertion failed: (isBuiltinWarningOrExtension(Diag) || Map == diag::MAP_FATAL) && "Cannot map errors!"
Aborted

Are there other ways to map a fatal to error?

Cheers,
Enea Zaffanella.

This was an over-cautious assert, fixed in r101516.

Thanks!

-Chris