[clang] [clang] Introduce "binary" StringLiteral for #embed data (PR #127629)

via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 18 06:15:28 PST 2025


================
@@ -4965,9 +4966,9 @@ class EmbedExpr final : public Expr {
       assert(EExpr && CurOffset != ULLONG_MAX &&
              "trying to dereference an invalid iterator");
       IntegerLiteral *N = EExpr->FakeChildNode;
-      StringRef DataRef = EExpr->Data->BinaryData->getBytes();
       N->setValue(*EExpr->Ctx,
-                  llvm::APInt(N->getValue().getBitWidth(), DataRef[CurOffset],
+                  llvm::APInt(N->getValue().getBitWidth(),
+                              EExpr->Data->BinaryData->getCodeUnit(CurOffset),
----------------
cor3ntin wrote:

If you change that line (and nothing else) does it still works?
I have a feeling this is enough

https://github.com/llvm/llvm-project/pull/127629


More information about the cfe-commits mailing list