Members of the KDE Community are recommended to subscribe to the kde-community mailing list at to allow them to participate in important discussions and receive other important announcements

Commit 886ad1d9 authored by Milian Wolff's avatar Milian Wolff

Fix usage of PushValue for recursion counters in TemplateDeclaration.

PushValue takes a new value, not a delta value. Thus something like
the following does not do what you think it does:

    PushValue increase(myCounter, +1);

This always sets the value to 1 and resets the old value at exit.
To push a delta value, you need to be more verbose:

    PushValue increase(myCounter, myCounter + 1);

This was while reviewing new code in review request 111796. Shows
how much good a code review can do! I checked all other uses of
PushValue and they seem to work as intended.
parent c5f93d45
......@@ -219,7 +219,7 @@ struct DelayedTypeResolver : public KDevelop::TypeExchanger
virtual AbstractType::Ptr exchange( const AbstractType::Ptr& type )
ThreadLocalData& data = threadDataLocal();
PushValue<uint> inc(data.delayedDepth, +1);
PushValue<uint> inc(data.delayedDepth, data.delayedDepth + 1);
if( data.delayedDepth > 30 ) {
kDebug(9007) << "Too much depth in DelayedTypeResolver::exchange, while exchanging" << (type ? type->toString() : QString("(null)"));
return type;
......@@ -273,7 +273,6 @@ struct DelayedTypeResolver : public KDevelop::TypeExchanger
if( aType )
return typeCopy;
......@@ -633,7 +632,7 @@ CppDUContext<KDevelop::DUContext>* instantiateDeclarationAndContext( KDevelop::D
///an AliasDeclaration represents a C++ "using bla::bla;" declaration.
if(AliasDeclaration* alias = dynamic_cast<AliasDeclaration*>(instantiatedDeclaration)) {
ThreadLocalData& data = threadDataLocal();
PushValue<uint> safety(data.aliasDepth, +1);
PushValue<uint> safety(data.aliasDepth, data.delayedDepth + 1);
if(data.aliasDepth > 30) {
kWarning() << "depth-limit reached while resolving alias-declaration" << alias->identifier().toString() << "within" << parentContext->scopeIdentifier(true).toString();
}else {
Markdown is supported
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