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.
Details
Details
Diff Detail
Diff Detail
Event Timeline
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 sounded like a good thing to check, so i added such checks in a few more places.