[cfe-dev] How to track the 'this' pointer when using the clang static analyzer?

Xin Wang via cfe-dev cfe-dev at lists.llvm.org
Sun Jun 4 06:00:29 PDT 2017


Hello everyone!

I want to check that 'this' is binded to x, the code is blow:

struct X {
  X() {
    X* x = this;
  }
};

I dumped the exploded graph, the live expression of x is blow:
    (0x66ab5b0,0x667a9c0) x : &SymRegion{reg_$0<struct X * this>}

But I'm not sure how to recognize programmatically that this is a symbolic
region for a *this* pointer. I thought that maybe I could use
isa<CXXThisRegion>() method, but it turns out that the SymbolicRegion and
CXXThisRegion don't share the same
inheritance chain.

Look forward to your help!
Xin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170604/d54cdf95/attachment.html>


More information about the cfe-dev mailing list