[PATCH] D104616: [analyzer][WIP] Model comparision methods of std::unique_ptr

Gábor Horváth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 21 06:02:49 PDT 2021


xazax.hun added a comment.

In D104616#2829705 <https://reviews.llvm.org/D104616#2829705>, @RedDocMD wrote:

> If `(ptr1 == ptr2)` is false, we can't say anything really.

Well, I think it depends. If one of the pointers is null, for some platforms, we can. E.g. null < non-null is probably true on most architectures, and similarly non-null < null is false. Also null <= anyptr is probably true on the platforms we care about.

> If they are not the same, the only way == can return true if the two smart pointers were initialized from the same raw pointer. This is of course a fatal bug in itself.

Is it? E.g. two default constructed unique_ptrs both should have null as the underlying pointer, they should be considered equal, are not the same object, and this is not a fatal bug.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104616/new/

https://reviews.llvm.org/D104616



More information about the cfe-commits mailing list