This is the mail archive of the
mailing list for the GCC project.
Getting type used in THROW_EXPR
- From: Brendon Costa <brendon at christian dot net>
- To: gcc at gcc dot gnu dot org
- Date: Sat, 14 Oct 2006 17:50:20 +1000
- Subject: Getting type used in THROW_EXPR
I have yet another question that has arisen as i have started testing my
code. Basically I am trying to get the type that is being used in
throwing an exception.
Is there a simple macro i can use to get the type of an exception from a
THROW_EXPR? I think this is a matter of getting the TREE_TYPE for the
value passed into the function: except.c: build_throw(tree exp)
I have been printing out the TREE_CODE of the node that comes from
calling TREE_TYPE(exp) inside that function, and i think from what i can
tell this gives the correct value for the type of the exception being
thrown (maybe i should also pass it through the prepare_eh_type()
function too). The problem is:
How do i get a reference to the expression tree passed into the
build_throw() method from a THROW_EXPR node or at least its type?
How do i get a reference to the node with the type of the exception for
Note: I also tried to change the THROW_EXPR node to have 2 operands
instead of 1 in (cp-tree.def) and then use build2() with the original
exp node instead of the existing build1() and attached the original exp
node to it. This had other disastrous consequences which i kind of
expected. I was not sure if I could just add an additional operand to
the THROW_EXPR node. I figured that all other commands would just use
operand 0 and ignore the new operand but it seems to fail with an ICE,
so i gave up that line of thinking...
Thanks for any help/info on this.