This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Using GCC as a C++ front-end.
- From: Matthieu Moy <Matthieu dot Moy at imag dot fr>
- To: gcc at gcc dot gnu dot org
- Date: Wed, 16 Jul 2003 18:17:20 +0200
- Subject: Using GCC as a C++ front-end.
- Organization: Verimag, STMicroelectronics
Hi !
I'm using GCC as a front-end to C++ to do some code analysis (No code
generation).
For now, I'm using the main branch, but I may shift to the SSA branch
later.
For that, I've added a function call to my code the line before
"optimize_function (fn);" in semantics.c. In the function added, I
keep a "copy" of fn, but this is only a copy of the pointer.
I thought the tree wouldn't be modified by the rest of the
compilation, but actually, this is not the case : The call to the
function "expand_stmt (DECL_SAVED_TREE (fn));" later in semantics.c
can change it. It did so for a node of type TARGET_EXPR. The second
operand is deleted.
So, I have two questions :
* Is there a way to be sure the tree will not be modified after the
call to my function ? A way to stop the treatment of this function
at this point ? (for now, I'm still generating assembler code, which
is totally useless !)
* If not, is there a way to get an exact "deep" copy of a tree ? (By
"deep", I mean not just a copy of pointer, but a recursive copy.)
Thanks for your help,
--
Matthieu