mgehre / llvm-project

The home of the clang-based implementation of lifetime safety warnings.
39 stars 4 forks source link

Support nullable owners (e.g. unique_ptr) #63

Open oontvoo opened 5 years ago

oontvoo commented 5 years ago

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

mgehre commented 5 years ago

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

oontvoo commented 5 years ago

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 commented 5 years ago

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).

mgehre commented 5 years ago

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!