1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

Prevent assert when using '"' in names (via hexadecimal).

Update LangRef to mention \xx quoting in names.

llvm-svn: 57538
This commit is contained in:
Daniel Dunbar 2008-10-14 23:51:43 +00:00
parent f3b4f45878
commit e11e618cc6
3 changed files with 7 additions and 4 deletions

View File

@ -335,8 +335,9 @@ the parser.</p>
For example, %foo, @DivisionByZero, %a.really.long.identifier. The actual
regular expression used is '<tt>[%@][a-zA-Z$._][a-zA-Z$._0-9]*</tt>'.
Identifiers which require other characters in their names can be surrounded
with quotes. In this way, anything except a <tt>&quot;</tt> character can
be used in a named value.</li>
with quotes. Special characters may be escaped using "\xx" where xx is the
ASCII code for the character in hexadecimal. In this way, any character can
be used in a name value, even quotes themselves.
<li>Unnamed values are represented as an unsigned numeric value with their
prefix. For example, %12, @2, %44.</li>

View File

@ -112,10 +112,9 @@ static void PrintLLVMName(raw_ostream &OS, const char *NameStr,
OS << '"';
for (unsigned i = 0; i != NameLen; ++i) {
char C = NameStr[i];
assert(C != '"' && "Illegal character in LLVM value name!");
if (C == '\\') {
OS << "\\\\";
} else if (isprint(C)) {
} else if (C != '"' && isprint(C)) {
OS << C;
} else {
OS << '\\';

View File

@ -0,0 +1,3 @@
; RUN: llvm-as < %s | llvm-dis | grep "quote"
@"a\22quote" = global i32 0