Fix issues missed during the review of r222099.
Shift some functions around, make a method in Sema private,
call the correct overloaded function. No functional change.
llvm-svn: 222081
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index b27ce7c..72fc3e3 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -6526,6 +6526,14 @@
E->getType(), CC, &Suspicious);
}
+/// CheckBoolLikeConversion - Check conversion of given expression to boolean.
+/// Input argument E is a logical expression.
+static void CheckBoolLikeConversion(Sema &S, Expr *E, SourceLocation CC) {
+ if (S.getLangOpts().Bool)
+ return;
+ CheckImplicitConversion(S, E->IgnoreParenImpCasts(), S.Context.BoolTy, CC);
+}
+
/// AnalyzeImplicitConversions - Find and report any interesting
/// implicit conversions in the given expression. There are a couple
/// of competing diagnostics here, -Wconversion and -Wsign-compare.
@@ -6606,12 +6614,12 @@
AnalyzeImplicitConversions(S, ChildExpr, CC);
}
if (BO && BO->isLogicalOp()) {
- S.CheckBoolLikeConversion(BO->getLHS(), BO->getLHS()->getExprLoc());
- S.CheckBoolLikeConversion(BO->getRHS(), BO->getRHS()->getExprLoc());
+ ::CheckBoolLikeConversion(S, BO->getLHS(), BO->getLHS()->getExprLoc());
+ ::CheckBoolLikeConversion(S, BO->getRHS(), BO->getRHS()->getExprLoc());
}
if (const UnaryOperator *U = dyn_cast<UnaryOperator>(E))
if (U->getOpcode() == UO_LNot)
- S.CheckBoolLikeConversion(U->getSubExpr(), CC);
+ ::CheckBoolLikeConversion(S, U->getSubExpr(), CC);
}
} // end anonymous namespace
@@ -6670,18 +6678,6 @@
return false;
}
-/// CheckBoolLikeConversion - Check conversion of given expression to boolean.
-/// Input argument E is a logical expression.
-static void CheckBoolLikeConversion(Sema &S, Expr *E, SourceLocation CC) {
- if (S.getLangOpts().Bool)
- return;
- CheckImplicitConversion(S, E->IgnoreParenImpCasts(), S.Context.BoolTy, CC);
-}
-
-void Sema::CheckBoolLikeConversion(Expr *E, SourceLocation CC) {
- ::CheckBoolLikeConversion(*this, E, CC);
-}
-
/// \brief Diagnose pointers that are always non-null.
/// \param E the expression containing the pointer
/// \param NullKind NPCK_NotNull if E is a cast to bool, otherwise, E is
@@ -6839,6 +6835,12 @@
AnalyzeImplicitConversions(*this, E, CC);
}
+/// CheckBoolLikeConversion - Check conversion of given expression to boolean.
+/// Input argument E is a logical expression.
+void Sema::CheckBoolLikeConversion(Expr *E, SourceLocation CC) {
+ ::CheckBoolLikeConversion(*this, E, CC);
+}
+
/// Diagnose when expression is an integer constant expression and its evaluation
/// results in integer overflow
void Sema::CheckForIntOverflow (Expr *E) {