Skip to content
This repository was archived by the owner on Jun 20, 2019. It is now read-only.

Conversation

ibuclaw
Copy link
Member

@ibuclaw ibuclaw commented Dec 19, 2017

Another example moving lowering from frontend (glue) to gimple.

Puts declarations marked needsScopeDtor into a TARGET_EXPR, i.e:

TARGET_EXPR <__pfx79,  // decl
             *__ctor (&__pfx79, 0), // init
             __dtor (&__pfx79), // cleanup>;

Then _build_expr_dtor wraps up the result into a CLEANUP_POINT_EXPR, e.g:

<<cleanup_point
  TARGET_EXPR <__pfx79, *__ctor (&__pfx79, 0)>;
  some_func (&__pfx79);>>;

The gimplification of cleanup_point_expr nodes then adds try/finally as needed for us, in the correct order. i.e:

try
{
  __pfx79 = *__ctor (&__pfx79, 0);
  try
  {
    some_func (&__pfx79); // may throw
  }
  finally
  {
    __dtor (&__pfx79);
  }
}
finally
{
  __pfx79 = {CLOBBER};  // constructor maybe threw.
}

Fixes broken test in test14903.d.

@ibuclaw
Copy link
Member Author

ibuclaw commented Dec 19, 2017

Fixes broken test in test14903.d.

And causes a regression in another (sdtor.d / issue 13095)

@ibuclaw
Copy link
Member Author

ibuclaw commented Dec 20, 2017

Should be sorted now.

Copy link
Contributor

@jpf91 jpf91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@ibuclaw ibuclaw merged commit 23ec9a7 into D-Programming-GDC:master Dec 21, 2017
@ibuclaw ibuclaw deleted the tmpdtors branch December 21, 2017 22:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants