From 559265c8daf7230d77b02f8566a6539e81edf416 Mon Sep 17 00:00:00 2001 From: David Bolvansky Date: Sat, 5 Oct 2019 08:02:11 +0000 Subject: [Diagnostics] Use Expr::isKnownToHaveBooleanValue() to check bitwise negation of bool in languages without a bool type Thanks for this advice, Richard Trieu! llvm-svn: 373817 --- clang/lib/Sema/SemaExpr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'clang/lib/Sema/SemaExpr.cpp') diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 667441cbaa5..c18f54cefde 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -13479,7 +13479,7 @@ ExprResult Sema::CreateBuiltinUnaryOp(SourceLocation OpLoc, // 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()) -- cgit v1.2.3