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

Douglas Gregor dgregor at apple.com
Thu Aug 25 09:16:01 PDT 2011


On Aug 24, 2011, at 8:00 PM, David Blaikie wrote:

> 
> 
> On Wed, Aug 24, 2011 at 11:39 AM, Douglas Gregor <dgregor at apple.com> wrote:
> 
> On Aug 21, 2011, at 9:13 PM, David Blaikie wrote:
> 
> > in this case I was just
> > wondering if there was a simple tool to apply Clang's suggested
> > FixIts
> 
> Have you looked at the -cc1 option "-fixit", which applies Fix-Its in place?
> 
> That's precisely what I was looking for - thanks.
> 
> So by enabling specific warnings (if my hypothetical "always use nullptr in pointer contexts & always use literal 0/false/etc in non-pointer contexts" fixits were implemented) I could quickly transition an entire codebase to a specific style. Lovely.
> 
> Any thoughts on whether such warnings would be suitable? how to handle their overlap with existing more specific warnings & how to handle mutually exclusive warnings (in C++98 land some people might want a warning about using NULL (preferring 0), even in pointer contexts, others might want a warning about 0 in pointer contexts (prefering NULL))?

I don't think these warnings would be suitable for Clang. Such style-checking transformations belong in a separate tool (e.g., like the ARC migrator).

> [curiously - clang -cc1 foo.cpp doesn't enable colored diagnostics by default (when run on a terminal capable of color - where clang foo.cpp does use color). Is that by design?]

Yes. clang -cc1 is just the internal interface to the compiler. The driver makes all of the interesting decisions, such as detecting whether the terminal supports color.

	- Doug

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110825/afec8e2b/attachment.html>


More information about the cfe-dev mailing list