cor3ntin added a comment. >> We should use the original source form of the string literal when >> pretty-printing a `StringLiteral` or `CharacterLiteral`; there are a bunch >> of UTF-8 assumptions baked into `StmtPrinter` that will need revisiting. And >> we'll need to modify the handful of places that put the contents of >> `StringLiteral`s into diagnostics (`#warning`, `#error`, `static_assert`) >> and make them use a different `ConversionState`, since our assumption is >> that diagnostic output should be in UTF-8. > > Yes, these are some of the complications we will need to visit in later > patches. We may need to somehow save the original string or reverse the > translation.
The operation is destructive and therefore cannot be reverted. So I do believe the correct behavior here would indeed be to keep the original spelling around - with *some* of phase 5 applied (replacement of UCNs and replacement of numeric escape sequences. An alternative would be to do the conversion lazily when the strings are evaluated, rather than during lexing, although that might be more involved Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D93031/new/ https://reviews.llvm.org/D93031 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits