From a9d73e2d9f1cc91d272e2f8512cd73f32ca807cb Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Thu, 22 Oct 2015 15:35:21 +0000 Subject: [PATCH] Disable trigraph and escaped newline expansion on all types of raw string literals not just ASCII type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251025 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Lex/Lexer.cpp | 2 +- test/CodeGen/string-literal.c | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp index 4007914b6c..a3ec1b3b0e 100644 --- a/lib/Lex/Lexer.cpp +++ b/lib/Lex/Lexer.cpp @@ -235,7 +235,7 @@ static size_t getSpellingSlow(const Token &Tok, const char *BufPtr, size_t Length = 0; const char *BufEnd = BufPtr + Tok.getLength(); - if (Tok.is(tok::string_literal)) { + if (tok::isStringLiteral(Tok.getKind())) { // Munch the encoding-prefix and opening double-quote. while (BufPtr < BufEnd) { unsigned Size; diff --git a/test/CodeGen/string-literal.c b/test/CodeGen/string-literal.c index 8bc97f1887..c460187436 100644 --- a/test/CodeGen/string-literal.c +++ b/test/CodeGen/string-literal.c @@ -102,6 +102,30 @@ def)" "ghi"; ??= def)"; + // CHECK-CXX11: private unnamed_addr constant [13 x i8] c"def\5C\0A??=\0Aabc\00", align 1 + const char *s = u8R\ +"(def\ +??= +abc)"; + + // CHECK-CXX11: private unnamed_addr constant [13 x i16] [i16 97, i16 98, i16 99, i16 92, i16 10, i16 63, i16 63, i16 61, i16 10, i16 100, i16 101, i16 102, i16 0], align 2 + const char16_t *t = uR\ +"(abc\ +??= +def)"; + + // CHECK-CXX11: private unnamed_addr constant [13 x i32] [i32 97, i32 98, i32 99, i32 92, i32 10, i32 63, i32 63, i32 61, i32 10, i32 100, i32 101, i32 102, i32 0], align 4 + const char32_t *u = UR\ +"(abc\ +??= +def)"; + + // CHECK-CXX11: private unnamed_addr constant [13 x i32] [i32 100, i32 101, i32 102, i32 92, i32 10, i32 63, i32 63, i32 61, i32 10, i32 97, i32 98, i32 99, i32 0], align 4 + const wchar_t *v = LR\ +"(def\ +??= +abc)"; + #endif #endif } -- 2.50.1