[llvm] [docs][langref] Explain c"..." syntax of string constants (PR #84240)

Youngsuk Kim via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 6 14:05:40 PST 2024


JOE1994 wrote:

> String constants are used in `.ll` files with and without the `c` prefix, and the rules about escaping as described in this section still apply to those other uses too. For a few examples of strings, I mean these:
> 
> * `target triple = "x86_64-unknown-linux-gnu"`
> * `!0 = !{i64 0, !"typeid1"}`
> * `@llvm.used = appending global [1 x i8*] [i8* bitcast (i32* @x to i8*)], section "llvm.metadata"`
> * `define void @test() "frame-pointer"="all" gc "statepoint-example" {`
> 
> The `c` prefix indicates that the following string is an llvm::Constant (probably a ConstantDataSequential or ConstantArray) value. The right place to explain them is probably in the [Complex Constants](https://llvm.org/docs/LangRef.html#complex-constants) section?

Thank you so much for your feedback ! 😸

I noticed the `Array constants` subsection of the [Complex Constants](https://llvm.org/docs/LangRef.html#complex-constants) section already explains the `c"..."` format:

> As a special case, character array constants may also be represented as a double-quoted string using the c prefix. For example: “c"Hello World\0A\00"”.

Closing this, as the langref already has explanation for the `c"..."` syntax.

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


More information about the llvm-commits mailing list