[llvm-branch-commits] [clang] [clang-tools-extra] [lldb] [clang] fix getTemplateInstantiationArgs (PR #199528)

Matheus Izvekov via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue May 26 07:00:35 PDT 2026


================
@@ -590,28 +590,28 @@ class CollectExtraHighlightings
 
   bool
   VisitClassTemplateSpecializationDecl(ClassTemplateSpecializationDecl *D) {
-    if (auto *Args = D->getTemplateArgsAsWritten())
-      H.addAngleBracketTokens(Args->getLAngleLoc(), Args->getRAngleLoc());
-    return true;
-  }
-
-  bool VisitClassTemplatePartialSpecializationDecl(
-      ClassTemplatePartialSpecializationDecl *D) {
-    if (auto *TPL = D->getTemplateParameters())
-      H.addAngleBracketTokens(TPL->getLAngleLoc(), TPL->getRAngleLoc());
+    if (const auto *Info = D->getExplicitInstantiationInfo()) {
+      H.addAngleBracketTokens(Info->TemplateArgsAsWritten->getLAngleLoc(),
----------------
mizvekov wrote:

That could be confusing, for example, it would be reasonable to expect, by the name alone, that such a function would include the source locations of the arguments themselves, ie the range of all source locations between the `<`and `>` inclusive.

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


More information about the llvm-branch-commits mailing list