[PATCH] D153990: [DebugInfo][RemoveDIs] Add prototype storage classes for non-instruction variable debug-info

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 2 03:34:52 PDT 2023


jmorse marked an inline comment as done.
jmorse added inline comments.


================
Comment at: llvm/include/llvm/IR/DebugProgramInstruction.h:368
+  static iterator_range<simple_ilist<DPValue>::iterator> getEmptyDPValueRange(){
+    return make_range(EmptyDPMarker.StoredDPValues.begin(), EmptyDPMarker.StoredDPValues.end());
+  }
----------------
Orlando wrote:
> > This will bite us if someone tries to insert a DPValue in that range
> 
> Is there no way to create an empty range without an object to grab iterators from?
> 
> If not, you could return `make_range(EmptyDPMarker.StoredDPValues.end(), EmptyDPMarker.StoredDPValues.end());` (end(), end()) to avoid those issues? wdyt?
> 
> 
> 
> 
> 
We can generate iterators with nullptr pointers in them, and they'll compare equal indicating that the range is empty, but I fear this is going to be leaning on undefined behaviour in some way that comes back to bite us later. Returning end-end ranges sounds good, hopefully any faults that cause things to be stored in EmptyDPMarker will then trigger the leak-sanitizer buildbots.


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

https://reviews.llvm.org/D153990



More information about the llvm-commits mailing list