Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] How to differenciate a call to a function fromareferencing its address?

The AST contains the entire information. In one case you'd be looking at
a function-call expression (IASTFunctionCallExpression), in the other
there would not be one. You can find the function-call by looking at the
parents of the IASTName, which is the reference to the function. The
arguments are then available via
IASTTFunctionCallExpression.getParameterExpression(). This method should
correctly be called getArgumentExpression().

Markus.

> -----Original Message-----
> From: cdt-dev-bounces@xxxxxxxxxxx 
> [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Dmitry Smirnov
> Sent: Wednesday, October 01, 2008 5:25 PM
> To: CDT General developers list.
> Subject: Re: [cdt-dev] How to differenciate a call to a 
> function fromareferencing its address?
> Importance: Low
> 
> Is it also not possible with AST?
> What if F have some arguments? Can I know what actual 
> arguments were passed to a function?
> 
> 2008/10/1 Schorn, Markus <Markus.Schorn@xxxxxxxxxxxxx>:
> > Currently you cannot tell the difference. If this is important for 
> > you, please raise an enhancement request on bugzilla.
> >
> > Markus.
> >
> >> -----Original Message-----
> >> From: cdt-dev-bounces@xxxxxxxxxxx
> >> [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Dmitry Smirnov
> >> Sent: Wednesday, October 01, 2008 3:59 PM
> >> To: cdt-dev@xxxxxxxxxxx
> >> Subject: [cdt-dev] How to differenciate a call to a function from 
> >> areferencing its address?
> >> Importance: Low
> >>
> >> Hi,
> >>
> >> Let's assume I have a function F().
> >> In the program it can be referenced in this way
> >>
> >> void B
> >> {
> >>   void * addr = F; // or &F;
> >> }
> >>
> >> How can I differenciate this from the real call to F() 
> using index or 
> >> AST?
> >>
> >> Let's assume I have an IIndexName for B.
> >> I can get the list of enclosed names:
> >>
> >> IIndexName funcB = ...
> >> IIndexName[] refs = funcB.getEnclosedNames(); for(IIndexName
> >> ref: refs) {
> >>   IBinding refBinding = index.findBinding(ref);
> >>   if( refBinding instanceof IFunction )
> >>   {
> >>      // How to know that ref is not call?
> >>   }
> >> }
> >>
> >> Dmitry
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev
> 


Back to the top