* make ttryfinallynode inherit from ttertiary node so it has a "third" node

member. This one will be used by the LLVM descendent to keep a copy of
    the finally code, as it must use a separate version for the code that
    gets executed when an exception is caught and when no exception happens

git-svn-id: branches/debug_eh@40416 -
This commit is contained in:
Jonas Maebe 2018-11-29 21:31:34 +00:00
parent 2f8fcf7819
commit 03013cf2e1
2 changed files with 20 additions and 7 deletions

View File

@ -189,7 +189,10 @@ interface
end;
ttryexceptnodeclass = class of ttryexceptnode;
ttryfinallynode = class(tbinarynode)
{ the third node is to store a copy of the finally code for llvm:
it needs one copy to execute in case an exception occurs, and
one in case no exception occurs }
ttryfinallynode = class(ttertiarynode)
implicitframe : boolean;
constructor create(l,r:tnode);virtual;reintroduce;
constructor create_implicit(l,r:tnode);virtual;
@ -2299,14 +2302,16 @@ implementation
constructor ttryfinallynode.create(l,r:tnode);
begin
inherited create(tryfinallyn,l,r);
inherited create(tryfinallyn,l,r,nil);
third:=nil;
implicitframe:=false;
end;
constructor ttryfinallynode.create_implicit(l,r:tnode);
begin
inherited create(tryfinallyn,l,r);
inherited create(tryfinallyn,l,r,nil);
third:=nil;
implicitframe:=true;
end;
@ -2323,6 +2328,12 @@ implementation
typecheckpass(right);
// "except block" is "used"? (JM)
set_varstate(right,vs_readwritten,[vsf_must_be_valid]);
if assigned(third) then
begin
typecheckpass(third);
set_varstate(third,vs_readwritten,[vsf_must_be_valid]);
end;
end;
@ -2333,6 +2344,8 @@ implementation
firstpass(left);
firstpass(right);
if assigned(third) then
firstpass(third);
include(current_procinfo.flags,pi_do_call);

View File

@ -202,8 +202,8 @@ implementation
result := foreachnode(procmethod,tloopnode(n).t1,f,arg) or result;
result := foreachnode(procmethod,tloopnode(n).t2,f,arg) or result;
end;
raisen:
{ frame tree }
raisen, tryfinallyn:
{ frame tree/copy of finally code }
result := foreachnode(ttertiarynode(n).third,f,arg) or result;
tempcreaten:
{ temp. initialization code }
@ -299,8 +299,8 @@ implementation
result := foreachnodestatic(procmethod,tloopnode(n).t1,f,arg) or result;
result := foreachnodestatic(procmethod,tloopnode(n).t2,f,arg) or result;
end;
raisen:
{ frame tree }
raisen, tryfinallyn:
{ frame tree/copy of finally code }
result := foreachnodestatic(ttertiarynode(n).third,f,arg) or result;
tempcreaten:
{ temp. initialization code }