This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] Re-enable C++17-specific return value constructors.
ClosedPublic

Authored by NoQ on May 25 2018, 7:14 PM.

Details

Summary

The refactoring conducted in 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.

Diff Detail

Event Timeline

NoQ created this revision.May 25 2018, 7:14 PM
NoQ added inline comments.
test/Analysis/cxx17-mandatory-elision.cpp
185–191

This sounded like a good thing to check, so i added such checks in a few more places.

This revision is now accepted and ready to land.May 30 2018, 10:46 AM
This revision was automatically updated to reflect the committed changes.