[PATCH] D81315: [analyzer] Warning for default constructed unique pointer dereferences

2020-07-08 Thread Nithin VR via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs Review". This revision was automatically updated to reflect the committed changes. Closed by commit rG20e271a98de5: [analyzer] Warning for default constructed unique_ptr dereference (authored by vrnithinkumar). Changed

[PATCH] D81315: [analyzer] Warning for default constructed unique pointer dereferences

2020-07-08 Thread Nithin VR via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG20e271a98de5: [analyzer] Warning for default constructed unique_ptr dereference (authored by vrnithinkumar). Changed prior to commit: https://reviews.llvm.org/D81315?vs=275434=276327#toc Repository:

[PATCH] D81315: [analyzer] Warning for default constructed unique pointer dereferences

2020-07-07 Thread Nithin VR via Phabricator via cfe-commits
vrnithinkumar marked an inline comment as done. vrnithinkumar added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp:202-219 +ProgramStateRef +SmartPtrModeling::updateTrackedRegion(const CallEvent , CheckerContext , +

[PATCH] D81315: [analyzer] Warning for default constructed unique pointer dereferences

2020-07-06 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp:202-219 +ProgramStateRef +SmartPtrModeling::updateTrackedRegion(const CallEvent , CheckerContext , + const MemRegion *ThisValRegion) const { +

[PATCH] D81315: [analyzer] Warning for default constructed unique pointer dereferences

2020-07-06 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus accepted this revision. Szelethus added a comment. This revision is now accepted and ready to land. LGTM! You packed a lot of punch into this patch, and I like it very much. I read the code and everything looks great. I nitpicked on one thing, the `updateTrackedRegion` function is a

[PATCH] D81315: [analyzer] Warning for default constructed unique pointer dereferences

2020-07-03 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ accepted this revision. NoQ added a comment. This looks great to me as long as other reviewers are happy. @vrnithinkumar, I think you should ask for commit access and honorably push the patch to master yourself ^.^ I guess we'll talk about this more, but i think the really good next step

[PATCH] D81315: [analyzer] Warning for default constructed unique pointer dereferences

2020-07-03 Thread Nithin VR via Phabricator via cfe-commits
vrnithinkumar added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrChecker.cpp:41 + + bool checkDeferenceOps(const CallEvent , CheckerContext ) const; +}; NoQ wrote: > Looks like dead code. Thanks! removed. Comment at:

[PATCH] D81315: [analyzer] Warning for default constructed unique pointer dereferences

2020-07-03 Thread Nithin VR via Phabricator via cfe-commits
vrnithinkumar updated this revision to Diff 275434. vrnithinkumar marked 11 inline comments as done. vrnithinkumar added a comment. addressing review comments CHANGES SINCE LAST ACTION https://reviews.llvm.org/D81315/new/ https://reviews.llvm.org/D81315 Files:

[PATCH] D81315: [analyzer] Warning for default constructed unique pointer dereferences

2020-07-02 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. This looks good at a glance to me! I only have minor nits left. It looks like we still need the option to be in place even though we moved the warnings into a separate checker, so that not to accidentally behave worse than with conservative modeling, but it becomes much

[PATCH] D81315: [analyzer] Warning for default constructed unique pointer dereferences

2020-07-02 Thread Nithin VR via Phabricator via cfe-commits
vrnithinkumar updated this revision to Diff 275254. vrnithinkumar added a comment. Addressing review comments CHANGES SINCE LAST ACTION https://reviews.llvm.org/D81315/new/ https://reviews.llvm.org/D81315 Files: clang/docs/analyzer/checkers.rst

[PATCH] D81315: [analyzer] Warning for default constructed unique pointer dereferences

2020-07-02 Thread Nithin VR via Phabricator via cfe-commits
vrnithinkumar marked 4 inline comments as done. vrnithinkumar added inline comments. Comment at: clang/include/clang/StaticAnalyzer/Checkers/Checkers.td:582 + "false", + InAlpha>, + ]>, Szelethus wrote: > Let's `Hide` this in

[PATCH] D81315: [analyzer] Warning for default constructed unique pointer dereferences

2020-07-02 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus added a comment. I only looked at the checker naming issue, and that seems to have been resolved perfectly, thanks! :) Comment at: clang/include/clang/StaticAnalyzer/Checkers/Checkers.td:582 + "false", + InAlpha>, + ]>,

[PATCH] D81315: [analyzer] Warning for default constructed unique pointer dereferences

2020-07-02 Thread Nithin VR via Phabricator via cfe-commits
vrnithinkumar added inline comments. Comment at: clang/include/clang/StaticAnalyzer/Checkers/Checkers.td:577-583 + CheckerOptions<[ +CmdLineOption, + ]>, Szelethus wrote: > NoQ wrote: > > Szelethus wrote: > > > This goes against D81750 -- Sorry for not

[PATCH] D81315: [analyzer] Warning for default constructed unique pointer dereferences

2020-07-02 Thread Nithin VR via Phabricator via cfe-commits
vrnithinkumar updated this revision to Diff 275076. vrnithinkumar marked 14 inline comments as done. vrnithinkumar added a comment. Herald added a subscriber: mgorny. - Created a new checker for smart point derference diagnostic - Moved checking part to this checker - Kept all the modeling in

[PATCH] D81315: [analyzer] Warning for default constructed unique pointer dereferences

2020-07-02 Thread Nithin VR via Phabricator via cfe-commits
vrnithinkumar marked 2 inline comments as done. vrnithinkumar added inline comments. Comment at: clang/include/clang/StaticAnalyzer/Checkers/Checkers.td:574 -def SmartPtrModeling: Checker<"SmartPtr">, +def SmartPtrModeling: Checker<"SmartPtrModeling">, HelpText<"Model

