llvm-project/clang/test/CXX/expr
Richard Trieu 3bb8b56a5d PR16074, implement warnings to catch pointer to boolean true and pointer to
null comparison when the pointer is known to be non-null.

This catches the array to pointer decay, function to pointer decay and
address of variables.  This does not catch address of function since this
has been previously used to silence a warning.

Pointer to bool conversion is under -Wbool-conversion.
Pointer to null comparison is under -Wtautological-pointer-compare, a sub-group
of -Wtautological-compare.

void foo() {
  int arr[5];
  int x;
  // warn on these conditionals
  if (foo);
  if (arr);
  if (&x);
  if (foo == null);
  if (arr == null);
  if (&x == null);

  if (&foo);  // no warning
}

llvm-svn: 202216
2014-02-26 02:36:06 +00:00
..
expr.ass The 'constexpr implies const' rule for non-static member functions is gone in 2013-04-21 01:08:50 +00:00
expr.cast Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
expr.const Revert "Don't require -re suffix on -verify directives with regexes." 2013-12-14 01:07:05 +00:00
expr.mptr.oper Revert "Don't require -re suffix on -verify directives with regexes." 2013-12-14 01:07:05 +00:00
expr.post sizeof(void) etc. should be a hard error in C++. 2013-08-13 22:26:42 +00:00
expr.prim Don't allow 'this' within typedefs within classes that otherwise look like they 2014-01-17 21:01:18 +00:00
expr.unary PR16074, implement warnings to catch pointer to boolean true and pointer to 2014-02-26 02:36:06 +00:00
p3.cpp
p8.cpp Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
p9.cpp Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. 2012-10-19 12:44:48 +00:00
p10-0x.cpp Implement the C++11 discarded value expression rules for volatile lvalues. <rdar://problem/10790820>. 2012-05-24 22:04:19 +00:00