Thanks for this advice, Richard Trieu!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373817
91177308-0d34-0410-b5e6-
96231b3b80d8
// C99 does not support '~' for complex conjugation.
Diag(OpLoc, diag::ext_integer_complement_complex)
<< resultType << Input.get()->getSourceRange();
- else if (Input.get()->IgnoreParenImpCasts()->getType()->isBooleanType())
+ else if (Input.get()->isKnownToHaveBooleanValue())
Diag(OpLoc, diag::warn_bitwise_negation_bool)
<< FixItHint::CreateReplacement(OpLoc, "!");
else if (resultType->hasIntegerRepresentation())
b = ~i;
i = ~b; // expected-warning {{bitwise negation of a boolean expression; did you mean logical negation?}}
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:7-[[@LINE-1]]:8}:"!"
+ b = ~(i > 4); // expected-warning {{bitwise negation of a boolean expression; did you mean logical negation?}}
+ // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:7-[[@LINE-1]]:8}:"!"
}