[cfe-dev] Where are the methods, which handle the Element Region’s index, in Clang Static Analyzer?

Arthur Yoo phjy007 at gmail.com
Mon Nov 4 04:33:29 PST 2013


It seems that* evalBinOp() *will do the related things.* evalBinOp()* also
calls *evalBinOpLN()* and evalBinOpNN().


2013/10/30 Arthur Yoo <phjy007 at gmail.com>

> Hi all,
>
>
> ElementRegion has a field named *Index (NoLoc) *to record the index of
> that Array Element. We can also use pointer offset operation to calculate a
> new index and get the corresponding array element. For example:
>
> 1 void func() {
>
> 2    int arr[10];
>
> 3     int *ptr, *ptr2;
>
> 4     ptr = arr;
>
> 5     ptr = ptr + 3;
>
> 6     *ptr = 9;
>
> 7     ptr2 = ptr + 1;
>
> 8     *ptr2 = 10;
>
> 9 }
>
>
> Line 5 shows the pointer offset operation. I dumped the information of the
> pointee MemRegion referenced by ptr, the Static Analyzer gave me such
> result: element{arr,3 S32b,int}. That means after the pointer offset
> operation by line 5, the ptr’s pointee MemRegion became an ElementRegion of
> arr[], which index was *3 S32b*. The line 7’s effect is same, it showed
> me element{arr,4 S32b,int}. Obviously, after the pointer offset operation,
> the ElementRegion’s Index will be changed. I want to know where are the
> methods that handle the Element Region’s index in pointer offset operation.
> Cause I want to find these methods and add some codes into them.
>
> Thanks a lot.
>
> --
> Best regards,
> Arthur Yoo
>



-- 
Best regards,
岳佳圆 | Yue Jiayuan | Arthur Yoo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131104/6ba9bff7/attachment.html>


More information about the cfe-dev mailing list