Until now, we have only used string literals to initialise arrays of i8 if they do not contain a null terminator or interior null bytes. In other cases, a braced initialiser with a list of integer literals is used. This creates very poor readability for LLVM IR that is using non-null-terminated strings, which is very common in e.g. Rust.
It turns out that you can use string literals to initialise character arrays in C without them having to be null-terminated. The C spec says (emphasis mine):
An array of character type may be initialized by a character string literal, optionally enclosed in braces. Successive characters of the character string literal (including the terminating null character if there is room or if the array is of unknown size) initialize the elements of the array.
Therefore, this commit does so. It greatly improves the readability of non-null-terminated i8 strings, though it will make non-character i8 data more verbose and, subject to taste, possibly less readable.
(See https://github.com/JuliaComputingOSS/llvm-cbe/issues/124 for more background.)
Until now, we have only used string literals to initialise arrays of i8 if they do not contain a null terminator or interior null bytes. In other cases, a braced initialiser with a list of integer literals is used. This creates very poor readability for LLVM IR that is using non-null-terminated strings, which is very common in e.g. Rust.
It turns out that you can use string literals to initialise character arrays in C without them having to be null-terminated. The C spec says (emphasis mine):
Therefore, this commit does so. It greatly improves the readability of non-null-terminated i8 strings, though it will make non-character i8 data more verbose and, subject to taste, possibly less readable.