Revision e112a01...

Go back to digest for 14th October 2012

Optimization in Development Tools

Milian Wolff committed changes in [kdevelop] /cpp/cppduchain:

Make temporary DUContext for default template parameters obsolete.

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.

REVIEW: 106757

File Changes

Modified 3 files
  • /cpp/cppduchain
  •   languages/templatedeclaration.cpp
  •   languages/templateparameterdeclaration.cpp
  •   languages/templateparameterdeclaration.h
3 files changed in total