[clang] [clang] Fix handling of asm string literals (PR #169803)

Hubert Tong via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 7 19:27:32 PST 2026


hubert-reinterpretcast wrote:

> This patch builds upon #138895 and introduces a new ConversionAction parameter to ParseStringLiteralExpression to allow asm strings to be parsed in the target default encoding initially to convert escape sequences, and then back to UTF8 when printed in the IR.

Would be more accurate to say "[...] to UTF-8 for further processing (e.g., parsing for operand references)."

Also, the review feedback has made the scope of the PR more narrow. Should probably say "[...] to allow asm strings to be, for z/OS, initially evaluated in IBM-1047 (so that numeric escape sequences denote IBM-1047 code points) before being converted to UTF-8 [...]".

> If there is a constexpr in the asm string, it will be parsed in the literal encoding.

Here, there is no "parsing" in the literal encoding per se. We should instead say: "If there is a constexpr in place of the asm string, the sequence of `char` values produced will be converted (for all targets, not only for z/OS) from the literal encoding to UTF-8 for further processing, except when the literal encoding is UTF-8."

Regarding the PR title:
> [clang] Fix handling of asm string literals 

Apart from having trailing whitespace, it implies both too broad a scope (non-specific "handling" of asm string literals) and too narrow a scope ("string literals"). Suggestion:
> [clang] Fix encoding-related handling of asm strings

https://github.com/llvm/llvm-project/pull/169803


More information about the cfe-commits mailing list