https://github.com/HighCommander4 commented:

Thanks very much for looking at this!

I'm wondering if it's possible to achieve the same results (and also solve your 
`CXXUnresolvedConstructExpr` issue) with a more targeted change that may also 
be simpler.

While I haven't experimented with this approach to verify that it's feasible, 
here's what I had in mind:

 * In a suitable place where we simplify dependent types (I'm thinking around 
[here](https://searchfox.org/mozilla-central/rev/fe8b30e982c86d26ccf1f14d825c0de870b91f27/build/clang-plugin/mozsearch-plugin/from-clangd/HeuristicResolver.cpp#59)),
 check if the type is a `TemplateTypeParmType`.
 * If so, get its `TemplateTypeParmDecl`, find the template whose parameter it 
is, and see if the template has a `getOnlyInstantiation`. If so, find the 
argument type substituted for this template parameter, and replace the template 
parameter with this type.

As a bonus, the "default argument heuristic" discussed 
[here](https://github.com/clangd/clangd/discussions/1056) could be implemented 
in the same place. (Even if the template doesn't have exactly one 
instantiation, if the template parameter has a default argument, replace the 
template parameter with the default argument.)

I _think_ this should handle the cases in this testcase without the need for 
any Visitor, though it's definitely possible I'm overlooking something.

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

Reply via email to