rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

LGTM


================
Comment at: lib/AST/StmtPrinter.cpp:1253-1256
@@ -1252,2 +1252,6 @@
   default:
+    // A character literal might be sign-extended, which
+    // would result in an invalid \U escape sequence.
+    if ((value & ~0xFFu) == ~0xFFu && Node->getKind() == 
CharacterLiteral::Ascii)
+      value &= 0xFFu;
     if (value < 256 && isPrintable((unsigned char)value))
----------------
Hmm, this is not correct for multicharacter `char` literals:

  auto n = '\xff\xff\xff\xff';

Here, the value of the literal is -1, but printing it as '\xff' would give a 
literal of a different type. However, we get that case wrong here in general 
(printing invalid \U... escapes), so this is no worse than today. Can you add a 
FIXME?


http://reviews.llvm.org/D17206



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to