[PATCH] D26667: Teach clang that 'sv' is a fine literal suffix

Marshall Clow via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 15 07:02:16 PST 2016


mclow.lists created this revision.
mclow.lists added a reviewer: rsmith.
mclow.lists added a subscriber: cfe-commits.

Last week, WG21 approved a paper (http://wg21.link/P0403) for allowing literal suffixes for `string_view`. This means that should be able to write:

  constexpr std::string_view sv = "1234"sv;

However, clang has a list of all the allowable suffixes. Update the list to include `"sv"`


https://reviews.llvm.org/D26667

Files:
  lib/Lex/LiteralSupport.cpp


Index: lib/Lex/LiteralSupport.cpp
===================================================================
--- lib/Lex/LiteralSupport.cpp
+++ lib/Lex/LiteralSupport.cpp
@@ -765,6 +765,7 @@
       .Cases("h", "min", "s", true)
       .Cases("ms", "us", "ns", true)
       .Cases("il", "i", "if", true)
+      .Case("sv", true)
       .Default(false);
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26667.77993.patch
Type: text/x-patch
Size: 350 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161115/49f78c4c/attachment.bin>


More information about the cfe-commits mailing list