mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 04:46:12 +02:00
* 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:
parent
2f8fcf7819
commit
03013cf2e1
@ -189,7 +189,10 @@ interface
|
|||||||
end;
|
end;
|
||||||
ttryexceptnodeclass = class of ttryexceptnode;
|
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;
|
implicitframe : boolean;
|
||||||
constructor create(l,r:tnode);virtual;reintroduce;
|
constructor create(l,r:tnode);virtual;reintroduce;
|
||||||
constructor create_implicit(l,r:tnode);virtual;
|
constructor create_implicit(l,r:tnode);virtual;
|
||||||
@ -2299,14 +2302,16 @@ implementation
|
|||||||
|
|
||||||
constructor ttryfinallynode.create(l,r:tnode);
|
constructor ttryfinallynode.create(l,r:tnode);
|
||||||
begin
|
begin
|
||||||
inherited create(tryfinallyn,l,r);
|
inherited create(tryfinallyn,l,r,nil);
|
||||||
|
third:=nil;
|
||||||
implicitframe:=false;
|
implicitframe:=false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
constructor ttryfinallynode.create_implicit(l,r:tnode);
|
constructor ttryfinallynode.create_implicit(l,r:tnode);
|
||||||
begin
|
begin
|
||||||
inherited create(tryfinallyn,l,r);
|
inherited create(tryfinallyn,l,r,nil);
|
||||||
|
third:=nil;
|
||||||
implicitframe:=true;
|
implicitframe:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2323,6 +2328,12 @@ implementation
|
|||||||
typecheckpass(right);
|
typecheckpass(right);
|
||||||
// "except block" is "used"? (JM)
|
// "except block" is "used"? (JM)
|
||||||
set_varstate(right,vs_readwritten,[vsf_must_be_valid]);
|
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;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -2333,6 +2344,8 @@ implementation
|
|||||||
firstpass(left);
|
firstpass(left);
|
||||||
|
|
||||||
firstpass(right);
|
firstpass(right);
|
||||||
|
if assigned(third) then
|
||||||
|
firstpass(third);
|
||||||
|
|
||||||
include(current_procinfo.flags,pi_do_call);
|
include(current_procinfo.flags,pi_do_call);
|
||||||
|
|
||||||
|
@ -202,8 +202,8 @@ implementation
|
|||||||
result := foreachnode(procmethod,tloopnode(n).t1,f,arg) or result;
|
result := foreachnode(procmethod,tloopnode(n).t1,f,arg) or result;
|
||||||
result := foreachnode(procmethod,tloopnode(n).t2,f,arg) or result;
|
result := foreachnode(procmethod,tloopnode(n).t2,f,arg) or result;
|
||||||
end;
|
end;
|
||||||
raisen:
|
raisen, tryfinallyn:
|
||||||
{ frame tree }
|
{ frame tree/copy of finally code }
|
||||||
result := foreachnode(ttertiarynode(n).third,f,arg) or result;
|
result := foreachnode(ttertiarynode(n).third,f,arg) or result;
|
||||||
tempcreaten:
|
tempcreaten:
|
||||||
{ temp. initialization code }
|
{ temp. initialization code }
|
||||||
@ -299,8 +299,8 @@ implementation
|
|||||||
result := foreachnodestatic(procmethod,tloopnode(n).t1,f,arg) or result;
|
result := foreachnodestatic(procmethod,tloopnode(n).t1,f,arg) or result;
|
||||||
result := foreachnodestatic(procmethod,tloopnode(n).t2,f,arg) or result;
|
result := foreachnodestatic(procmethod,tloopnode(n).t2,f,arg) or result;
|
||||||
end;
|
end;
|
||||||
raisen:
|
raisen, tryfinallyn:
|
||||||
{ frame tree }
|
{ frame tree/copy of finally code }
|
||||||
result := foreachnodestatic(ttertiarynode(n).third,f,arg) or result;
|
result := foreachnodestatic(ttertiarynode(n).third,f,arg) or result;
|
||||||
tempcreaten:
|
tempcreaten:
|
||||||
{ temp. initialization code }
|
{ temp. initialization code }
|
||||||
|
Loading…
Reference in New Issue
Block a user