codeql icon indicating copy to clipboard operation
codeql copied to clipboard

C++: Output destructors of temporary objects

Open jketema opened this issue 1 year ago • 3 comments

jketema avatar Feb 29 '24 15:02 jketema

I'd expect to see a destructor call for the temporary string at line 1369 of ir.cpp. The AST otherwise looks good to me.

rdmarsh2 avatar Feb 29 '24 19:02 rdmarsh2

I'd expect to see a destructor call for the temporary string at line 1369 of ir.cpp.

This turns out to be a very interesting case. It's a temporary, by the lifetime is at block scope, not expression scope.

jketema avatar Mar 01 '24 09:03 jketema

very interesting case. It's a temporary, by the lifetime is at block scope, not expression scope.

This is now fixed.

jketema avatar Mar 04 '24 10:03 jketema

This PR is now just test updates. All the other parts have been merged into main in separate PRs.

jketema avatar Mar 14 '24 08:03 jketema

Closing in favour of https://github.com/github/codeql/pull/15978. That's the 3rd in a series of PRs, which mostly does what was done here, except for some synthetic destructor generation related to throws (that'll be a separate PR).

jketema avatar Mar 20 '24 10:03 jketema