================
@@ -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),
----------------
Fznamznon wrote:

I wish it did. This particular line helps for generic case of `#embed`  inside 
of an initializer list. The rest that this patch is adding is for #embed "fast 
path" where we simply put StringLiteral to the initializer list instead of 
EmbedExpr when a single #embed is used to initialize char array.
When we do that, the iterators of EmbedExpr won't be in use and the fail from 
https://github.com/llvm/llvm-project/issues/119256 is still in place.

https://github.com/llvm/llvm-project/pull/127629
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to