[clang] [AST] Fix printing of large 64-bit unsigned template arguments (PR #129235)

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 28 09:12:11 PST 2025


https://github.com/mizvekov requested changes to this pull request.

What problem is this trying to fix here?

At first glance, I think it's a problem that we ast-print instantiations as explicit specializations. If we fix that, does your problem go away?

Secondly, I agree that if we would print an implicit instantiation as a specialization, then we should use canonical arguments, and these should be printed with the expected suffix, but this patch is too narrow focused on 64-bit unsigned.

I think the right approach here would be that if we have a converted template argument, then we might as well consider it to be canonical and print it always suffixed. If we didn't lose the as-writen argument, then we would have an expression and these would always print as-written.

I think the above change would be justified by design, but I am not sure that motivation aligns with ROOTs needs here.
It would make ast-print more consistent, but it shouldn't change semantics of the code if it round trips.

On a related note, if we do explicit specialization in source code, then we always print the argument suffixed, but we shouldn't in this case, and also the same incorrect thing happens for the declaration of the explicit instantiation.

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


More information about the cfe-commits mailing list