[PATCH] D155610: [Clang][ExprConstant] Print integer instead of character on static assertion failure

Takuya Shimizu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 19 02:58:39 PDT 2023


hazohelet added a comment.

In D155610#4511547 <https://reviews.llvm.org/D155610#4511547>, @tbaeder wrote:

> What if you switch from `IgnoreParenImpCasts` at the top of `DiagnoseStaticAssertDetails()` to just `IgnoreParens()`? That improve cases where we simply compare a character literal to an integer, since the literal should be implicitly cast to an integer.

It results in printing everything including `char` and `bool` as integer.
I wanted to print `true` and `false` instead of `1` and `0`, so ignored the implicit casts when the user-provided expression is bool type.

I think it would look nicer to print the character representation as well when it is not non-printable


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155610/new/

https://reviews.llvm.org/D155610



More information about the cfe-commits mailing list