[PATCH] D105759: Implement P2361 Unevaluated string literals

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 26 09:52:46 PDT 2023


cor3ntin marked 43 inline comments as done.
cor3ntin added inline comments.


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


================
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());
 
----------------
shafik wrote:
> Isn't `Str.size()` the same as `ByteLength`? 
ByteLength isn't defined in this scope, I guess i could move it.


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