[cfe-dev] Static Analyzer - tracking values through indirection?

Gábor Kozár kozargabor at gmail.com
Tue Apr 30 09:50:17 PDT 2013


I need to write a checker to make sure that the state of the transaction is
checked after commit. This is working fine is basic cases, but it seems to
fail when I introduce any level of indirection. For example, consider the

class TransactionPtr
    TransactionPtr(DummyTransaction& tr) : m_tr(tr) {}

    DummyTransaction* getTransaction() { return &m_tr; }

    DummyTransaction& m_tr;

int main(int argc, char* argv[])
    DummyTransaction tr;
    TransactionPtr trp(tr);


    if(tr.isSuccessful()) return 0;
    else return 1;

Running my checker on this reveals that the analyzer has no idea of the
connection between trp.m_tr and tr, and so it fails to detect an issue with
the above code.

I also tried checkBind(), but it is not called in relation to the
TransactionPtr trp(tr); line.

Is this a known limitation, or am I missing something here? I also tried
getBaseRegion(), getSuperRegion(), which didn't lead anywhere.
getMemorySpace() on the other hand points to UnknownSpaceRegion.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130430/405335e9/attachment.html>

More information about the cfe-dev mailing list