[PATCH] D105759: Implement P2361 Unevaluated string literals

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 26 09:14:27 PDT 2023


shafik accepted this revision.
shafik added a comment.

LGTM but I don't see `asm` covered in the tests.



================
Comment at: clang/lib/AST/Expr.cpp:1140
+  case Unevaluated:
+    return sizeof(char); // Host;
+    break;
----------------
Why not grouped w/ `Ordinary` above?


================
Comment at: clang/lib/AST/Expr.cpp:1165
+    unsigned CharByteWidth = mapCharByteWidth(Ctx.getTargetInfo(), Kind);
+    unsigned ByteLength = Str.size();
+    assert((ByteLength % CharByteWidth == 0) &&
----------------
Isn't this the same as `Length`?


================
Comment at: clang/lib/AST/Expr.cpp:1201
   // Initialize the trailing array of char holding the string data.
-  std::memcpy(getTrailingObjects<char>(), Str.data(), ByteLength);
+  std::memcpy(getTrailingObjects<char>(), Str.data(), Str.size());
 
----------------
Isn't `Str.size()` the same as `ByteLength`? 


================
Comment at: clang/lib/Lex/LiteralSupport.cpp:90
 
+static bool EscapeValidInUnevaluatedStringLiteral(char Escape) {
+  switch (Escape) {
----------------
Should we use `Is` as a prefix here? Right now it should like we are modifying something.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105759



More information about the cfe-commits mailing list