[PATCH] D66404: [CFG] Make destructor calls more accurate
Nicholas Allegra via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Aug 18 16:16:34 PDT 2019
comex created this revision.
comex added reviewers: dergachev.a, Szelethus, dcoughlin.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Note: I don't have commit access.
Various changes to reduce discrepancies in destructor calls between the
generated CFG and the actual codegen, along with a new test file.
- Respect C++17 copy elision; previously it would generate destructor calls for elided temporaries, including in initialization and return statements.
- Don't generate duplicate destructor calls for statement expressions.
- Fix initialization lists.
- Fix comma operator.
- Change printing of implicit destructors to print the type instead of the class name directly, matching the code for temporary object destructors. The class name was blank for lambdas.
Also update some existing tests which were broken by the changed formatting
and/or the fixed behavior.
- Rename BindToTemporary to ExternallyDestructed, which more accurately reflects what the parameter does and matches the naming in CodeGen.
- Change VisitChildrenForTemporaryDtors to take an ExternallyDestructed parameter, for the sake of InitListExprs, which have an arbitrary number of children and may or may not be externally destructed.
- Add a function VisitExternallyDestructed with the right behavior for return statements and statement expressions.
The new test file also includes tests for some preexisting buggy cases which
this patch does *not* fix. What a mess...
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 35549 bytes
Desc: not available
More information about the cfe-commits