[PATCH] D60376: [llvm-objdump] Align instructions to a tab stop

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 12 07:33:33 PDT 2019


MaskRay marked 2 inline comments as done.
MaskRay added inline comments.


================
Comment at: tools/llvm-objdump/llvm-objdump.cpp:622
+      unsigned Column = FOS.getColumn();
+      FOS.indent(Column < TabStop - 1 ? TabStop - 1 - Column : 7 - Column % 8);
+
----------------
jhenderson wrote:
> I can never remember the precedence of `%`, so would you mind adding some brackets to the LHS.
> 
> `7 - Column` seems a bit weird given that `Column` is always going to be bigger than that. Could you rewrite this bit so that it doesn't rely on underflowing?
Multiplication, division and remainder have the same precedence. Just as `1 - 2 / 3` doesn't need parentheses, the remainder expression doesn't need parentheses.

`7 - Column % 8` computes to the range 0~7, there is no underflow.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D60376





More information about the llvm-commits mailing list