================
@@ -1611,15 +1620,39 @@ namespace {
       }
       return Type;
     }
+
     // Override the default version to handle a rewrite-template-arg-pack case
-    // for building a deduction guide.
+    // for building a deduction guide, and to cache substitution results in
+    // concepts checking.
     bool TransformTemplateArgument(const TemplateArgumentLoc &Input,
                                    TemplateArgumentLoc &Output,
                                    bool Uneval = false) {
       const TemplateArgument &Arg = Input.getArgument();
-      std::vector<TemplateArgument> TArgs;
+      if (auto *Cache = SemaRef.CurrentCachedTemplateArgs;
+          Cache && TemplateArgsHashValue) {
+        llvm::FoldingSetNodeID ID = *TemplateArgsHashValue;
+        ID.AddInteger(SemaRef.ArgPackSubstIndex.toInternalRepresentation());
+        Arg.Profile(ID, SemaRef.Context);
+        // FIXME: We should ideally only cache and restore TemplateArgument and
+        // rebuild the uncached TypeLoc separately in place. However this is
+        // nearly impossible given the current architecture of TreeTransform so
+        // that we have to lose TypeLoc fidelity in cases where TypeLocs are
----------------
mizvekov wrote:

I'd say that the transforms for `TemplateArgument` are inconsistent with the 
TreeTransform architecture, and that's why this is hard here.

All the other transforms leave the rebuilding of source locations to the caller 
side, which if TemplateArgument transform followed here, would make this fairly 
trivial.

https://github.com/llvm/llvm-project/pull/188421
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to