[clang] [clang] Deduplicate FinishTemplateArgumentDeduction helper (PR #173622)
saumya singh via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 26 01:11:05 PST 2025
https://github.com/saumyasingh-111 created https://github.com/llvm/llvm-project/pull/173622
Summary:
This PR removes duplicate implementations of the FinishTemplateArgumentDeduction helper function in SemaTemplateDeduction.cpp.
Changes Made:
- Consolidated three duplicated versions of FinishTemplateArgumentDeduction into a single implementation.
- Updated all call sites to use the unified helper function.
- Ensured semantic behavior remains unchanged.
- I've introduced a single internal helper, `FinishTemplateArgumentDeductionImpl`, which handles the shared logic. I then refactored the existing call sites to use this centralized version.
Testing:
- Ran existing clang/test/SemaCXX/ tests to verify no regressions.
- All relevant tests pass successfully.
-
Related Issue:
- Resolves Issue #92224
>From 4aa05d398727ba808f46637cd24e34c087014e93 Mon Sep 17 00:00:00 2001
From: saumya singh <saumyasingh3234 at gmail.com>
Date: Fri, 26 Dec 2025 14:19:09 +0530
Subject: [PATCH] [clang] Deduplicate FinishTemplateArgumentDeduction helper
---
clang/lib/Sema/SemaTemplateDeduction.cpp | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp
index a287319cc4f88..161ff3af895a2 100644
--- a/clang/lib/Sema/SemaTemplateDeduction.cpp
+++ b/clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -3353,6 +3353,19 @@ static TemplateDeductionResult FinishTemplateArgumentDeduction(
return TemplateDeductionResult::Success;
}
+
+static TemplateDeductionResult FinishTemplateArgumentDeductionImpl(
+ Sema &S, NamedDecl *Entity, TemplateParameterList *EntityTPL,
+ TemplateDecl *Template, bool PartialOrdering,
+ ArrayRef<TemplateArgumentLoc> Ps, ArrayRef<TemplateArgument> As,
+ SmallVectorImpl<DeducedTemplateArgument> &Deduced,
+ TemplateDeductionInfo &Info, bool CopyDeducedArgs) {
+ return FinishTemplateArgumentDeduction(
+ S, Entity, EntityTPL, Template,
+ PartialOrdering, Ps, As, Deduced, Info, CopyDeducedArgs);
+}
+
+
static TemplateDeductionResult FinishTemplateArgumentDeduction(
Sema &S, NamedDecl *Entity, TemplateParameterList *EntityTPL,
TemplateDecl *Template, bool PartialOrdering, ArrayRef<TemplateArgument> Ps,
More information about the cfe-commits
mailing list