[ASTDumper] Add some more character escapes for convenience.

llvm-svn: 287859
This commit is contained in:
Benjamin Kramer 2016-11-24 09:41:33 +00:00
parent 1a2ac9bda5
commit 60a53d5e16
2 changed files with 7 additions and 4 deletions

View File

@ -970,10 +970,13 @@ void StringLiteral::outputString(raw_ostream &OS) const {
// Handle some common non-printable cases to make dumps prettier.
case '\\': OS << "\\\\"; break;
case '"': OS << "\\\""; break;
case '\n': OS << "\\n"; break;
case '\t': OS << "\\t"; break;
case '\a': OS << "\\a"; break;
case '\b': OS << "\\b"; break;
case '\f': OS << "\\f"; break;
case '\n': OS << "\\n"; break;
case '\r': OS << "\\r"; break;
case '\t': OS << "\\t"; break;
case '\v': OS << "\\v"; break;
}
}
OS << '"';

View File

@ -1,7 +1,7 @@
// RUN: %clang_cc1 -std=c++11 -ast-dump %s -triple x86_64-linux-gnu | FileCheck %s
char c8[] = u8"test\0\\\"\t\a\b\234";
// CHECK: StringLiteral {{.*}} lvalue u8"test\000\\\"\t\a\b\234"
char c8[] = u8"test\0\\\"\a\b\f\n\r\t\v\234";
// CHECK: StringLiteral {{.*}} lvalue u8"test\000\\\"\a\b\f\n\r\t\v\234"
char16_t c16[] = u"test\0\\\"\t\a\b\234\u1234";
// CHECK: StringLiteral {{.*}} lvalue u"test\000\\\"\t\a\b\234\u1234"