File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
lldb/include/lldb/Utility Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -29,12 +29,14 @@ template <typename T> class NonNullSharedPtr : private std::shared_ptr<T> {
2929public:
3030 NonNullSharedPtr (const std::shared_ptr<T> &t)
3131 : Base(t ? t : std::make_shared<T>()) {
32- assert (t && " NonNullSharedPtr initialized from NULL shared_ptr " );
32+ assert (t && " NonNullSharedPtr constructed from nullptr " );
3333 }
3434
35- NonNullSharedPtr (std::shared_ptr<T> &&t)
36- : Base(t ? std::move(t) : std::make_shared<T>()) {
37- // Can't assert on t as it's been moved-from.
35+ NonNullSharedPtr (std::shared_ptr<T> &&t) : Base(std::move(t)) {
36+ const auto b = static_cast <bool >(*this );
37+ assert (b && " NonNullSharedPtr constructed from nullptr" );
38+ if (!b)
39+ Base::operator =(std::make_shared<T>());
3840 }
3941
4042 NonNullSharedPtr (const NonNullSharedPtr &other) : Base(other) {}
You can’t perform that action at this time.
0 commit comments