]> granicus.if.org Git - clang/commitdiff
[Diagnostics] Highlight expr's source range for -Wbool-operation
authorDavid Bolvansky <david.bolvansky@gmail.com>
Sat, 5 Oct 2019 13:28:15 +0000 (13:28 +0000)
committerDavid Bolvansky <david.bolvansky@gmail.com>
Sat, 5 Oct 2019 13:28:15 +0000 (13:28 +0000)
Warning message looks better; and GCC adds it too.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373828 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaExpr.cpp

index c18f54cefde695877bede178e998800dbc2b4e33..3cb999dacc40b87160c309f6e727af80fd7c741c 100644 (file)
@@ -13481,6 +13481,7 @@ ExprResult Sema::CreateBuiltinUnaryOp(SourceLocation OpLoc,
           << resultType << Input.get()->getSourceRange();
     else if (Input.get()->isKnownToHaveBooleanValue())
       Diag(OpLoc, diag::warn_bitwise_negation_bool)
+          << Input.get()->getSourceRange()
           << FixItHint::CreateReplacement(OpLoc, "!");
     else if (resultType->hasIntegerRepresentation())
       break;