[cfe-dev] [PATCH] Fixit for incorrect includes

David Blaikie dblaikie at gmail.com
Tue Jul 17 10:10:45 PDT 2012


On Tue, Jul 17, 2012 at 9:14 AM, Aaron Ballman <aaron at aaronballman.com> wrote:
> This patch creates a fixit for include directives where the file could
> not be found when using angle brackets, but can be found when using
> quotes.  The converse is not needed since quoted includes will search
> angle bracket locations by default.
>
> Eg)
> #include <header.h>  // can be found via #include "header.h" instead
>
> Thoughts?

Seems like a neat idea to me - but I'm not an authoritative sign-off.

You used NULL as null constants for 2 of the conditional operators,
then 0 for the third - that seems inconsistent. You might want to
check what the prevailing style is in this file & stick to that
(generally in LLVM, '0' seems to be winning as the authoritative null
pointer constant, I believe).

Did you consider adding this case to the existing fixit testing files?
They're already a grab-bag of things that can be fixed (this helps
keep the test suite fast by not adding more separate test file
executions) & this seems like it'd be at home there.

[& this makes me wonder: how scary (would it even be
possible/practical?) would it be to do typo correction on #includes?
Though we should check if it's worthwhile first - I wonder how often
people make typos there]



More information about the cfe-dev mailing list