[llvm] [Minidump] Support multiple exceptions in a minidump (PR #107319)

Pavel Labath via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 5 01:22:39 PDT 2024


================
@@ -216,8 +219,68 @@ class MinidumpFile : public Binary {
     bool IsEnd;
   };
 
+  class ExceptionStreamsIterator {
+  public:
+    static ExceptionStreamsIterator begin(ArrayRef<minidump::Directory> Streams,
+                                          const MinidumpFile *File) {
+      return ExceptionStreamsIterator(Streams, File);
+    }
+
+    static ExceptionStreamsIterator end() { return ExceptionStreamsIterator(); }
+
+    bool operator==(const ExceptionStreamsIterator &R) const {
+      return Streams.empty() && R.Streams.empty();
+    }
+
+    bool operator!=(const ExceptionStreamsIterator &R) const {
+      return !(*this == R);
+    }
+
+    Expected<const minidump::ExceptionStream &> operator*() {
+      return ReadCurrent();
+    }
+
+    Expected<const minidump::ExceptionStream &> operator->() {
+      return ReadCurrent();
+    }
----------------
labath wrote:

This is fairly unusual. Normally, `it->` returns a pointer to the result of `*it` so that `it->foo` and `(*it).foo` do the same thing. With this design, there isn't any object we could point, so maybe you could just drop this function? 

https://github.com/llvm/llvm-project/pull/107319


More information about the llvm-commits mailing list