[PATCH] D26829: [clang] Allow lexer to handle string_view literals

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 19 15:59:05 PST 2016


On 19 Nov 2016 2:36 am, "Anton Bikineev" <ant.bikineev at gmail.com> wrote:

AntonBikineev added inline comments.


================
Comment at: lib/Lex/LiteralSupport.cpp:1716-1717
+StringLiteralParser::UDSuffixResult
+StringLiteralParser::isValidUDSuffix(const LangOptions &LangOpts,
+                                     StringRef Suffix) {
+  if (!LangOpts.CPlusPlus11 || Suffix.empty())
----------------
rsmith wrote:
> Just make this call `NumericLiteralParser::isValidUDSuffix` and then
check for the `sv` case. All the numeric suffixes are also valid string
literal suffixes for the form `operator""suffix`.
This makes sense for the call sites we currently have.
> All the numeric suffixes are also valid string literal suffixes for the
form operator""suffix.
Don't really understand this part. It seems inconsistent if one calls, say,
``` StringLiteralParser::isValidUDSuffix(LangOpts(), "if")  ```
 and gets
```true```


That is valid in the case of `operator ""if`, so `if` is a valid string
literal suffix (as is any numeric literal suffix).

https://reviews.llvm.org/D26829
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161119/8a2bdd97/attachment.html>


More information about the cfe-commits mailing list