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.
In particular:
- 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.
Implementation notes:
- 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...