[cfe-dev] How can I get a FieldRegion in a CompoundAssignOperator in Static Analyzer?

Jordan Rose jordan_rose at apple.com
Tue Jan 21 09:24:51 PST 2014


On Jan 21, 2014, at 5:19 , Arthur Yoo <phjy007 at gmail.com> wrote:

> Hi all,
> 
> 
> 
> I want to get a FieldRegion when evaluating a CompoundAssignOperator. The code snippet for my test is like below:
> 
>  
> typedef struct {
> 
>            int a;
> 
>            int *p;
> 
> } Obj;
> 
> Obj obj;
> 
> obj.a = 0;
> 
> obj.a += sizeof(long);
> 
>  
> 
> When evaluating the statement ‘obj.a += sizeof(long);’ in the method void checkPostStmt(const BinaryOperator *Op, CheckerContext &C) const, I want to get the FieldRegion of obj.a. But I don’t know how to get it. Is there anyone can provide me a way to get obj.a’s FieldRegion? Thanks a lot.
> 

Hi, Arthur. The value of the BinaryOperator's LHS should be an SVal representing the FieldRegion. Are you not seeing that?

Jordan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140121/33535248/attachment.html>


More information about the cfe-dev mailing list