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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 12 05:58:47 PDT 2025


================
@@ -1332,6 +1334,11 @@ StringLiteral::getLocationOfByte(unsigned ByteNo, const SourceManager &SM,
                                  const LangOptions &Features,
                                  const TargetInfo &Target, unsigned *StartToken,
                                  unsigned *StartTokenByteOffset) const {
+  // No source location of bytes for binary literals since they don't come from
+  // source.
+  if (getKind() == StringLiteralKind::Binary)
+    return getStrTokenLoc(0);
----------------
AaronBallman wrote:

Does this mean that diagnostics involving invalid use of binary string literals will have no source location to point to?

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


More information about the cfe-commits mailing list