Skip to content

Commit a6324c9

Browse files
committed
Disable trigraph and escaped newline expansion on all types of raw string literals not just ASCII type.
llvm-svn: 251025
1 parent e015f66 commit a6324c9

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

clang/lib/Lex/Lexer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ static size_t getSpellingSlow(const Token &Tok, const char *BufPtr,
235235
size_t Length = 0;
236236
const char *BufEnd = BufPtr + Tok.getLength();
237237

238-
if (Tok.is(tok::string_literal)) {
238+
if (tok::isStringLiteral(Tok.getKind())) {
239239
// Munch the encoding-prefix and opening double-quote.
240240
while (BufPtr < BufEnd) {
241241
unsigned Size;

clang/test/CodeGen/string-literal.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,30 @@ def)" "ghi";
102102
??=
103103
def)";
104104

105+
// CHECK-CXX11: private unnamed_addr constant [13 x i8] c"def\5C\0A??=\0Aabc\00", align 1
106+
const char *s = u8R\
107+
"(def\
108+
??=
109+
abc)";
110+
111+
// 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
112+
const char16_t *t = uR\
113+
"(abc\
114+
??=
115+
def)";
116+
117+
// 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
118+
const char32_t *u = UR\
119+
"(abc\
120+
??=
121+
def)";
122+
123+
// 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
124+
const wchar_t *v = LR\
125+
"(def\
126+
??=
127+
abc)";
128+
105129
#endif
106130
#endif
107131
}

0 commit comments

Comments
 (0)