[PATCH] D81315: [analyzer] Warning for default constructed unique pointer dereferences

2020-06-29 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus added inline comments. Comment at: clang/include/clang/StaticAnalyzer/Checkers/Checkers.td:577-583 + CheckerOptions<[ +CmdLineOption, + ]>, NoQ wrote: > Szelethus wrote: > > This goes against D81750 -- Sorry for not bringing this up earlier, but

[PATCH] D81315: [analyzer] Warning for default constructed unique pointer dereferences

2020-06-29 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments. Comment at: clang/include/clang/StaticAnalyzer/Checkers/Checkers.td:577-583 + CheckerOptions<[ +CmdLineOption, + ]>, Szelethus wrote: > This goes against D81750 -- Sorry for not bringing this up earlier, but you > can't emit

[PATCH] D81315: [analyzer] Warning for default constructed unique pointer dereferences

2020-06-29 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp:139 + + const auto *MethodDecl = dyn_cast_or_null(OC->getDecl()); + You should never get null here due to `isStdSmartPointerClass` guarding above. I think the

[PATCH] D81315: [analyzer] Warning for default constructed unique pointer dereferences

2020-06-29 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp:148 +if (InnerPointVal && InnerPointVal->isZeroConstant()) { + reportBug(C, Call); +} This doesn't seem to be guarded by `ShouldCheckSmartPtrDereference`.

[PATCH] D81315: [analyzer] Warning for default constructed unique pointer dereferences

2020-06-29 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus requested changes to this revision. Szelethus added a comment. This revision now requires changes to proceed. I have a few pending patches that enforce some long desired restrictions on which checkers can emit diagnostics, and I'd prefer not to mess with your checker after you land

[PATCH] D81315: [analyzer] Warning for default constructed unique pointer dereferences

2020-06-26 Thread Nithin VR via Phabricator via cfe-commits
vrnithinkumar marked 2 inline comments as done. vrnithinkumar added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp:117-118 - // TODO: Add a note to bug reports describing this decision. - C.addTransition( -

[PATCH] D81315: [analyzer] Warning for default constructed unique pointer dereferences

2020-06-26 Thread Nithin VR via Phabricator via cfe-commits
vrnithinkumar updated this revision to Diff 273841. vrnithinkumar added a comment. Moving dereference precondition checks into `checkPreCall`. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D81315/new/ https://reviews.llvm.org/D81315 Files:

[PATCH] D81315: [analyzer] Warning for default constructed unique pointer dereferences

2020-06-26 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp:117-118 - // TODO: Add a note to bug reports describing this decision. - C.addTransition( - State->BindExpr(Call.getOriginExpr(), C.getLocationContext(), -

[PATCH] D81315: [analyzer] Warning for default constructed unique pointer dereferences

2020-06-25 Thread Nithin VR via Phabricator via cfe-commits
vrnithinkumar added a comment. In D81315#2079457 , @Szelethus wrote: > Best of luck on your GSoC! I don't have much else to add to your patch, but > you seem to have made good progress already! Thanks! > In D81315#2078043

[PATCH] D81315: [analyzer] Warning for default constructed unique pointer dereferences

2020-06-25 Thread Nithin VR via Phabricator via cfe-commits
vrnithinkumar updated this revision to Diff 273568. vrnithinkumar marked 16 inline comments as done. vrnithinkumar added a comment. Addressing review comments CHANGES SINCE LAST ACTION https://reviews.llvm.org/D81315/new/ https://reviews.llvm.org/D81315 Files:

[PATCH] D81315: [analyzer] Warning for default constructed unique pointer dereferences

2020-06-25 Thread Nithin VR via Phabricator via cfe-commits
vrnithinkumar added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp:35 bool isNullAfterMoveMethod(const CallEvent ) const; + BugType NullDereferenceBugType{this, "Null-smartPtr-deref", + "C++ smart

[PATCH] D81315: [analyzer] Warning for default constructed unique pointer dereferences

2020-06-14 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp:124 +return; + updateTrackedRegion(Call, C, ThisValRegion); +} NoQ wrote: > Not all constructors behave this way. In particular, if it's a copy/move > constructor

[PATCH] D81315: [analyzer] Warning for default constructed unique pointer dereferences

2020-06-14 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp:35 bool isNullAfterMoveMethod(const CallEvent ) const; + BugType NullDereferenceBugType{this, "Null-smartPtr-deref", + "C++ smart pointer"};

[PATCH] D81315: [analyzer] Warning for default constructed unique pointer dereferences

2020-06-13 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. Hey, that's a lot of progress already! =) Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp:124 +return; + updateTrackedRegion(Call, C, ThisValRegion); +} Not all constructors behave this way. In particular, if it's a

[PATCH] D81315: [analyzer] Warning for default constructed unique pointer dereferences

2020-06-12 Thread Nithin VR via Phabricator via cfe-commits
vrnithinkumar marked 38 inline comments as done. vrnithinkumar added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp:31 namespace { -class SmartPtrModeling : public Checker { +struct RegionState { +private: vsavchenko wrote:

[PATCH] D81315: [analyzer] Warning for default constructed unique pointer dereferences

2020-06-12 Thread Nithin VR via Phabricator via cfe-commits
vrnithinkumar updated this revision to Diff 270391. vrnithinkumar retitled this revision from "[analyzer][Draft] [Prototype] warning for default constructed unique pointer dereferences" to "[analyzer] Warning for default constructed unique pointer dereferences". vrnithinkumar added a comment.