Which Checker type to use?

Hi,

I am implementing a static analyzer check where I want to compare data types of two variable on LHS and RHS of an expression.

e.g.

int x;

unsigned int y;

y=x; //Check data type of RHS and LHS

Please suggest which checker type to use.

I tried using bind and then type casted the LHS to TypedValueRegion, but I could not get the data type for RHS doing the same thing.

Please suggest.

Regards,

Sujit Kamthe

image001.jpg

Productivity & FE | Automotive and Engineering SBU | KPITCummins Infosystems Ltd|Board: +91 20 66525000 | Extn:3102 |Mobile:7709076120

Sujit,

Can you give us a bit more information about what you are trying to achieve? For example, it is not clear that you would need path sensitive analyses if you are just trying to compare the types of LHS and RHS expressions of an assignment.

Thanks,
Anna.

Hi Anna,

Thanks for reply.

Yes I wanted to check just the types of LHS and RHS.

I implemented it using CastExpr.

I think your point is valid that I should not use path sensitive analysis just for comparing the types of RHS and LHS.

I will try to implement it using ASTVisitor.

Thanks for the help J