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
This commit is contained in:
Stephan Bergmann
2015-05-11 09:17:45 +02:00
parent fc9e78c788
commit e12e0087e2

View File

@@ -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(