[PATCH] D108469: Improve handling of static assert messages.Instead of dumping the string literal (whichquotes it and escape every non-ascii symbol),we can use the content of the string(which we know is valid UTF-8 by virtue if being aunevaluated string).
Corentin Jabot via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 20 09:07:48 PDT 2021
cor3ntin created this revision.
Herald added a subscriber: martong.
cor3ntin requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
...g).
`FormatDiagnostic` is modified to escape
non printable characters and invalid UTF-8.
This ensures that unicode characters, spaces and new
lines are properly rendered in static messages.
This make clang more consistent with other implementation
and fixes this tweet
https://twitter.com/jfbastien/status/1298307325443231744 :)
Of note, `PaddingChecker` did print out new lines that were
later remove by the diagnostic printing code.
To be consistent with its tests, the new lines are removed
from the diagnostic.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D108469
Files:
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Basic/Diagnostic.cpp
clang/lib/Sema/SemaDeclCXX.cpp
clang/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp
clang/test/CXX/expr/expr.prim/expr.prim.id/p3.cpp
clang/test/Lexer/null-character-in-literal.c
clang/test/Misc/diag-special-chars.c
clang/test/PCH/cxx-static_assert.cpp
clang/test/Sema/static-assert.c
clang/test/SemaCXX/int-ptr-cast-SFINAE.cpp
clang/test/SemaCXX/static-assert.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108469.367801.patch
Type: text/x-patch
Size: 18351 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210820/2ec2d968/attachment-0001.bin>
More information about the cfe-commits
mailing list