This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Getting type used in THROW_EXPR


Hi all,

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?

OR

How do i get a reference to the node with the type of the exception for
a THROW_EXPR?



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.
Brendon.




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]