LLVM (golang): Unescaped global strings?

Viewed 27

I'm writing my own compiler using LLVM and I'm trying to implement string literals. By the way, I'm also using LLVM bindings for Golang from tinygo: https://github.com/tinygo-org/go-llvm

this is how I create a global string pointer:

Builder.CreateGlobalStringPtr(str, "")

when I output the LLVM bitcode and disassemble it, the global string pointer looks like this:

@1 = private unnamed_addr constant [14 x i8] c"hello world\\n\00", align 1

when I use fmt.Println() to check the value of a string that I'm passing to the builder method it looks like this:

hello world\n

As you can see there's no extra back slash in the new line character. How can I get rid of it?

0 Answers
Related