[clang] [clang][ASTImporter] Fix import of template parameter default values. (PR #100100)

DonĂ¡t Nagy via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 26 02:11:31 PDT 2024


================
@@ -359,6 +359,31 @@ namespace clang {
           Params, Importer.getToContext().getTranslationUnitDecl());
     }
 
+    template <typename TemplateParmDeclT>
+    void tryUpdateTemplateParmDeclInheritedFrom(NamedDecl *RecentParm,
+                                                NamedDecl *NewParm) {
+      if (auto *ParmT = dyn_cast<TemplateParmDeclT>(RecentParm)) {
+        if (ParmT->hasDefaultArgument()) {
+          auto *P = cast<TemplateParmDeclT>(NewParm);
+          P->removeDefaultArgument();
+          P->setInheritedDefaultArgument(Importer.ToContext, ParmT);
+        }
+      }
+    }
+
+    void updateTemplateParametersInheritedFrom(
----------------
NagyDonat wrote:

Thanks for the clarifications!

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


More information about the cfe-commits mailing list