[PATCH] Add warnings for undefined behaviors with pointers

Richard Smith richard at metafoo.co.uk
Fri Jun 6 15:58:48 PDT 2014


On Thu, Jun 5, 2014 at 5:01 PM, Richard Smith <richard at metafoo.co.uk> wrote:

> LGTM with some minor diagnostic tweaks.
>
> ================
> Comment at: include/clang/Basic/DiagnosticSemaKinds.td:2393
> @@ +2392,3 @@
> +  "'this' pointer cannot be null in well-defined C++ code; pointer may be
> "
> +  "assumed always converted to a true value">,
> InGroup<UndefinedBoolConversion>;
> +def warn_address_of_reference_bool_conversion : Warning<
> ----------------
> "assumed to always convert to" would sound better to me.
>

Looks like you didn't make this change prior to checkin?

Also,
>
>   assumed to always convert to 'true'
>
> rather than
>
>   assumed to always convert to a true value
>
> to avoid people wondering what "a true value" is (cf. "a true Scotsman").
>
> Likewise I'd suggest putting the %select's below into single quotes.
>

Likewise this one.


> ================
> Comment at: include/clang/Basic/DiagnosticSemaKinds.td:2409
> @@ +2408,3 @@
> +  "reference cannot be bound to dereferenced null pointer in well-defined
> C++ "
> +  "code; comparison maybe be assumed to always evaluate to "
> +  "%select{true|false}0">,
> ----------------
> Typo "maybe be" should be "may be"
>
> http://reviews.llvm.org/D3999
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140606/0486f38f/attachment.html>


More information about the cfe-commits mailing list