[PATCH] D73958: [AVR] Don't assert on an undefined operand

Dylan McKay via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 4 21:33:00 PST 2020


dylanmckay added inline comments.


================
Comment at: llvm/lib/Target/AVR/MCTargetDesc/AVRInstPrinter.cpp:103
                                   raw_ostream &O) {
+  if (OpNo >= MI->size()) {
+    O << "<unknown>";
----------------
Add a code comment above this, your commit message should do nicely

> Not all operands are correctly disassembled at the moment. This means that some machine instructions won't have all the necessary operands set.
>
> To avoid asserting, print an error instead until the necessary support has been implemented.


================
Comment at: llvm/lib/Target/AVR/MCTargetDesc/AVRInstPrinter.cpp:133
                                    raw_ostream &O) {
+  if (OpNo >= MI->size()) {
+    O << "<unknown>";
----------------
Recommend duplicating the code comment here; the extra verbosity is worth the extra clarity when we come to inevitably remove it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73958





More information about the llvm-commits mailing list