[llvm-commits] [llvm] r57538 - in /llvm/trunk: docs/LangRef.html lib/VMCore/AsmWriter.cpp test/Assembler/2008-10-14-QuoteInName.ll

Daniel Dunbar daniel at zuster.org
Tue Oct 14 16:51:44 PDT 2008


Author: ddunbar
Date: Tue Oct 14 18:51:43 2008
New Revision: 57538

URL: http://llvm.org/viewvc/llvm-project?rev=57538&view=rev
Log:
Prevent assert when using '"' in names (via hexadecimal).

Update LangRef to mention \xx quoting in names.

Added:
    llvm/trunk/test/Assembler/2008-10-14-QuoteInName.ll
Modified:
    llvm/trunk/docs/LangRef.html
    llvm/trunk/lib/VMCore/AsmWriter.cpp

Modified: llvm/trunk/docs/LangRef.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=57538&r1=57537&r2=57538&view=diff

==============================================================================
--- llvm/trunk/docs/LangRef.html (original)
+++ llvm/trunk/docs/LangRef.html Tue Oct 14 18:51:43 2008
@@ -335,8 +335,9 @@
   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>"</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>

Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=57538&r1=57537&r2=57538&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)
+++ llvm/trunk/lib/VMCore/AsmWriter.cpp Tue Oct 14 18:51:43 2008
@@ -112,10 +112,9 @@
   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 << '\\';

Added: llvm/trunk/test/Assembler/2008-10-14-QuoteInName.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/2008-10-14-QuoteInName.ll?rev=57538&view=auto

==============================================================================
--- llvm/trunk/test/Assembler/2008-10-14-QuoteInName.ll (added)
+++ llvm/trunk/test/Assembler/2008-10-14-QuoteInName.ll Tue Oct 14 18:51:43 2008
@@ -0,0 +1,3 @@
+; RUN: llvm-as < %s | llvm-dis | grep "quote"
+
+@"a\22quote" = global i32 0





More information about the llvm-commits mailing list