llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

Support nullable owners (e.g. unique_ptr)

Open oontvoo opened this issue 6 years ago • 4 comments

Please add support for std::unique_ptr and std::shared_ptr!

oontvoo avatar Sep 23 '19 15:09 oontvoo

I believe that unique_ptr is already supported: https://godbolt.org/z/PMYIK6 Do you have another example where it does not work?

mgehre avatar Sep 23 '19 19:09 mgehre

Please see https://godbolt.org/z/hz_jxB.

I was expecting to see warning when I deref the pointer. Perhaps I misunderstood the check?

oontvoo avatar Sep 24 '19 13:09 oontvoo

Having read up a bit more, I've realised you assumed these are not null (unless they're explicitly set to nullptr within the function).

oontvoo avatar Sep 24 '19 14:09 oontvoo

We see the expected warning when replacing a unique_ptr by int* (https://godbolt.org/z/NxBWfK). I'll reword this bug report to implement nullness of Owners. Thanks for reporting!

mgehre avatar Sep 24 '19 18:09 mgehre