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

Gábor Kozár kozargabor at gmail.com
Thu May 2 08:16:35 PDT 2013


Hi,

Never mind this e-mail, I realized that tracking this would involve
inter-procedural analysis, which the Static Analyzer currently does not
support.

Sorry for the spam!

Gabor


2013/4/30 Gábor Kozár <kozargabor at gmail.com>

> Hi,
>
> 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 following:
>
> class TransactionPtr
> {
> public:
>     TransactionPtr(DummyTransaction& tr) : m_tr(tr) {}
>
>     DummyTransaction* getTransaction() { return &m_tr; }
>
> private:
>     DummyTransaction& m_tr;
> };
>
> int main(int argc, char* argv[])
> {
>     DummyTransaction tr;
>     TransactionPtr trp(tr);
>
>     trp.getTransaction()->commit();
>
>     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.
>
> Thanks!
>
> Gabor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130502/1fd51c14/attachment.html>


More information about the cfe-dev mailing list