[cfe-dev] How can I get the types' information in CStyleCastExpr
Jordan Rose
jordan_rose at apple.com
Mon Sep 9 18:30:21 PDT 2013
The simplest way to do this is Expr::getType. The type of the CastExpr is the casted type, the type of the CastExpr's subexpression is the original type.
If you want to get more information here, look into ExplicitCastExpr::getTypeInfoAsWritten.
Hope that helps,
Jordan
On Sep 9, 2013, at 6:38 , Arthur Yoo <phjy007 at gmail.com> wrote:
> Hi all,
>
> I want to get the types' information in my checker. The method interface I am using is checkPostStmt(const CStyleCastExpr *cec, CheckerContext &C) const;
>
> For example, there is a statement:
> int *pi;
> char *pc;
> int a = 3;
> pi = &a;
> pc = (char *)pi;
>
> After analysing "(char *)pi;", I want to get the type-related information, that is, the original type is int*, the casted type is char *. So how can I get that target? Thanks a lot.
>
> --
> Best regards,
> Arthur Yoo
> _______________________________________________
> 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/20130909/a2b054fe/attachment.html>
More information about the cfe-dev
mailing list