[PATCH] D115938: [clang-format] Formatter does not handle c++11 string literal prefix with stringize #
MyDeveloperDay via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 17 06:39:31 PST 2021
MyDeveloperDay added a comment.
In D115938#3199832 <https://reviews.llvm.org/D115938#3199832>, @curdeius wrote:
> When at it, should we also take care of `LR"(string)"`, `R`, `uR`, `u8R` and `UR`? Cf. https://en.cppreference.com/w/cpp/language/string_literal
> From MS doc:
>
> // Raw string literals containing unescaped \ and "
> auto R0 = R"("Hello \ world")"; // const char*
> auto R1 = u8R"("Hello \ world")"; // const char* before C++20, encoded as UTF-8,
> // const char8_t* in C++20
> auto R2 = LR"("Hello \ world")"; // const wchar_t*
> auto R3 = uR"("Hello \ world")"; // const char16_t*, encoded as UTF-16
> auto R4 = UR"("Hello \ world")"; // const char32_t*, encoded as UTF-32
I did think about that but I was thinking about how would the calling side work?
#define MyRawString(str) R#str
void foo()
{
const char *s = MyRawString("(" Hello \ world ")")
}
I think trying to pass the raw string into the macro confuses it no? this was why I left them out for now. Unless someone can give me an example of how it might work.
Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30137 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
test12.cpp
test12.cpp(5): error C3513: '\': unsupported raw string literal delimiter character
test12.cpp(7): error C3516: unexpected end-of-file found while processing the raw string literal; delimiter sequence '")' was not matched
test12.cpp(5): note: start of raw string literal
test12.cpp(7): fatal error C1903: unable to recover from previous error(s); stopping compilation
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115938/new/
https://reviews.llvm.org/D115938
More information about the cfe-commits
mailing list