I think "pointer to reference not equal to null pointer can only be
false in…" would be better expressed as "address of reference can be
null only in…"
and ditto, "this pointer equal to null pointer can only be true in…"
would be better expressed as "this pointer can be null only in…"
(C++ doesn't have "pointers to references.")
I'm also mildly opposed to the name "-Wundefined-bool-conversion",
given that the conversions in question are NOT undefined — in fact,
the reason for the diagnostic is basically that they're TOO defined!
However, I have no better name to offer as a replacement.
Also, is this case covered by your new diagnostic, or by some old
diagnostic, or is it still un-covered?
class test3 {
void bar() {
if (&y) { } // expected-warning of some sort: address of this->y
cannot be null
if (!&y) { } // expected-warning of some sort: address of this->y
cannot be null
}
int y;
};
my $.02,
–Arthur
On Mon, Jun 2, 2014 at 9:25 PM, Richard Trieu <[email protected]> wrote:
> Extend tautological compare and bool conversion warnings to undefined pointer
> operations. These are cases where all defined behavior will give the
> expression one value, while the other value can only result from undefined
> behavior, which the optimizer can remove. These cases are addresses of
> references and the this pointer. This warning was requested in PR19899 in
> response to commit r209723.
>
> http://reviews.llvm.org/D3999
>
> Files:
> include/clang/Basic/DiagnosticGroups.td
> include/clang/Basic/DiagnosticSemaKinds.td
> lib/Sema/SemaChecking.cpp
> test/SemaCXX/warn-tautological-undefined-compare.cpp
> test/SemaCXX/warn-undefined-bool-conversion.cpp
>
> _______________________________________________
> cfe-commits mailing list
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits