[PATCH] D43470: [DebugInfo] Prevent crash when .debug_line line_range is zero

Paul Robinson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 5 07:40:47 PST 2020


probinson added a comment.

One more small bit of cleanup.



================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp:606
          Opcode >= LineTable->Prologue.OpcodeBase);
+  StringRef OpcodeName = getOpcodeName(Opcode, LineTable->Prologue.OpcodeBase);
+  if (ReportBadLineRange && LineTable->Prologue.LineRange == 0)
----------------
This could go under the `if` as you don't need the name unless you are reporting the warning.


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp:615
+                          LineTableOffset, OpcodeName.data(), OpcodeOffset));
+  ReportBadLineRange = false;
+
----------------
Setting the flag to false can go under the `if` to help distinguish error handling from functional code.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D43470





More information about the llvm-commits mailing list