[clang] Implement -ftype-print-limit=N (PR #239419)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 5 19:11:54 PST 2026


erichkeane wrote:

> I think the question of what we should do in LLVM IR is separate from the question of what we want diagnostics to look like.
> 
> If types are expensive to print for LLVM IR, we should cut them down aggressively; the user will never see those types, unless they're digging into LLVM IR by hand. We can disambiguate with numbered suffixes like .1/.2/etc.

I can look into this, we definitely do that for SOME types, but not all of them, like the ones in the test

> For printing types for users to read, I think we want some sort of depth-based heuristic; if you have `X<Y<1,2,3,4,5,6,[...]>, Z<int>>`, the `Z<int>` is more likely to be relevant than printing more arguments to Y.

I considered that, but then something like the standard library (std::vector for example), where the 'later' the argument, the less you care about it, as that is where the SFINAE and allocators and default args go, etc.  Also, if you have some srot of expansion, it is more likely to be following a pattern.

I can definitely switch this to give up at 'depth' if you all think that is superior.  I was afraid that this would result in missing the 'first' 'leaf' note.  

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


More information about the cfe-commits mailing list