[cfe-dev] Proposal: Add diagnostic enumeration to libclang

Richard Smith richard at metafoo.co.uk
Thu Jan 5 08:46:22 PST 2012


On Thu, January 5, 2012 12:21, Dave Abrahams wrote:
> on Thu Jan 05 2012, David Blaikie <dblaikie-AT-gmail.com> wrote:
>> The rules are there to protect -fixit behavior - a fixit hint on an
>> error or warning cannot change the semantics of the program
>
> What are the semantics of a program that doesn't compile?

The relevant rule for fixits on warnings and errors is that the AST must
reflect the syntax of the fixed code. For warnings, this means that the fixit
must not change semantics. For errors, it means that if all errors have
fixits, we can (hopefully reliably) assume that all (error and optionally
warning) fixits can be simultaneously applied and all errors will be fixed. In
principle, we could even go on to produce object code in the same compilation
pass if all errors have fixits -- but sadly many of the fixits predate this
rule and do not yet recover correctly.

Fixits on notes don't have these restrictions, since they're not automatically
applied by -fixit.

- Richard




More information about the cfe-dev mailing list