Author: Kazu Hirata Date: 2025-07-17T07:22:36-07:00 New Revision: 96a7e954e1501239d1fc4bd6eba60428bd6609f7
URL: https://github.com/llvm/llvm-project/commit/96a7e954e1501239d1fc4bd6eba60428bd6609f7 DIFF: https://github.com/llvm/llvm-project/commit/96a7e954e1501239d1fc4bd6eba60428bd6609f7.diff LOG: [Sema] Remove unnecessary casts (NFC) (#149253) getParam already returns NamedDecl *. Added: Modified: clang/lib/Sema/SemaTemplateDeduction.cpp Removed: ################################################################################ diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp index d09a72b71b805..e1a975bcfb3e1 100644 --- a/clang/lib/Sema/SemaTemplateDeduction.cpp +++ b/clang/lib/Sema/SemaTemplateDeduction.cpp @@ -3083,8 +3083,7 @@ static TemplateDeductionResult ConvertDeducedTemplateArguments( // If there was no default argument, deduction is incomplete. if (DefArg.getArgument().isNull()) { - Info.Param = makeTemplateParameter( - const_cast<NamedDecl *>(TemplateParams->getParam(I))); + Info.Param = makeTemplateParameter(TemplateParams->getParam(I)); Info.reset( TemplateArgumentList::CreateCopy(S.Context, CTAI.SugaredConverted), TemplateArgumentList::CreateCopy(S.Context, CTAI.CanonicalConverted)); @@ -3100,8 +3099,7 @@ static TemplateDeductionResult ConvertDeducedTemplateArguments( if (S.CheckTemplateArgument( Param, DefArg, TD, TD->getLocation(), TD->getSourceRange().getEnd(), /*ArgumentPackIndex=*/0, CTAI, Sema::CTAK_Specified)) { - Info.Param = makeTemplateParameter( - const_cast<NamedDecl *>(TemplateParams->getParam(I))); + Info.Param = makeTemplateParameter(TemplateParams->getParam(I)); // FIXME: These template arguments are temporary. Free them! Info.reset( TemplateArgumentList::CreateCopy(S.Context, CTAI.SugaredConverted), @@ -3227,7 +3225,7 @@ static TemplateDeductionResult FinishTemplateArgumentDeduction( if (ParamIdx >= TPL->size()) ParamIdx = TPL->size() - 1; - Decl *Param = const_cast<NamedDecl *>(TPL->getParam(ParamIdx)); + Decl *Param = TPL->getParam(ParamIdx); Info.Param = makeTemplateParameter(Param); Info.FirstArg = Ps[ArgIdx].getArgument(); return TemplateDeductionResult::SubstitutionFailure; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits