Review Request: Make temporary DUContext for default template parameters obsolete

Milian Wolff mail at milianw.de
Sun Oct 7 16:50:45 UTC 2012


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/106757/
-----------------------------------------------------------

Review request for KDevelop and David Nolden.


Description
-------

Use a thread-local QMultiHash<IndexedQualifiedIdentifier, IndexedType> lookup table to support default template parameters. This obsoletes the necessity of the temporary DUContext which may introduce instabilities as described in bug 297133.

One big caveat was cloning template declarations which contain an internal context. This resulted in both, the original and clone to reference the same internal context. Upon destruction of the clone, the ownership of the internal context was tried to be changed. This can crash, as it could happen while only holding a read lock, yet the referenced internal context is in the DUChain and thus must only be altered while holding a write lock.

This change also makes it possible to remove the code surrounding Declaration::clone and Declaration::clonePrivate, as this was the only places which actually used it. Considering the major pitfalls and caveats of this API, I say this is a very good thing.

Furthermore, while introducing the thread-local data, I fixed the two safety recursion counters: Previously they where shared between threads which does not make any sense when we want to count the recursion depth that is thread-specific.


This addresses bug 297133.
    http://bugs.kde.org/show_bug.cgi?id=297133


Diffs
-----

  languages/cpp/cppduchain/templatedeclaration.cpp e423693 
  languages/cpp/cppduchain/templateparameterdeclaration.h 9fb44aa 
  languages/cpp/cppduchain/templateparameterdeclaration.cpp 08b76bb 

Diff: http://git.reviewboard.kde.org/r/106757/diff/


Testing
-------

All existing unit tests pass. KDE Rocs and boost/proto/matches.hpp get parsed without crashing.


Thanks,

Milian Wolff

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20121007/216e9109/attachment.html>


More information about the KDevelop-devel mailing list