[clang] [Clang][NFCI] Slightly refactor getTemplateInstantiationArgs() (PR #102922)

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 13 20:36:29 PDT 2024


zyn0217 wrote:

> simplify the function to the following signature:

I'm afraid we couldn't. We have one reliance on the `DC` parameter in constraint expression comparison, where we're unable to obtain a Decl as that is not formed yet. So dropping the `DC` parameter doesn't work here.

If you probably meant to add another overload, I think that might work; although it looks the same way we add another bool flag.

> As an improvement on that, we can basically reuse the logic we already have for deciding which parent to visit next, which is already used in the normal case [...] or just add an internal 'bool' parameter that controls if the implementation will add the template parameters, and call that from the 'Innermost' path with adding the arguments disabled

Yeah, this is tempting; I was also thinking about adding an additional parameter, but that somehow makes the function more complicated and I do feel like ending up with many bool flags results in a heavier maintenance burden..

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


More information about the cfe-commits mailing list