[PATCH] D26829: [clang] Allow lexer to handle string_view literals
Anton Bikineev via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 18 02:23:53 PST 2016
AntonBikineev updated this revision to Diff 78490.
https://reviews.llvm.org/D26829
Files:
include/clang/Basic/DiagnosticLexKinds.td
lib/Lex/Lexer.cpp
Index: lib/Lex/Lexer.cpp
===================================================================
--- lib/Lex/Lexer.cpp
+++ lib/Lex/Lexer.cpp
@@ -1713,6 +1713,13 @@
getLangOpts());
if (!isIdentifierBody(Next)) {
// End of suffix. Check whether this is on the whitelist.
+ if (Chars == 2 && Buffer[0] == 's' && Buffer[1] == 'v') {
+ IsUDSuffix = true;
+ if (!getLangOpts().CPlusPlus1z)
+ Diag(CurPtr, diag::warn_cxx1z_string_view_literal)
+ << FixItHint::CreateInsertion(getSourceLocation(CurPtr), " ");
+ break;
+ }
IsUDSuffix = (Chars == 1 && Buffer[0] == 's') ||
NumericLiteralParser::isValidUDSuffix(
getLangOpts(), StringRef(Buffer, Chars));
Index: include/clang/Basic/DiagnosticLexKinds.td
===================================================================
--- include/clang/Basic/DiagnosticLexKinds.td
+++ include/clang/Basic/DiagnosticLexKinds.td
@@ -186,6 +186,8 @@
"hexadecimal floating literals are incompatible with "
"C++ standards before C++1z">,
InGroup<CXXPre1zCompatPedantic>, DefaultIgnore;
+def warn_cxx1z_string_view_literal : Warning<
+ "string_view literals are a C++1z feature">, InGroup<CXX1z>;
def ext_binary_literal : Extension<
"binary integer literals are a GNU extension">, InGroup<GNUBinaryLiteral>;
def ext_binary_literal_cxx14 : Extension<
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26829.78490.patch
Type: text/x-patch
Size: 1486 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161118/5d999806/attachment.bin>
More information about the cfe-commits
mailing list