diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-05-11 09:17:45 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-05-11 09:20:13 +0200 |
commit | e12e0087e25c0aebc1a19ade7bf5a554c44e3cd0 (patch) | |
tree | 983090f517a9503d7eb8240b0d7ece2012e8fe4f /compilerplugins | |
parent | fc9e78c78864cbfa67ddea646da4aa4677d99b0c (diff) |
Suppress loplugin:implicitboolconversion warnings in Objective-C code
...(but not Objective-C++ code) where BOOL (aka unsigned char) expressions are
routinely implicitly converted to int per the C rules, e.g., as operands of &&.
Change-Id: I17e5dae9f065aaa814850196b1ef31f8fb07c99b
Diffstat (limited to 'compilerplugins')
-rw-r--r-- | compilerplugins/clang/implicitboolconversion.cxx | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/compilerplugins/clang/implicitboolconversion.cxx b/compilerplugins/clang/implicitboolconversion.cxx index 0d933bfa4480..3f255ff35efe 100644 --- a/compilerplugins/clang/implicitboolconversion.cxx +++ b/compilerplugins/clang/implicitboolconversion.cxx @@ -951,11 +951,13 @@ void ImplicitBoolConversion::checkCXXConstructExpr( } void ImplicitBoolConversion::reportWarning(ImplicitCastExpr const * expr) { - report( - DiagnosticsEngine::Warning, - "implicit conversion (%0) from %1 to %2", expr->getLocStart()) - << expr->getCastKindName() << expr->getSubExprAsWritten()->getType() - << expr->getType() << expr->getSourceRange(); + if (!compiler.getLangOpts().ObjC2 || compiler.getLangOpts().CPlusPlus) { + report( + DiagnosticsEngine::Warning, + "implicit conversion (%0) from %1 to %2", expr->getLocStart()) + << expr->getCastKindName() << expr->getSubExprAsWritten()->getType() + << expr->getType() << expr->getSourceRange(); + } } loplugin::Plugin::Registration<ImplicitBoolConversion> X( |