[cfe-dev] RecursiveAstVisitor: How to get the LHS and its type of an assigment inside a VistCallExpr?
David Come via cfe-dev
cfe-dev at lists.llvm.org
Tue Aug 22 04:51:23 PDT 2017
Hi;
There is no such thing as 'lhs' for VisitCallExpr. Visiting a
VisitCallExpr will give you access to foo(42).
You need to visit BinaryOperator to get your hand on a LHS.
David
On 22/08/2017 11:26, Marcel Schaible via cfe-dev wrote:
>
> Hi,
>
> in my source-to-source translation tool I try to get the lefthandside
> of assignment in my VisitCallExpr:
>
> Example:
>
> lhs = foo(42);
>
> I need to retrieve "lhs" and its associated type.
>
> Any hint is welcome!
>
> Marcel
>
> My code snippet:
>
> bool VisitCallExpr(CallExpr *CallExpression) {
> QualType q = CallExpression->getType();
> const Type *t = q.getTypePtrOrNull();
> const Stmt* callExpression = CallExpression;
>
> FunctionDecl *func = CallExpression->getDirectCallee();
>
> ...
>
> // How to retrieve "LHS" here and its type?
>
> ...
>
> return true;
> }
>
>
>
>
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170822/0087700f/attachment.html>
More information about the cfe-dev
mailing list