[PATCH] D155610: [Clang][ExprConstant] Print integer instead of character on static assertion failure
Corentin Jabot via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 31 04:49:18 PDT 2023
cor3ntin 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,
----------------
The use UCN addition is probably not justified. we should consistent in how we print the value of non-printable code points.
================
Comment at: clang/lib/Sema/SemaDeclCXX.cpp:16836-16837
+ const char CharArr[] = {static_cast<char>(CharVal)};
+ pushEscapedString(StringRef(CharArr, sizeof(CharArr)), Str,
+ /*UseUCN=*/true);
+ }
----------------
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)
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155610/new/
https://reviews.llvm.org/D155610
More information about the cfe-commits
mailing list