[clang] [Clang][Sema] Refactor collection of multi-level template argument lists (PR #106585)
Younan Zhang via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 29 18:59:06 PDT 2024
================
@@ -827,25 +825,16 @@ buildAssociatedConstraints(Sema &SemaRef, FunctionTemplateDecl *F,
// - The occurrence of U in the function parameter is [depth:0, index:0]
// - The template parameter of U is [depth:0, index:0]
//
- // We add the outer template arguments which is [int] to the multi-level arg
- // list to ensure that the occurrence U in `C<U>` will be replaced with int
- // during the substitution.
- //
// NOTE: The underlying deduction guide F is instantiated -- either from an
// explicitly-written deduction guide member, or from a constructor.
- // getInstantiatedFromMemberTemplate() can only handle the former case, so we
- // check the DeclContext kind.
- if (F->getLexicalDeclContext()->getDeclKind() ==
- clang::Decl::ClassTemplateSpecialization) {
- auto OuterLevelArgs = SemaRef.getTemplateInstantiationArgs(
- F, F->getLexicalDeclContext(),
- /*Final=*/false, /*Innermost=*/std::nullopt,
- /*RelativeToPrimary=*/true,
- /*Pattern=*/nullptr,
- /*ForConstraintInstantiation=*/true);
- for (auto It : OuterLevelArgs)
- ArgsForBuildingRC.addOuterTemplateArguments(It.Args);
- }
+ MultiLevelTemplateArgumentList ArgsForBuildingRC =
+ SemaRef.getTemplateInstantiationArgs(F, F->getLexicalDeclContext(),
+ /*Final=*/false,
+ /*Innermost=*/InnerArgsForBuildingRC,
+ /*RelativeToPrimary=*/true,
+ /*ForConstraintInstantiation=*/true);
+ ;
----------------
zyn0217 wrote:
nit: extra semicolon
https://github.com/llvm/llvm-project/pull/106585
More information about the cfe-commits
mailing list