[PATCH] D105045: [lld-macho] Deduplicate CFStrings

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 1 16:40:18 PDT 2021


int3 added inline comments.


================
Comment at: lld/test/MachO/cfstring-dedup.s:75
+  .quad  l_.str.2
+  .quad  4 ## strlen
+
----------------
gkm wrote:
> Length of UTF-8 "foo" is 3, but length of UTF-16 "foo" (or rather "foo\0") is 4? I do see that `l_.str.2` has an extra 0 terminator. Is that detail relevant? If so, it could use a comment.
yeah, the idea was to check that we would correctly handle utf-16 strings with null bytes in them. TBH, utf-8 *should* support encoding null bytes too, but 1) ld64 doesn't handle that correctly either and 2) clang will generate utf-16 CFStrings if their literal contains a null byte. Yeah, I'll add all that in a comment...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105045



More information about the llvm-commits mailing list