-
Notifications
You must be signed in to change notification settings - Fork 11.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[dataflow][nfc] Fix u8 string usage with c++20 #84291
Conversation
@llvm/pr-subscribers-clang-analysis @llvm/pr-subscribers-clang Author: Vincent Lee (thevinster) ChangesClang returns an error when compiling this file with c++20
It seems like c++20 treats u8strings differently than strings (probably needs char8_t). Full diff: https://github.com/llvm/llvm-project/pull/84291.diff 1 Files Affected:
diff --git a/clang/lib/Analysis/FlowSensitive/HTMLLogger.cpp b/clang/lib/Analysis/FlowSensitive/HTMLLogger.cpp
index ff4e18de2c70f1..d9f40d28859f5e 100644
--- a/clang/lib/Analysis/FlowSensitive/HTMLLogger.cpp
+++ b/clang/lib/Analysis/FlowSensitive/HTMLLogger.cpp
@@ -500,7 +500,7 @@ class HTMLLogger : public Logger {
for (unsigned I = 0; I < CFG.getNumBlockIDs(); ++I) {
std::string Name = blockID(I);
// Rightwards arrow, vertical line
- char ConvergenceMarker[] = u8"\\n\u2192\u007c";
+ char ConvergenceMarker[] = "\\n\u2192\u007c";
if (BlockConverged[I])
Name += ConvergenceMarker;
GraphS << " " << blockID(I) << " [id=" << blockID(I) << " label=\""
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, and sorry for the breeakage!
@@ -500,7 +500,7 @@ class HTMLLogger : public Logger { | |||
for (unsigned I = 0; I < CFG.getNumBlockIDs(); ++I) { | |||
std::string Name = blockID(I); | |||
// Rightwards arrow, vertical line | |||
char ConvergenceMarker[] = u8"\\n\u2192\u007c"; | |||
char ConvergenceMarker[] = "\\n\u2192\u007c"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thevinster @martinboehme This change now fails on MSVC builds:
warning C4566: character represented by universal-character-name '\u2192' cannot be represented in the current code page (1252)
Maybe try this instead?
const char *ConvergenceMarker = (const char*)u8"\\n\u2192\u007c";
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Will revert and re-land with your suggestion. Sorry for the breakage!
This reverts commit 6e79f77.
Reverts #84291 The patch broke Windows builds.
See also discussion on llvm#84291.
New attempt: #84302 |
See also discussion on #84291.
Clang returns an error when compiling this file with c++20
It seems like c++20 treats u8strings differently than strings (probably needs char8_t).
Make this a string to fix the error.