[cfe-dev] getLHS() and getRHS()
Yang Chen
chenyang at cs.utah.edu
Mon Nov 19 11:55:50 PST 2012
Rambo wrote:
> I can do it ,the codes as follows:for A[4]
> Expr *rhs=Decl2->getRHS();
> if(ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(rhs))
> {
> Curr=ICE->getSubExpr();
> if(DeclRefExpr *ICE1 = dyn_cast<DeclRefExpr>(Curr))
> De=ICE1->getNameInfo();
> // llvm::errs()<<De.getAsString()<<"\n";
> }
> This is get "A"and
> Expr *lhs=Decl2->getLHS();
> if(ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(lhs))
> {
> Curr=ICE->getSubExpr();
> if(DeclRefExpr *ICE1 = dyn_cast<DeclRefExpr>(Curr))
> De=ICE1->getNameInfo();
> // llvm::errs()<<De.getAsString()<<"\n";
> }
> This is get 4.
>
A couple of member functions of Expr would be helpful to you -
IgnoreImpCasts, IgnoreParens, IgnoreParenCasts
http://clang.llvm.org/doxygen/classclang_1_1Expr.html
- Yang
> Thank your for your reply again.
>
>
> Rambo
>
>
>
> --
> View this message in context: http://clang-developers.42468.n3.nabble.com/getLHS-and-getRHS-tp4028364p4028368.html
> Sent from the Clang Developers mailing list archive at Nabble.com.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
More information about the cfe-dev
mailing list