================
@@ -1611,15 +1618,32 @@ 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());
+ // FIXME: We can lose sugars when profiling Arg.
+ Arg.Profile(ID, SemaRef.Context);
+ if (auto Iter = Cache->find(ID); Iter != Cache->end()) {
+ Output = Iter->second;
+ return false;
+ }
+ bool Ret = inherited::TransformTemplateArgument(Input, Output, Uneval);
+ if (!Ret)
+ Cache->insert({ID, Output});
+ return Ret;
+ }
switch (Arg.getKind()) {
- case TemplateArgument::Pack:
+ case TemplateArgument::Pack: {
+ std::vector<TemplateArgument> TArgs;
----------------
cor3ntin wrote:
That is unused
https://github.com/llvm/llvm-project/pull/188421
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits