[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
Mon Jul 31 10:38:13 PDT 2023
hazohelet added inline comments.
================
Comment at: clang/lib/Basic/Diagnostic.cpp:838-858
+ if (UseUCN)
+ OutStream << "\\u"
+ << llvm::format_hex_no_prefix(CodepointValue, /*Width=*/4,
+ /*Upper=*/false);
+ else
+ OutStream << "<U+"
+ << llvm::format_hex_no_prefix(CodepointValue, /*Width=*/4,
----------------
cor3ntin wrote:
> The use UCN addition is probably not justified. we should consistent in how we print the value of non-printable code points.
My motivation here is to print a valid character literal. I think it justifies this change somewhat. I'd like to see what others think about this.
================
Comment at: clang/lib/Sema/SemaDeclCXX.cpp:16836-16837
+ const char CharArr[] = {static_cast<char>(CharVal)};
+ pushEscapedString(StringRef(CharArr, sizeof(CharArr)), Str,
+ /*UseUCN=*/true);
+ }
----------------
cor3ntin wrote:
> A different way to do that would be to have a 'Escape Whitespaces' parameter on pushEscapedString that would also escape \t, \n, etc (I don't think we want to escape SPACE)
If you mean `\u0020` by SPACE, it won't be escaped by this code.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155610/new/
https://reviews.llvm.org/D155610
More information about the cfe-commits
mailing list