================
@@ -564,6 +564,9 @@ unsigned Parser::ParseAttributeArgsCommon(
               nullptr,
               Sema::ExpressionEvaluationContextRecord::EK_AttrArgument);
 
+          SaveAndRestore<ConversionAction> SavedTranslationState(
+              ParserConversionAction, CA_NoConversion);
----------------
s-barannikov wrote:

What follows is just my thoughts, which may not align well with the standard.

I consider an *evaluated* string to be a string that can be used by the 
compiled program at runtime.
-fexec-charset controls the encoding of such strings.

`asm` statements and the `#pragma map` (I suppose it is vendor-specific) are 
clearly not supposed to be used by the program. Instead, they are processed by 
the host tools (assembler/linker). I agree `-fexec-charset` should not be 
applicable to these string literals, which (in my mindset) means they should be 
*unevaluated*.

Unevaluated strings do not have encoding because they have no "value". Note 
that the standard specifically forbids numerical escape sequences that would 
give value to a character. They are not supposed to make their way into a 
compiler artifact (be it an asm file or an object file). In practice, they do.

Now, if we want to treat an asm string as evaluated, it should respect 
`-fexec-charset` option. Otherwise, it cannot contain octal escapes. If neither 
of that is acceptable, I guess we need to make the desired behavior 
customizable.

 `#pragma map` should have a handler where we can do whatever we want. I don't 
see a problem here, but I may miss something.

Regarding asm statements, I would very much prefer them be unevaluated. I'm not 
sure I understand why do you use escape sequences in asm strings. Does the 
(external) assembler expect EBCDIC input? If so, why only strings from asm 
statements are EBCDIC-encoded and not the rest of the compiler-generated 
assembly file?


https://github.com/llvm/llvm-project/pull/169803
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to