[cfe-commits] improving constness on clang sources

Chandler Carruth chandlerc at google.com
Mon Nov 5 03:42:50 PST 2012


On Sun, Nov 4, 2012 at 12:37 PM, David Blaikie <dblaikie at gmail.com> wrote:
>> created a constness checker, have run against clang source...
>
> Just out of curiosity, what's the accuracy of this checker? Have you
> managed to find good heuristics for not suggesting const on pimpl-like
> idioms or other such things?
>
> (my suspicion is that there's no good way to tell whether something
> indirectly referenced (via a pointer) is notionally "part" of the
> object or not, making it hard to have a low false positive on such a
> tool - but if I'm wrong, this might be interesting to consider as a
> compiler diagnostic)
>
>> Here come a small set of fix on methods which are named 'is*' and return bool.
>
> Changes generally look good. I'd be OK with someone (including me)
> committing these, but might leave it a few days (if you don't hear
> anything in a week, please ping this thread) to see if anyone else has
> opinions (this might not meet some people's churn/benefit threshold).

I have one somewhat theoretical concern: this is ostensibly part of
the API and I'm not entirely comfortable blindly changing the APIs in
this manner.

The specific concern I have is that there are APIs for objects which
are immutable and where we have historically simply not bothered with
const because it requires too much lexical noise and provides no
benefit to the users or implementors of the API.



More information about the cfe-commits mailing list