[PATCH] Add DiagnosticSuppressionScope RAII class
brad.king at kitware.com
Mon Nov 17 08:29:16 PST 2014
On 11/12/2014 08:43 PM, Richard Smith wrote:
> On Fri, Oct 31, 2014 at 6:26 AM, Brad King wrote:
>> once one error has been emitted the failed
>> declaration is marked as invalid and any further error resulting from
>> encountering the invalid declaration should not be emitted.
> Yes, that's the goal and the intent.
Thanks. Ideally any declaration that fails to compile as a result
of encountering another invalid declaration should also be marked
as invalid. That way tools can identify and work with the valid
subset of the translation unit with no false positives. This is
useful for tools that work with code that is in progress in an
editor, for example. Is that also a goal?
I feel that DiagnosticSuppressionScope is still a valid primitive.
FrontendAction::EndSourceFile deletes the output file if the
Diags.hasErrorOccurred() method returns true. Tools that want to
produce output even in the face of errors need a way to prevent that
along with suppressing error diagnostics. DiagnosticSuppressionScope
does both cleanly so long as it surrounds the proper scope in the
tool's source. Perhaps we can add it with a suitable disclaimer in
the documentation comments about non-local errors?
More information about the cfe-commits