[PATCH] D47305: [analyzer] pr37270: Fix binding constructed object to DeclStmt when ConstructionContext is already lost.

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 23 18:20:00 PDT 2018


NoQ created this revision.
NoQ added reviewers: dcoughlin, xazax.hun, a.sidorin, george.karpenkov, szepet, rnkovacs.
Herald added subscribers: cfe-commits, baloghadamsoftware.

As explained in http://lists.llvm.org/pipermail/cfe-dev/2018-May/058055.html, `findDirectConstructorForCurrentCFGElement()` was not working correctly in the current example and erroneously made us think that we've constructed into a dummy temporary region rather than into the variable. Instead, it was proposed to track it in the program state every time we are performing construction correctly.

Additionally this information will be used to maintain liveness of the variable's Store bindings, because previously an incorrect Environment binding of the target region to the construct-expression was used for that purpose. Such binding is incorrect because the constructor is a prvalue of an object type and should therefore have a NonLoc representing its symbolic value. Therefore the hack implemented by `isTemporaryPRValue()` can be safely removed.

`findDirectConstructorForCurrentCFGElement()` cannot be removed yet because it is also used for constructor member initializers for the same purpose. It doesn't seem to introduce bugs though.


Repository:
  rC Clang

https://reviews.llvm.org/D47305

Files:
  lib/StaticAnalyzer/Core/ExprEngineC.cpp
  lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
  lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
  test/Analysis/cxx17-mandatory-elision.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47305.148328.patch
Type: text/x-patch
Size: 5031 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180524/4916fd6d/attachment.bin>


More information about the cfe-commits mailing list