Add a new warning to -Wliteral-conversion to catch cases where a string literal
is cast to a boolean. An exception has been made for string literals in
logical expressions to allow the common case of use in assert statements.
bool x;
x = "hi"; // Warn here
void foo(bool x);
foo("hi"); // Warn here
assert(0 && "error");
assert("error); // Warn here
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140405 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index 3beb51c..3fb8df6 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -4643,7 +4643,7 @@
if (FullExpr.isInvalid())
return ExprError();
- CheckImplicitConversions(FullExpr.get());
+ CheckImplicitConversions(FullExpr.get(), FullExpr.get()->getExprLoc());
return MaybeCreateExprWithCleanups(FullExpr);
}