[clang] [clang-tools-extra] [clang][NFC] Un-constify `MultiLevelTemplateArgumentList` (PR #104687)

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 19 13:03:28 PDT 2024


mizvekov wrote:

Yes, I think it's ok having the template instantiator own these lists, but only copy them when needed.

Note I have a WIP patch that will eventually touch this area and this may force me to seek a solution here.

Basically TemplateArgument lists will need to get the AST node uniquing treatment, in order to reduce the costs of adding template argument lists to AST nodes, as we will be able to represent them with a single pointer, and compare lists by just comparing pointers.

The losses from the extra indirection needs to be offset by decreases in AST node sizes and the amount of template argument list copying all around. Eventually this may get into MLTAL, and we will need to be extra careful with these modifications.

In that case, an MLTAL would be a vector of TemplateArgumentList, but the template instantiator would need to own a vector of vector (or equivalent) of template arguments, which would only be populated on modification.

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


More information about the cfe-commits mailing list