-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[lldb] Add assert to NonNullSharedPtr move constructor #168979
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@llvm/pr-subscribers-lldb Author: Jonas Devlieghere (JDevlieghere) ChangesAs suggested by Augusto, add an assert to the NonNullSharedPtr move constructor. Full diff: https://github.com/llvm/llvm-project/pull/168979.diff 1 Files Affected:
diff --git a/lldb/include/lldb/Utility/NonNullSharedPtr.h b/lldb/include/lldb/Utility/NonNullSharedPtr.h
index 7e12ce72c6238..5011822503c77 100644
--- a/lldb/include/lldb/Utility/NonNullSharedPtr.h
+++ b/lldb/include/lldb/Utility/NonNullSharedPtr.h
@@ -29,12 +29,13 @@ template <typename T> class NonNullSharedPtr : private std::shared_ptr<T> {
public:
NonNullSharedPtr(const std::shared_ptr<T> &t)
: Base(t ? t : std::make_shared<T>()) {
- assert(t && "NonNullSharedPtr initialized from NULL shared_ptr");
+ assert(t && "NonNullSharedPtr constructed from nullptr");
}
- NonNullSharedPtr(std::shared_ptr<T> &&t)
- : Base(t ? std::move(t) : std::make_shared<T>()) {
- // Can't assert on t as it's been moved-from.
+ NonNullSharedPtr(std::shared_ptr<T> &&t) : Base(std::move(t)) {
+ assert(*this && "NonNullSharedPtr constructed from nullptr");
+ if (!t)
+ Base::operator=(std::make_shared<T>());
}
NonNullSharedPtr(const NonNullSharedPtr &other) : Base(other) {}
|
As suggested by Augusto, add an assert to NonNullSharedPtr move constructor.
f54999c to
8807e1b
Compare
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/59/builds/27661 Here is the relevant piece of the build log for the reference |
As suggested by Augusto, add an assert to the NonNullSharedPtr move constructor.
As suggested by Augusto, add an assert to the NonNullSharedPtr move constructor.
As suggested by Augusto, add an assert to the NonNullSharedPtr move constructor. (cherry picked from commit cf837e2)
As suggested by Augusto, add an assert to the NonNullSharedPtr move constructor.
As suggested by Augusto, add an assert to the NonNullSharedPtr move constructor.