[cfe-dev] null pointer literals, warnings, and fixups

Douglas Gregor dgregor at apple.com
Wed Aug 24 11:39:45 PDT 2011


On Aug 21, 2011, at 9:13 PM, David Blaikie wrote:

> On Fri, Aug 19, 2011 at 2:32 PM, Manuel Klimek <klimek at google.com> wrote:
>> On Fri, Aug 19, 2011 at 2:05 PM, David Blaikie <dblaikie at gmail.com> wrote:
>> <snip>
>>> Side question: what tools currently exist that can actually apply
>>> fixit instructions to code? Is there any existing simple program (that
>>> would probably work like scan-build, or similar) that could be
>>> instructed to actually apply all instances of a particular warning
>>> fixup?
>> 
>> We've been working on infrastructure to do exactly that, but it didn't
>> get included in mainline (see
>> http://lists.cs.uiuc.edu/pipermail/cfe-dev/2011-June/015434.html,
>> which includes a patch that should still apply somewhat clean). We're
>> currently working on different options to get it open sourced.
> 
> Ah, yes, I remember that thread. That's a bit of a bigger/more general
> tool than I was thinking of in this context - in this case I was just
> wondering if there was a simple tool to apply Clang's suggested
> FixIts. In this case if I added a warning that suggested NULL over 0
> in pointer contexts (or 0 over NULL, if that was the desired coding
> convention) & nullptr over both in C++0x, I would like to be able to
> say "apply all fixups from this warning" & then I could easily
> transform a codebase over to nullptr (or maintain 0/NULL usage in
> C++98).

Have you looked at the -cc1 option "-fixit", which applies Fix-Its in place?

	- Doug




More information about the cfe-dev mailing list