[clang] [Clang][Sema] Print more static_assert exprs (PR #74852)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 16 07:01:55 PST 2024


erichkeane wrote:

> I think this change is useful enough on its own that I'd like us to consider merging it: to me, teaching the compiler to do additional diffing or further clarifying the structure of complicated sub-objects feel like they'd benefit from having this work as a fallback. We could then build up from concrete examples of "it would be nice if the compiler diff'd here", and rely on the much more capable (and domain-aware) programmers to use the complete evaluation result for solving the general case.
> 

As I said before, I'm somewhat concerned this makes some situations worse by adding more noise, and is 'useless' in cases where the size is long enough to make the 'difference' invisible.  There is a judgement of value here that I'd probably like to hear the opinion of @AaronBallman and @cor3ntin .

> That said, I'm curious if there's an upper limit we ought to set here on the size of the string: copy & paste work fine for hundreds or even thousands of characters, but if someone `static_assert`s on a multi-GB `const char*`, they might be in for a bit of trouble.

We absolutely should limit the size of the notes, another concern I had though I thought we auto-snipped when printing large structures.  If that doesn't happen, we need to NOT do this patch, crashing a user's terminal is worse than giving them insufficient information.

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


More information about the cfe-commits mailing list