[PATCH] D123702: [NVPTX] Disable parens for identifiers starting with '$'

Artem Belevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 15 14:50:41 PDT 2022


tra added inline comments.


================
Comment at: llvm/lib/MC/MCAsmStreamer.cpp:2256
+       << "offset: " << F.getOffset() << ", value: ";
+    F.getValue()->print(OS, MAI);
+    OS << ", kind: " << Info.Name << "\n";
----------------
asavonic wrote:
> tra wrote:
> > This is awkward. 
> > Perhaps we should consider adding some sort of `withMAI(F.getValue(), MAI)` -> std::pair<MCExpr*, MCAsmInfo*> wrapper and an overloaded `operator<<` to catch it and pass MAI along to MCExpr::print().
> Well, this is how MCExpr is printed for assembly output - there are more than 50 occurrences in this file (also in MCTargetDesc). I personally find these two forms equally readable, so it's probably not worth it to refactor everything...
Up to you. I would find having to break `OS <<  A << B ....` chain for some values, but it's indeed a cosmetic change. It could be done as a clean-up in a separate patch.


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

https://reviews.llvm.org/D123702



More information about the llvm-commits mailing list