[cfe-dev] DeclRefExpr: how to distinguish between variable ref and function ref?
Vassil Vassilev
vasil.georgiev.vasilev at cern.ch
Mon Mar 7 09:18:22 PST 2011
Hi,
I'd check the declaration of the DeclRefExpr
bool Visit(Stmt *S)
{
.........
........
if( clang::DeclRefExpr* Ref = dyn_cast<clang::DeclRefExpr>(S) ) {
if (clang::FunctionDecl* FD =
dyn_cast<clang::FunctionDecl>(Ref->getDecl()))
ProcessFunctionDeclRef(Ref);
else if (clang::VarDecl* VD =
dyn_cast<clang::VarDecl>(Ref->getDecl()))
ProcessVariableDeclRef(Ref);
}
Cheers,
Vassil
On 07.3.2011 ?. 19:36, jignesh vasoya wrote:
> Hi,
>
> I am traversing C source code using ASTConsumer.
> bool Visit(Stmt *S)
> {
> .........
> ........
> if( isa<DeclRefExpr>(S) )
> ProcessDeclRefExpr(cast<DeclRefExpr>(S));
> ..........
> ........
> }
>
> Whenever any variable or function is referred if condition(given in
> above code fragment ) evaluates to true
> and it is processed by ProcessDeclRefExpr function.
>
> I want to handle variable and functions ref differently.
> How can i distinguish between variable and function ref??????/
>
>
> *------------------------------------------------------------*
> *Jignesh Vasoya*
> 248-Pampa Hostel,
> IIT Madras,
> India.
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110307/755a3237/attachment.html>
More information about the cfe-dev
mailing list