[PATCH] D55804: [analyzer] C++17: Fix leak false positives when an object with destructor is returned from the top frame.

2018-12-19 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL349696: [analyzer] Improve modeling for returning an object from the top frame with RVO. (authored by dergachev, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit:

[PATCH] D55804: [analyzer] C++17: Fix leak false positives when an object with destructor is returned from the top frame.

2018-12-19 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments. Comment at: lib/StaticAnalyzer/Core/ExprEngineCXX.cpp:224 +bool IsArray = false; +V = makeZeroElementRegion(State, V, ReturnTy, IsArray); +assert(!IsArray && "Returning array from a function!"); dcoughlin wrote:

[PATCH] D55804: [analyzer] C++17: Fix leak false positives when an object with destructor is returned from the top frame.

2018-12-19 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ updated this revision to Diff 178936. NoQ marked 2 inline comments as done. NoQ added a comment. Fxd! CHANGES SINCE LAST ACTION https://reviews.llvm.org/D55804/new/ https://reviews.llvm.org/D55804 Files: lib/StaticAnalyzer/Core/ExprEngineCXX.cpp test/Analysis/temporaries.cpp Index:

[PATCH] D55804: [analyzer] C++17: Fix leak false positives when an object with destructor is returned from the top frame.

2018-12-18 Thread Devin Coughlin via Phabricator via cfe-commits
dcoughlin accepted this revision. dcoughlin added a comment. This revision is now accepted and ready to land. This seems reasonable to me, although I have a question inline about why you are using `makeZeroElementRegion()`. Comment at:

[PATCH] D55804: [analyzer] C++17: Fix leak false positives when an object with destructor is returned from the top frame.

2018-12-18 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ updated this revision to Diff 178802. NoQ added a comment. Wait a minute. In D55804#1334957 , @NoQ wrote: > we would also need to introduce a separate liveness hack to keep it alive No, we wouldn't! With a symbolic region it is fine if it dies too

[PATCH] D55804: [analyzer] C++17: Fix leak false positives when an object with destructor is returned from the top frame.

2018-12-18 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. Actually, `LiveVariables` analysis is not the right place to deal with this problem; these changes would go into `SymbolReaper` (or directly into `ExprEngine`), because we're dealing with something that depends on the stack frame, while `LiveVariables` analysis only

[PATCH] D55804: [analyzer] C++17: Fix leak false positives when an object with destructor is returned from the top frame.

2018-12-18 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. In D55804#1334106 , @xazax.hun wrote: > Is there any downsides for using symbolic region for the construction target? > For me that would make perfect sense, since this is often modelled by passing > the address of the target into

[PATCH] D55804: [analyzer] C++17: Fix leak false positives when an object with destructor is returned from the top frame.

2018-12-18 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added a comment. Is there any downsides for using symbolic region for the construction target? For me that would make perfect sense, since this is often modelled by passing the address of the target into the callee. The programmer could do RVO like thing by hand, so modeling

[PATCH] D55804: [analyzer] C++17: Fix leak false positives when an object with destructor is returned from the top frame.

2018-12-17 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ created this revision. NoQ added reviewers: dcoughlin, xazax.hun, a_sidorin, george.karpenkov, rnkovacs, Szelethus, mikhail.ramalho, baloghadamsoftware. Herald added subscribers: cfe-commits, dkrupp, donat.nagy, a.sidorin, szepet. The `return_from_top_frame` test demonstrates what happens.