[PATCH] D128294: [ADT] [lld-macho] Check for end iterator deref in filter_iterator_base

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 21 11:33:46 PDT 2022


int3 added inline comments.


================
Comment at: lld/MachO/InputFiles.cpp:1016
   auto it = units.begin();
-  compileUnit = it->get();
+  compileUnit = (it != units.end()) ? it->get() : nullptr;
 }
----------------
parens unnecessary


================
Comment at: lld/test/MachO/dwarf-no-compile-unit.yaml:3-4
+
+## Check that LLD does not crash if it encounters DWARF sections
+## without __debug_info compile units DIEs being present.
+
----------------
how was this generated?


================
Comment at: llvm/include/llvm/ADT/STLExtras.h:447-456
+
+  decltype(auto) operator*() const {
+    assert(BaseT::wrapped() != End && "Cannot dereference end iterator!");
+    return BaseT::operator*();
+  }
+
+  decltype(auto) operator->() const {
----------------
this seems like it should be a separate commit


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

https://reviews.llvm.org/D128294



More information about the llvm-commits mailing list