================
@@ -80,6 +80,81 @@ struct Response {
     return R;
   }
 };
+
+// Retrieve the primary template for a lambda call operator. It's
+// unfortunate that we only have the mappings of call operators rather
+// than lambda classes.
+const FunctionDecl *
+getPrimaryTemplateOfGenericLambda(const FunctionDecl *LambdaCallOperator) {
+  while (true) {
----------------
zyn0217 wrote:

(Sorry for replying this late, I just got around to this PR.)

> What cases do we have where this takes more than 1 step?
The lambda itself might be defined within a template, and I presume 
transforming that template introduces multilevel mappings.

> I also wonder if we'd be better off finding the primary `CXXRecordDecl`, then 
> picking it up from there? We could use `getTemplateInstantiationPattern` then 
> `getDescribedClassTemplate` I think?

If we examine `TemplateInstantiator::transformedLocalDecl`, we'd see there's 
only handling for `CXXMethodDecls` of adding such mappings that we can extract 
from the Decls themselves. I think it is possible that we can use the primary 
`CXXRecordDecl` approach, although looking for that Decl might involve handling 
`LocalInstantiationScopes`, which IMO is not super straightforward.

https://github.com/llvm/llvm-project/pull/82310
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to