[clang] [clang][ExtractAPI] improve template argument name deduction (PR #77716)

Erick Velez via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 26 16:13:05 PDT 2024


================
@@ -1127,7 +1096,7 @@ DeclarationFragmentsBuilder::getFragmentsForVarTemplatePartialSpecialization(
       .append("<", DeclarationFragments::FragmentKind::Text)
       .append(getFragmentsForTemplateArguments(
           Decl->getTemplateArgs().asArray(), Decl->getASTContext(),
-          Decl->getTemplateParameters()->asArray()))
+          Decl->getTemplateArgsAsWritten()->arguments()))
----------------
evelez7 wrote:

In this patch `getFragmentsForTemplateArguments`, which is being called here, is changed to accept `ArrayRef<TemplateArgumentLoc>` (which is what the changed line returns) instead of `ArrayRef<NamedDecl *>` because of the nasty loop that was deleted in `DeclarationFragments.cpp:962`. A `TemplateArgumentLoc` gives us the name of the specialization's type argument directly, instead of comparing with the declaration's template parameters.

https://github.com/llvm/llvm-project/pull/77716


More information about the cfe-commits mailing list