summaryrefslogtreecommitdiffstats
path: root/lib/Sema/SemaChecking.cpp
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2014-11-15 06:37:39 +0000
committerRichard Trieu <rtrieu@google.com>2014-11-15 06:37:39 +0000
commit65d8b4c4998b3a0c20934ea72ede72ef4838a004 (patch)
tree74aa883c0df364d0cd13817b57b8b5a0ac084a37 /lib/Sema/SemaChecking.cpp
parentf43c22e9e105ea5a5df48b39084df345ad3becbc (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222081 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaChecking.cpp')
-rw-r--r--lib/Sema/SemaChecking.cpp32
1 files changed, 17 insertions, 15 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp
index b27ce7c709..72fc3e3749 100644
--- a/lib/Sema/SemaChecking.cpp
+++ b/lib/Sema/SemaChecking.cpp
@@ -6526,6 +6526,14 @@ void CheckConditionalOperator(Sema &S, ConditionalOperator *E,
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 @@ void AnalyzeImplicitConversions(Sema &S, Expr *OrigE, SourceLocation CC) {
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 @@ static bool IsInAnyMacroBody(const SourceManager &SM, SourceLocation Loc) {
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 @@ void Sema::CheckImplicitConversions(Expr *E, SourceLocation CC) {
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) {