r251025 - Disable trigraph and escaped newline expansion on all types of raw string literals not just ASCII type.

Craig Topper via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 22 08:35:21 PDT 2015


Author: ctopper
Date: Thu Oct 22 10:35:21 2015
New Revision: 251025

URL: http://llvm.org/viewvc/llvm-project?rev=251025&view=rev
Log:
Disable trigraph and escaped newline expansion on all types of raw string literals not just ASCII type.

Modified:
    cfe/trunk/lib/Lex/Lexer.cpp
    cfe/trunk/test/CodeGen/string-literal.c

Modified: cfe/trunk/lib/Lex/Lexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Lexer.cpp?rev=251025&r1=251024&r2=251025&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/Lexer.cpp (original)
+++ cfe/trunk/lib/Lex/Lexer.cpp Thu Oct 22 10:35:21 2015
@@ -235,7 +235,7 @@ static size_t getSpellingSlow(const Toke
   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;

Modified: cfe/trunk/test/CodeGen/string-literal.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/string-literal.c?rev=251025&r1=251024&r2=251025&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/string-literal.c (original)
+++ cfe/trunk/test/CodeGen/string-literal.c Thu Oct 22 10:35:21 2015
@@ -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
 }




More information about the cfe-commits mailing list