[PATCH] D81315: [Draft] [Prototype] warning for default constructed unique pointer dereferences

Nithin VR via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 5 16:16:10 PDT 2020


vrnithinkumar created this revision.
vrnithinkumar added reviewers: vsavchenko, xazax.hun, NoQ.
Herald added subscribers: cfe-commits, martong, Charusso, rnkovacs.
Herald added a project: clang.

This is just a prototype review for my changes since I thought it will be easier to ask code related doubts here.

I just wanted to share how I prototyped the checker for default constructed unique pointer dereferences.
It is incomplete. Not added tests. Not all cases covered. Reporting part is not proper. **This may be a throw away code.**

I am sharing this so that if I am fundamentally wrong in any of my directions it will be much better to catch early and rectify.

- Added a two maps to track  mem region and corresponding states and Symbols to mem region
- Created a RegionState to track information about the state of memory region whether it is null or not or unknown
- Using PostCall to update the states of mem region
- Using PreCall to check the null pointer dereferences

**Few doubts:**
I am not sure about whether I should use `eval::Call` or both `check::PreCall` and `check::PostCall`.
In the `eval::Call` documentation I found this "Note, that only one checker can evaluate a call.". So I am little bit confused about using it.

Using one map for tracking the mem region and states then one more for Symbols to region to track which all Symbol has the inner pointer.
I am just looking is there any better approach for this.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81315

Files:
  clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81315.268952.patch
Type: text/x-patch
Size: 7519 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200605/fa710dce/attachment.bin>


More information about the cfe-commits mailing list