[Lldb-commits] [PATCH] D55653: Check pointer results on nullptr before using them

Shafik Yaghmour via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 14 12:05:40 PST 2019


shafik added a comment.

Looks like a great fix!



================
Comment at: MIDataTypes.h:67
+template <typename T>
+class MIDereferenceable {
+public:
----------------
Can we use `llvm::Optional` instead? Then we can use `getValueOr()`.


================
Comment at: MIDataTypes.h:71
+
+  T *Or(T &alt_value) { return m_ptr ? m_ptr : &alt_value; }
+private:
----------------
If we can not use `llvm::Optional` then why not just take `T *`?


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

https://reviews.llvm.org/D55653





More information about the lldb-commits mailing list