Author: Richard Smith Date: 2020-09-03T15:35:12-07:00 New Revision: 052dbe226cb3540c77cf0b3dc4a51a4ab7726b55
URL: https://github.com/llvm/llvm-project/commit/052dbe226cb3540c77cf0b3dc4a51a4ab7726b55 DIFF: https://github.com/llvm/llvm-project/commit/052dbe226cb3540c77cf0b3dc4a51a4ab7726b55.diff LOG: Remove unused and dangerous overload of PerformImplicitConversion. Previously we had two overloads where the only real difference beyond parameter order was whether a reference parameter is const, where one overload treated the reference parameter as an in-parameter and the other treated it as an out-parameter! Added: Modified: clang/include/clang/Sema/Sema.h clang/lib/Sema/SemaOverload.cpp Removed: ################################################################################ diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index 174b424bb996..ec449d6dd6be 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -11224,10 +11224,6 @@ class Sema final { ExprResult PerformImplicitConversion(Expr *From, QualType ToType, AssignmentAction Action, bool AllowExplicit = false); - ExprResult PerformImplicitConversion(Expr *From, QualType ToType, - AssignmentAction Action, - bool AllowExplicit, - ImplicitConversionSequence& ICS); ExprResult PerformImplicitConversion(Expr *From, QualType ToType, const ImplicitConversionSequence& ICS, AssignmentAction Action, diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index 21a9ad04d500..71341e5688fe 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -1494,17 +1494,9 @@ Sema::TryImplicitConversion(Expr *From, QualType ToType, /// converted expression. Flavor is the kind of conversion we're /// performing, used in the error message. If @p AllowExplicit, /// explicit user-defined conversions are permitted. -ExprResult -Sema::PerformImplicitConversion(Expr *From, QualType ToType, - AssignmentAction Action, bool AllowExplicit) { - ImplicitConversionSequence ICS; - return PerformImplicitConversion(From, ToType, Action, AllowExplicit, ICS); -} - -ExprResult -Sema::PerformImplicitConversion(Expr *From, QualType ToType, - AssignmentAction Action, bool AllowExplicit, - ImplicitConversionSequence& ICS) { +ExprResult Sema::PerformImplicitConversion(Expr *From, QualType ToType, + AssignmentAction Action, + bool AllowExplicit) { if (checkPlaceholderForOverload(*this, From)) return ExprError(); @@ -1515,13 +1507,13 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType, if (getLangOpts().ObjC) CheckObjCBridgeRelatedConversions(From->getBeginLoc(), ToType, From->getType(), From); - ICS = ::TryImplicitConversion(*this, From, ToType, - /*SuppressUserConversions=*/false, - AllowExplicit ? AllowedExplicit::All - : AllowedExplicit::None, - /*InOverloadResolution=*/false, - /*CStyle=*/false, AllowObjCWritebackConversion, - /*AllowObjCConversionOnExplicit=*/false); + ImplicitConversionSequence ICS = ::TryImplicitConversion( + *this, From, ToType, + /*SuppressUserConversions=*/false, + AllowExplicit ? AllowedExplicit::All : AllowedExplicit::None, + /*InOverloadResolution=*/false, + /*CStyle=*/false, AllowObjCWritebackConversion, + /*AllowObjCConversionOnExplicit=*/false); return PerformImplicitConversion(From, ToType, ICS, Action); } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits