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

Erich Keane via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue May 26 06:36:03 PDT 2026


================
@@ -6538,6 +6559,34 @@ ExpectedDecl ASTNodeImporter::VisitClassTemplateSpecializationDecl(
     if (!ClassTemplate->findSpecialization(TemplateArgs, InsertPos))
       // Add this specialization to the class template.
       ClassTemplate->AddSpecialization(D2, InsertPos);
+
+    if (const auto *Info = D->getExplicitInstantiationInfo()) {
+      auto ExternKeywordLocOrErr = import(Info->ExternKeywordLoc);
+      if (!ExternKeywordLocOrErr)
+        return ExternKeywordLocOrErr.takeError();
+      auto TemplateKeywordLocOrErr = import(Info->TemplateKeywordLoc);
+      if (!TemplateKeywordLocOrErr)
+        return TemplateKeywordLocOrErr.takeError();
+      TemplateArgumentListInfo ToTAInfo;
+      if (Error Err = ImportTemplateArgumentListInfo(
+              *Info->TemplateArgsAsWritten, ToTAInfo))
+        return std::move(Err);
+      D2->setExplicitInstantiationInfo(*ExternKeywordLocOrErr,
+                                       *TemplateKeywordLocOrErr,
+                                       ASTTemplateArgumentListInfo::Create(
+                                           Importer.getToContext(), ToTAInfo));
+    } else if (const auto *Info = D->getExplicitSpecializationInfo()) {
----------------
erichkeane wrote:

Oh boy, the textual difference between `gtExplicitInstantiationInfo` and `getExplicitSpecializationInfo` is... confusing at times.   

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


More information about the llvm-branch-commits mailing list