Skip to content
Commit e112a01c authored by Milian Wolff's avatar Milian Wolff
Browse files

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
BUG: 297133
parent 83051b0b
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment