[PATCH] D97183: [analyzer] Add NoteTag for smart-ptr get()

Deep Majumder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 2 05:49:58 PST 2021


RedDocMD added a comment.

In D97183#2596865 <https://reviews.llvm.org/D97183#2596865>, @steakhal wrote:

> If the inner pointer participates in a branch condition guarding the dereference, that memory region is gotta be important, right? So, we should mark it so.
> A BugreportVisitor could easily transfer the information about the fact that the dereference was guarded by that particular branch condition - and marking the InnerPointerVal (MemRegion) important.
>
> This way the NoteTag for the `get()` could emit the warning.
>
> The other approach, you @RedDocMD proposed about checking the constraint for the inner pointer, seems somewhat odd to me.
> It could work, but I think the visitor is cleaner.

TBH, I don't like my approach either. I feel that it leaves out some cases.
The InnerPointerVal memory region is not marked as interesting as of now, I have tried that out. The branch condition constraint is set by the ConstraintManager and it is queried via in the State in the method `smartptr::isNullSmartPtr` at `SmartPtrModelling.cpp:104`. I have to see if the `ConstraintManager` can mark the memory region as important. @steakhal, @NoQ what do you think?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97183



More information about the cfe-commits mailing list