Patchwork Go patch committed: Don't encode non-ASCII characters in identifiers

login
register
mail settings
Submitter Ian Taylor
Date Dec. 3, 2012, 6:57 a.m.
Message ID <mcrwqwzsjw7.fsf@google.com>
Download mbox | patch
Permalink /patch/203295/
State New
Headers show

Comments

Ian Taylor - Dec. 3, 2012, 6:57 a.m.
Go permits non-ASCII characters in identifiers.  A long time ago I
thought I needed to encode those before passing them to GIMPLE.  Looking
at the -fextended-identifiers support, I see that that should not be
true.  This patch removes the encoding.  This should give a better
debugging experience and will fix the names used in type reflection.
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian

Patch

diff -r c2163c885896 go/lex.cc
--- a/go/lex.cc	Sun Dec 02 19:23:21 2012 -0800
+++ b/go/lex.cc	Sun Dec 02 22:49:14 2012 -0800
@@ -915,12 +915,8 @@ 
 	    }
 	  if (is_invalid && !Lex::is_invalid_identifier(buf))
 	    buf.append("$INVALID$");
+	  buf.append(p, pnext - p);
 	  p = pnext;
-	  char ubuf[50];
-	  // This assumes that all assemblers can handle an identifier
-	  // with a '$' character.
-	  snprintf(ubuf, sizeof ubuf, "$U%x$", ci);
-	  buf.append(ubuf);
 	}
     }
   Location location = this->location();