[cfe-dev] [Static Analyzer]How to track Dead memory Region of C++ objects

Karthik Bhat blitz.opensource at gmail.com
Fri May 24 02:14:34 PDT 2013


Thanks Gabor.
I was able to achieve the required functionality in checkDeadSymbols by
using SymbolReaper's isLiveRegion function.



On Fri, May 24, 2013 at 12:20 PM, Gábor Kozár <kozargabor at gmail.com> wrote:

> Hi,
>
> What you need is checkDeadSymbols(). In it, iterate through all your
> tracked MemRegion-s, and ask the SymbolReaper whether they are dead (I
> can't remember the name of the method, but it should be trivial).
>
> Symbols are created when the Static Analyzer has no knowledge of that
> particular value. You were correct in trying to work with MemRegion-s.
>
> Gabor
>
>
> 2013/5/24 Karthik Bhat <blitz.opensource at gmail.com>
>
>> Hi,
>> I'm developing a checker for internal purpose were i need to track when
>> Mem region corresponding to a class object gets invalidated. For example in
>> the code below
>>
>> class A {
>> public:
>> void myConstruct() {};
>> };
>>
>> void fun() {
>>   A a;
>>   a. Construct();
>>   return;
>> }
>>
>> int main() {
>>   fun();
>>   return 0;
>> }
>>
>> the memoryRegion for class A's instance a gets invalidated as soon as we
>> return from fun() but i'm currently not getting checkRegionChanges
>> corresponding to this event. ( I'm using getCXXThisVal().getAsRegion() to
>> get the MemRegion corresponding to instance a.
>>
>> I also tried to using symbol corresponding to it (i.e
>> getCXXThisVal().getAsSymbol()) but it always returns NULL.
>>
>> Could anyone guide me how can i track that MemRegion corresponding to a
>> has been invalidated after the fun returns?
>>
>> Thanks
>> Karthik
>>
>> _______________________________________________
>> 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/20130524/a4c437ed/attachment.html>


More information about the cfe-dev mailing list