Add assertion to char32_t that the value is valid, as suggested by Jordy Rose.
Add a test that such characters don't make it through to StringLiteral objects
in error recovery.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147438 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/StmtPrinter.cpp b/lib/AST/StmtPrinter.cpp
index 6408c87..836f192 100644
--- a/lib/AST/StmtPrinter.cpp
+++ b/lib/AST/StmtPrinter.cpp
@@ -717,7 +717,7 @@
default:
// FIXME: Is this the best way to print wchar_t?
if (Char > 0xff) {
- // char32_t values are <= 0x10ffff.
+ assert(Char <= 0x10ffff && "invalid unicode codepoint");
if (Char > 0xffff)
OS << "\\U00"
<< Hex[(Char >> 20) & 15]