[PATCH] D65189: [MC] Support returning a structured rich disassembly output
Seiya Nuta via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 7 19:45:04 PDT 2019
seiya planned changes to this revision.
seiya marked an inline comment as done.
seiya added a comment.
I'll try out the destructor approach suggested by @rupprecht.
================
Comment at: llvm/lib/MC/MCInstPrinter.cpp:159
+ if (!M.Spans.empty()) {
+ assert(M.Spans.size() > 1 && "Missing the corresponding markupStart().");
+ M.Spans.pop();
----------------
rupprecht wrote:
> Another design consideration would be to put the functionality of `endMarkup()` into the destructor `MarkupStart::~MarkupStart()`
>
> e.g.
> ```
> OS << startMarkup(MarkupType::Reg) << '%' << getRegisterName(RegNo)
> << endMarkup();
> ```
> turns into:
> ```
> OS << startMarkup(MarkupType::Reg) << '%' << getRegisterName(RegNo); /* ~MarkupStart() ends the markup */
> ```
>
> Though it would require changing all the call sites so the register/operand/whatever can be printed as part of the same `OS << ...` expression, so I wouldn't recommend trying that until later. But it may be worth looking into to avoid programmer error of forgetting either of markupStart()/markupEnd()
The destructor approach sounds good idea! I'll try it.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65189/new/
https://reviews.llvm.org/D65189
More information about the llvm-commits
mailing list