开发者

Output of gcc -fdump-tree-original

开发者 https://www.devze.com 2022-12-28 04:45 出处:网络
If I dump the code generated by GCC for a virtual destructor (with -fdump-tree-original), I get something like this:

If I dump the code generated by GCC for a virtual destructor (with -fdump-tree-original), I get something like this:

;; Function virtual Foo::~Foo() (null)
;; enabled by -tree-original

{
  <<cleanup_point <<< Unknown tree: expr_stmt
  (void) (((struct Foo *) this)->_vptr.Foo = &_ZTV3Foo + 8) >>>
>>;
}
<D.20148>:;
if ((bool) (__in_chrg & 1))
  {
    <<cleanup_point <<< Unknown tree: expr_stmt
  operator delete ((void *) this) >>>
>>;开发者_Python百科
  }

My question is: where is the code after "<D.20148>:;" located? It is outside of the destructor so when is this code executed?


That looks like the compiler-generated code to manage the actual memory deallocation after the destructor is called and should execute right after your destructor code.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号