|
From: Grzegorz J. <ja...@he...> - 2002-11-26 09:11:08
|
On Mon, 25 Nov 2002, suresh wrote:
> Hi,
> I have solved the first and third problem mentioned in my previous
> email. Thanx for you guys help. For the second problem, which is finding
> the instantiation of all the objects of a class (classA), I just need to
> know the instantiation statements. I don't want any runtime information.
> Based on the objects (object names), I have to add MACROs in the header
> file of ClassA. The macro will take object name as an argument.
>
> Explaination:
>
> /* classA in file classA.h and classA.cpp */
> Class classA {
> .....
> .....
> ......
> }
>
> /* classB in file classB.h and classB.cpp */
> class classB {
> .....
> classA objA1;
> classA objA2 = new classA;
^^^^^^^^^^^^
classA* objA2 ?
> .....
> }
>
> Now I need to add MACRONAME(objA1) and MACRONAME(objA2) in the header
> file of classA.
Do you want to translate individual header files? It is going to be
difficult, since OpenC++ sits behind preprocessor, so it does not really
see separate header files. If it is enough to just add the macros in
*translation unit*, that should be easy (see AppendAfterTopLevel()).
Remember to instruct OpenC++ to perform second preprocessor pass.
If this advice is not what you are looking for then I am afraid you have
to shed some more light on why do you need those macros.
> Any help is welcome. I am facing one more problem, I
> tried translateNew But translateNew's arguments don't have the object
> name.
Because object created with "new" does not have a name. What do you mean
by "object name" in:
some_function(2, new classA);
?
Do you really want to find all instantiations or just instantiations of
some specific form (e.g. "classA* ID = new classA") and nothing else?
Best regards
Grzegorz
##################################################################
# Grzegorz Jakacki Huada Electronic Design #
# Senior Engineer, CAD Dept. 1 Gaojiayuan, Chaoyang #
# tel. +86-10-64365577 x2074 Beijing 100015, China #
# Copyright (C) 2002 Grzegorz Jakacki, HED. All Rights Reserved. #
##################################################################
|