[PATCH] D103750: [analyzer][WIP] Handle std::make_unique for SmartPtrModeling

2021-06-11 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD marked an inline comment as done. RedDocMD added inline comments. Comment at: clang/test/Analysis/smart-ptr-text-output.cpp:4 // RUN: -analyzer-config cplusplus.SmartPtrModeling:ModelSmartPtrDereference=true\ // RUN: -analyzer-output=text -std=c++11 %s -verify=expec

[PATCH] D103750: [analyzer][WIP] Handle std::make_unique for SmartPtrModeling

2021-06-11 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 351376. RedDocMD added a comment. Fixed up tests, now also runnning on C++20 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103750/new/ https://reviews.llvm.org/D103750 Files: clang/lib/StaticAnalyzer/Checke

[PATCH] D103750: [analyzer][WIP] Handle std::make_unique for SmartPtrModeling

2021-06-11 Thread Raphael Isemann via Phabricator via cfe-commits
teemperor added a comment. In D103750#2812613 , @RedDocMD wrote: > How do I set the C++ standard while running a test? If I understand your language correctly, then see my inline comment. Comment at: clang/test/Analysis/smart-ptr-text

[PATCH] D103750: [analyzer][WIP] Handle std::make_unique for SmartPtrModeling

2021-06-11 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment. How do I set the C++ standard while running a test? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103750/new/ https://reviews.llvm.org/D103750 ___ cfe-commits mailing list cfe-c

[PATCH] D103750: [analyzer][WIP] Handle std::make_unique for SmartPtrModeling

2021-06-11 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 351356. RedDocMD added a comment. Added tests Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103750/new/ https://reviews.llvm.org/D103750 Files: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp clang

[PATCH] D103750: [analyzer][WIP] Handle std::make_unique for SmartPtrModeling

2021-06-11 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 351349. RedDocMD added a comment. Put changes discussed in the meeting, tests to come in next revision Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103750/new/ https://reviews.llvm.org/D103750 Files: clang

[PATCH] D103750: [analyzer][WIP] Handle std::make_unique for SmartPtrModeling

2021-06-07 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. In D103750#2804438 , @RedDocMD wrote: > Nice. Looks like I have something to read up on. Turns out, I end up learning > something new in C++ every now and then. 😃 Yeah, it's also pretty interesting ABI-wise. As you know, C++ doesn'

[PATCH] D103750: [analyzer][WIP] Handle std::make_unique for SmartPtrModeling

2021-06-07 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment. Nice. Looks like I have something to read up on. Turns out, I end up learning something new in C++ every now and then. 😃 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103750/new/ https://reviews.llvm.org/D103750 ___

[PATCH] D103750: [analyzer][WIP] Handle std::make_unique for SmartPtrModeling

2021-06-07 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. Also congrats, sounds like you are to become the first actual user of this API! Hope it actually works 🤞🤞🤞 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103750/new/ https://reviews.llvm.org/D103750 ___

[PATCH] D103750: [analyzer][WIP] Handle std::make_unique for SmartPtrModeling

2021-06-07 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added a comment. Whoops, I totally missed your point with my suggestion (should not read it while sitting at meetings). But Artem has a great answer already. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103750/new/ https://reviews.llvm.

[PATCH] D103750: [analyzer][WIP] Handle std::make_unique for SmartPtrModeling

2021-06-07 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. In D103750#2803516 , @RedDocMD wrote: > In D103750#2803499 , @NoQ wrote: > >> Ugh, this entire `checkBind` hack was so unexpected that I didn't even >> recognize `evalCall`. What prevents you

[PATCH] D103750: [analyzer][WIP] Handle std::make_unique for SmartPtrModeling

2021-06-07 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added a comment. In D103750#2803516 , @RedDocMD wrote: > In D103750#2803499 , @NoQ wrote: > >> Ugh, this entire `checkBind` hack was so unexpected that I didn't even >> recognize `evalCall`. What preven

[PATCH] D103750: [analyzer][WIP] Handle std::make_unique for SmartPtrModeling

2021-06-07 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment. In D103750#2803499 , @NoQ wrote: > Ugh, this entire `checkBind` hack was so unexpected that I didn't even > recognize `evalCall`. What prevents you from doing everything in `evalCall`? > No state traits, no nothing, just direct

