]> granicus.if.org Git - clang/commit
Add a new warning to -Wliteral-conversion to catch cases where a string literal
authorRichard Trieu <rtrieu@google.com>
Fri, 23 Sep 2011 20:10:00 +0000 (20:10 +0000)
committerRichard Trieu <rtrieu@google.com>
Fri, 23 Sep 2011 20:10:00 +0000 (20:10 +0000)
commitf1f8b1a404d9ce6f0eb78e97b598a220d8ca9090
tree9b12de60886cec65a0f80a80156d8d3018f055c3
parent13d05ac08974ccb41f7da7595d769c158f58fbd6
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
include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaChecking.cpp
lib/Sema/SemaExprCXX.cpp
test/SemaCXX/warn-literal-conversion.cpp