summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-01-02 18:14:06 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-01-02 18:14:06 +0000
commitdbfd4037fccf619c08bf76abea29608cfe0eb922 (patch)
tree117efa07120b37288171eb32fb5657553f4aa0d8 /clang/lib/AST
parent8e25104b108ad0d40c144e9eeae374e3eb6607a7 (diff)
downloadbcm5719-llvm-dbfd4037fccf619c08bf76abea29608cfe0eb922.tar.gz
bcm5719-llvm-dbfd4037fccf619c08bf76abea29608cfe0eb922.zip
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
Diffstat (limited to 'clang/lib/AST')
-rw-r--r--clang/lib/AST/StmtPrinter.cpp2
1 files changed, 1 insertions, 1 deletions
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]
OpenPOWER on IntegriCloud