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

Karthik Bhat blitz.opensource at gmail.com
Thu May 23 22:02:42 PDT 2013


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130524/68608018/attachment.html>


More information about the cfe-dev mailing list