[PATCH] D77598: Integral template argument suffix and cast printing

Pratyush Das via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Dec 20 08:04:39 PST 2020


reikdas marked 22 inline comments as done.
reikdas added inline comments.


================
Comment at: clang/lib/AST/TemplateBase.cpp:111-115
+          Out << "u8'" << Val << "'";
+        else if (T->isUnsignedIntegerType() && T->isChar16Type())
+          Out << "u16'" << Val << "'";
+        else if (T->isUnsignedIntegerType() && T->isChar32Type())
+          Out << "u32'" << Val << "'";
----------------
rsmith wrote:
> This isn't correct: `u8'x'` will print as `u8'120'`. Perhaps you can factor code to do this properly out of `StmtPrinter::VisitCharacterLiteral`.
> 
> Also, the prefix for `char16_t` literals is `u`, not `u16`, and the prefix for `char32_t` literals is `U`, not `u32`.
> This isn't correct: `u8'x'` will print as `u8'120'`. Perhaps you can factor code to do this properly out of `StmtPrinter::VisitCharacterLiteral`.

I partially addressed this comment. I wasn't able to find a suitable example to test `u8'x'` being printed as `u8'120'`. @rsmith could you please help me by showing me a reproducer?




CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77598/new/

https://reviews.llvm.org/D77598



More information about the cfe-commits mailing list