[cfe-dev] get sizeof(*) 's value
rjmccall at apple.com
Mon Mar 25 13:04:56 PDT 2013
On Mar 25, 2013, at 1:50 AM, huc1985 <huc1985 at 163.com> wrote:
> I'm using a RecursiveASTVisitor and its VisitCallExpr method. I want to
> find out all location using malloc. How to get the sizeof(*)'s value?
> for example:
> char* a = (char*)malloc(sizeof(char));
> int* b = (int*)malloc(sizeof(int));
> a, fun:malloc, alloc size:1bytes
> b, fun:malloc, alloc size:4bytes
> I want to know somthing like this.
Expr::EvaluateAsInt is the most general way.
More information about the cfe-dev