gcc -fdump-tree-original 的输出

发布于 2024-08-29 22:08:25 字数 589 浏览 2 评论 0原文

如果我将 GCC 生成的代码转储为虚拟析构函数(使用 -fdump-tree-original),我会得到这样的结果:

;; 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) >>>
>>;
  }

我的问题是: ":;< 之后的代码在哪里/代码>”位于?它位于析构函数之外,那么该代码何时执行?

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) >>>
>>;
  }

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

万劫不复 2024-09-05 22:08:25

这看起来像是编译器生成的代码,用于在调用析构函数后管理实际的内存释放,并且应该在析构函数代码之后立即执行。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文