[PATCH] D47405: [analyzer] Re-enable C++17-specific return value constructors.

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 25 19:14:37 PDT 2018


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

The refactoring conducted in https://reviews.llvm.org/D47304 made it easy for the analyzer to find the target region for the constructor across multiple stack frames. We ascend to the parent stack frame recursively until we find a construction context that doesn't represent yet another return value of a function. This is the semantics of copy elision in return statements that return the object by value: they return it directly to a memory region (eg., a variable) that may be located a few (indefinitely many) stack frames above the statement. In particular, this is how return statements work in C++17 where copy elision is mandatory. This commit enables this feature for the AST of C++17, but extra work is necessary to perform copy elision in the AST produced by older language standard modes.


Repository:
  rC Clang

https://reviews.llvm.org/D47405

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47405.148700.patch
Type: text/x-patch
Size: 5902 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180526/1a757b7f/attachment.bin>


More information about the cfe-commits mailing list