[PATCH] D103750: [analyzer][WIP] Handle std::make_unique for SmartPtrModeling

2021-06-07 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. Ugh, this entire `checkBind` hack was so unexpected that I didn't even recognize `evalCall`. What prevents you from doing everything in `evalCall`? No state traits, no nothing, just directly take the this-region and attach the value to it? Repository: rG LLVM Github Mon

[PATCH] D103750: [analyzer][WIP] Handle std::make_unique for SmartPtrModeling

2021-06-07 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD marked an inline comment as done. RedDocMD added a comment. In D103750#2801555 , @NoQ wrote: > Yes I think you should totally do an `evalCall()` here. The function has no > other side effects apart from making a pointer so it's valuable to fully

[PATCH] D103750: [analyzer][WIP] Handle std::make_unique for SmartPtrModeling

2021-06-07 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD marked 3 inline comments as done. RedDocMD added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp:337 + +bool isUniquePtrType(QualType QT) { + const auto *T = QT.getTypePtr(); NoQ wrote: > Please merge with `isStdSmart

[PATCH] D103750: [analyzer][WIP] Handle std::make_unique for SmartPtrModeling

2021-06-07 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 350362. RedDocMD added a comment. Made stylistic refactors Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103750/new/ https://reviews.llvm.org/D103750 Files: clang/lib/StaticAnalyzer/Checkers/SmartPtrModelin

[PATCH] D103750: [analyzer][WIP] Handle std::make_unique for SmartPtrModeling

2021-06-06 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. Tests pls! Yes I think you should totally do an `evalCall()` here. The function has no other side effects apart from making a pointer so it's valuable to fully model it so that to avoid unnecessary store invalidations. In D103750#2801320

[PATCH] D103750: [analyzer][WIP] Handle std::make_unique for SmartPtrModeling

2021-06-06 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added a comment. > Since we have CallExpr, we can easily conjure up an SVal. But I don't see how > I can do it similarly in this patch. You should have a `CallExpr` for `std::make_unique` too. I believe that expression is used to determine how the conjured symbol was created (to give

[PATCH] D103750: [analyzer][WIP] Handle std::make_unique for SmartPtrModeling

2021-06-06 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 350110. RedDocMD added a comment. Fixed git history Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103750/new/ https://reviews.llvm.org/D103750 Files: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp

[PATCH] D103750: [analyzer][WIP] Handle std::make_unique for SmartPtrModeling

2021-06-06 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 350109. RedDocMD added a comment. Herald added a reviewer: bollu. Reformatted code Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103750/new/ https://reviews.llvm.org/D103750 Files: clang/lib/StaticAnalyzer/

[PATCH] D103750: [analyzer][WIP] Handle std::make_unique for SmartPtrModeling

2021-06-06 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment. In D103750#2801248 , @xazax.hun wrote: > You can always create a new symbol to represent the inner pointer. Something > like this already happens, when you have a unique_ptr formal parameter and > call get on it. The way `hand

[PATCH] D103750: [analyzer][WIP] Handle std::make_unique for SmartPtrModeling

2021-06-06 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added a comment. > I am not being able to use this info since I don't have access to the raw > pointer, so cannot create a `SVal` and then constrain the `SVal` to non-null. > Any suggestions @NoQ, @vsavchenko , @xazax.hun, @teemperor? You can always create a new symbol to represent t

[PATCH] D103750: [analyzer][WIP] Handle std::make_unique for SmartPtrModeling

2021-06-06 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD added a comment. The drawback of the current approach is that we are not using the following piece of information: > std::unique_ptr created from std::make_unique is **not** null (to begin with) I am not being able to use this info since I don't have access to the raw pointer, so cann

[PATCH] D103750: [analyzer][WIP] Handle std::make_unique for SmartPtrModeling

2021-06-06 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 350103. RedDocMD added a comment. Fixed binding of SVal to variable Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103750/new/ https://reviews.llvm.org/D103750 Files: clang/lib/StaticAnalyzer/Checkers/SmartP

[PATCH] D103750: [analyzer][WIP] Handle std::make_unique for SmartPtrModeling

2021-06-05 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 350067. RedDocMD added a comment. Accounting for std::make_unique_for_overwrite Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D103750/new/ https://reviews.llvm.org/D103750 Files: clang/lib/StaticAnalyzer/Che