[PATCH] D65191: [llvm-objdump] Implement highlighting

Jordan Rupprecht via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 15 16:09:48 PDT 2019


rupprecht added inline comments.


================
Comment at: llvm/tools/llvm-objdump/llvm-objdump.cpp:365
+
+static WithColor withHighlightColor(ObjdumpColor Color) {
+  auto Pair = HighlightColors.find(Color);
----------------
IIUC, using `WithColor` to do nested coloring doesn't really work -- `~WithColor` resets the terminal color to plain, *not* to what the color was before. So if you have some stream of characters like:
AAABBBCCCBBB
where A maps to no coloring (X), B maps to red (R), and C maps to green (G), you should want to see:
XXXRRRGGGRRR
But I think it will actually be:
XXXRRRGGGXXX
because ~WithColor will reset to plain after closing the span of green.

In practice, I'm not sure any assembly actually has anything after nested spans -- the end of any nested span will line up with the span it's nested in. Still, it seems fragile/something that should be checked for somehow. Is this something you're handling somewhere that I'm just missing?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65191





More information about the llvm-commits mailing list