[PATCH] D93031: Enable fexec-charset option

Abhina Sree via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 30 07:22:58 PST 2020

abhina.sreeskantharajan added inline comments.

Comment at: clang/lib/Lex/LiteralSupport.cpp:1593-1597
+  ConversionState State = TranslationState;
+  if (Kind == tok::wide_string_literal)
+    State = TranslateToSystemCharset;
+  else if (isUTFLiteral(Kind))
+    State = NoTranslation;
tahonermann wrote:
> The stored `TranslationState` should not be completely ignored for wide and UTF string literals.  The standard permits things like the following.
>   #pragma rigoot L"bozit"
>   #pragma rigoot u"bozit"
>   _Pragma(L"rigoot bozit")
>   _Pragma(u8"rigoot bozit")
> For at least the `_Pragma(L"...")` case, the C++ standard [[ http://eel.is/c++draft/cpp.pragma.op | states ]] the `L` is ignored, but it doesn't say anything about other encoding prefixes.
Please correct me if I'm wrong, these Pragma strings are not parsed through StringLiteralParser, they are parsed in **clang/lib/Lex/Pragma.cpp** in this function.
**void Preprocessor::Handle_Pragma(Token &Tok)**
So if they require translation, it would need to be done in that function.

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list