[PATCH] D49811: [analyzer] Obtain a ReturnStmt from a CFGAutomaticObjDtor

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 21 10:56:23 PDT 2018


NoQ added a comment.
Herald added a subscriber: Szelethus.

In https://reviews.llvm.org/D49811#1175927, @NoQ wrote:

> Devin has recently pointed out that we might have as well reordered CFG elements to have return statement kick in after automatic destructors, so that callbacks were called in a different order. I don't see any problems with that solution, but let's stick to the current solution for now, because who knows.




In https://bugs.llvm.org/show_bug.cgi?id=11645#c9 Ted wrote:

> If we treat an occurrence of "return" in the CFG is meaning "bind an expression result for the return value" and not as a transfer of control then it is is fine for the destructors to appear after the "return".  From this view, the transfer back to the caller is when we hit the Exit block.


Another possible solution is to check in the destructor if the newly dangling pointer is already bound to the return statement.


Repository:
  rC Clang

https://reviews.llvm.org/D49811





More information about the cfe-commits mailing list