tatyana-krasnukha added a comment. Thanks for the review!
================ Comment at: MIDataTypes.h:67 +template <typename T> +class MIDereferenceable { +public: ---------------- shafik wrote: > Can we use `llvm::Optional` instead? Then we can use `getValueOr()`. Unfortunately no, with `Optional<T*>` getValueOr doesn't have the constraint that alternative value is not nullptr. In case of `Optional<T>` getValueOr returns T by value which is not what we need. ================ Comment at: MIDataTypes.h:71 + + T *Or(T &alt_value) { return m_ptr ? m_ptr : &alt_value; } +private: ---------------- shafik wrote: > If we can not use `llvm::Optional` then why not just take `T *`? It is easier to read: ``` const char *pFileName = GetDereferenceable(fileSpec.GetFilename()).Or(*pUnknown); ``` vs ``` const char *pFileName = fileSpec.GetFilename(); pFileName = (pFileName != nullptr) ? pFileName : pUnknown; ``` isn't it? CHANGES SINCE LAST ACTION https://reviews.llvm.org/D55653/new/ https://reviews.llvm.org/D55653 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits