Thanks. I felt like we should consistently call the Sema:: variety instead of the helper function in some places. So, I was forced to make it public.
- Fariborz > On Nov 14, 2014, at 10:37 PM, Richard Trieu <rtr...@google.com> wrote: > > Author: rtrieu > Date: Sat Nov 15 00:37:39 2014 > New Revision: 222081 > > URL: http://llvm.org/viewvc/llvm-project?rev=222081&view=rev > Log: > 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. > > Modified: > cfe/trunk/include/clang/Sema/Sema.h > cfe/trunk/lib/Sema/SemaChecking.cpp > > Modified: cfe/trunk/include/clang/Sema/Sema.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=222081&r1=222080&r2=222081&view=diff > ============================================================================== > --- cfe/trunk/include/clang/Sema/Sema.h (original) > +++ cfe/trunk/include/clang/Sema/Sema.h Sat Nov 15 00:37:39 2014 > @@ -2771,8 +2771,6 @@ public: > const AttributeList *AttrList); > > void checkUnusedDeclAttributes(Declarator &D); > - > - void CheckBoolLikeConversion(Expr *E, SourceLocation CC); > > /// Determine if type T is a valid subject for a nonnull and similar > /// attributes. By default, we look through references (the behavior used by > @@ -8592,6 +8590,7 @@ private: > > void CheckFloatComparison(SourceLocation Loc, Expr* LHS, Expr* RHS); > void CheckImplicitConversions(Expr *E, SourceLocation CC = > SourceLocation()); > + void CheckBoolLikeConversion(Expr *E, SourceLocation CC); > void CheckForIntOverflow(Expr *E); > void CheckUnsequencedOperations(Expr *E); > > > Modified: cfe/trunk/lib/Sema/SemaChecking.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=222081&r1=222080&r2=222081&view=diff > ============================================================================== > --- cfe/trunk/lib/Sema/SemaChecking.cpp (original) > +++ cfe/trunk/lib/Sema/SemaChecking.cpp Sat Nov 15 00:37:39 2014 > @@ -6526,6 +6526,14 @@ void CheckConditionalOperator(Sema &S, C > 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, > 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 Sourc > 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 > 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) { > > > _______________________________________________ > cfe-commits mailing list > cfe-commits@cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits _______________________________________________ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits