From dbfd4037fccf619c08bf76abea29608cfe0eb922 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Mon, 2 Jan 2012 18:14:06 +0000 Subject: 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. llvm-svn: 147438 --- clang/lib/AST/StmtPrinter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'clang/lib/AST/StmtPrinter.cpp') diff --git a/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp index 6408c879fa2..836f192aeb1 100644 --- a/clang/lib/AST/StmtPrinter.cpp +++ b/clang/lib/AST/StmtPrinter.cpp @@ -717,7 +717,7 @@ void StmtPrinter::VisitStringLiteral(StringLiteral *Str) { 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] -- cgit v1.2.3