[llvm-branch-commits] [clang] release/20.x: [clang] Introduce "binary" StringLiteral for #embed data (#127629) (PR #133460)

Aaron Ballman via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Apr 14 05:40:26 PDT 2025


================
@@ -1752,7 +1752,14 @@ enum class StringLiteralKind {
   UTF8,
   UTF16,
   UTF32,
-  Unevaluated
+  Unevaluated,
+  // Binary kind of string literal is used for the data coming via #embed
+  // directive. File's binary contents is transformed to a special kind of
+  // string literal that in some cases may be used directly as an initializer
+  // and some features of classic string literals are not applicable to this
+  // kind of a string literal, for example finding a particular byte's source
+  // location for better diagnosing.
+  Binary
----------------
AaronBallman wrote:

This is *not* an ABI break despite adding a new enumerator; the enumeration is scoped, so the underlying type is `int` and thus this doesn't widen it.

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


More information about the llvm-branch-commits mailing list