SVN commit 815018 by zwabel: - Adapt to the change in kdevplatform - Only create problem items from failed overload-resolution if a macro is set. Currently it happens too often, and is too slow. M +4 -4 cppducontext.h M +7 -1 expressionvisitor.cpp M +1 -1 overloadresolution.cpp M +1 -1 typeutils.cpp --- trunk/KDE/kdevelop/languages/cpp/cppduchain/cppducontext.h #815017:815018 @@ -463,7 +463,7 @@ return true; } - virtual void findLocalDeclarationsInternal( const QualifiedIdentifier& identifier, const SimpleCursor & position, const AbstractType::Ptr& dataType, bool allowUnqualifiedMatch, QList& ret, const ImportTrace& trace, typename BaseContext::SearchFlags flags ) const + virtual void findLocalDeclarationsInternal( const QualifiedIdentifier& identifier, const SimpleCursor & position, const AbstractType::Ptr& dataType, QList& ret, const ImportTrace& trace, typename BaseContext::SearchFlags flags ) const { ifDebug( kDebug(9007) << "findLocalDeclarationsInternal in " << this << "with parent" << this->parentContext() << "(" << this->scopeIdentifier() <<") for \"" << identifier.toString() << "\""; ) ifDebug( if( BaseContext::owner() && BaseContext::owner() ) kDebug(9007) << "in declaration: " << "(" << BaseContext::owner()->toString(); ) @@ -479,7 +479,7 @@ int retCount = ret.count(); - BaseContext::findLocalDeclarationsInternal(identifier, position, dataType, allowUnqualifiedMatch, ret, trace, flags ); + BaseContext::findLocalDeclarationsInternal(identifier, position, dataType, ret, trace, flags ); ifDebug( kDebug(9007) << "basically found:" << ret.count() - retCount << "containing" << BaseContext::localDeclarations().count() << "searching-position" << position.textCursor(); ) @@ -504,7 +504,7 @@ ///Search in the context this one was instantiated from QList decls; ifDebug( kDebug(9007) << "searching base"; ) - m_instantiatedFrom->findLocalDeclarationsInternal( identifier, position, dataType, allowUnqualifiedMatch, decls, trace, flags ); + m_instantiatedFrom->findLocalDeclarationsInternal( identifier, position, dataType, decls, trace, flags ); ifDebug( if( BaseContext::owner() && BaseContext::owner() ) kDebug(9007) << "in declaration: " << "(" << BaseContext::owner()->toString(); ) ifDebug( kDebug(9007) << "found" << decls.count() << "in base"; ) @@ -631,7 +631,7 @@ QVector decls = m_instantiatedFrom->localDeclarations(); foreach( Declaration* baseDecls, decls ) - this->findLocalDeclarationsInternal( QualifiedIdentifier(baseDecls->identifier()), SimpleCursor::invalid(), AbstractType::Ptr(), true, temp, trace, DUContext::NoFiltering ); + this->findLocalDeclarationsInternal( QualifiedIdentifier(baseDecls->identifier()), SimpleCursor::invalid(), AbstractType::Ptr(), temp, trace, DUContext::NoFiltering ); } return BaseContext::mergeDeclarationsInternal(definitions, position, hadContexts, trace, searchInParents, currentDepth); --- trunk/KDE/kdevelop/languages/cpp/cppduchain/expressionvisitor.cpp #815017:815018 @@ -45,6 +45,10 @@ //If this is enabled, all encounterd problems will be dumped to kDebug //#define DUMP_PROBLEMS +//If this is enabled, problems will be created when no overloaded function was found for a function-call. This is expensive, +//because the problem report contains a lot of information, and the problem currently appears very often. +//#define DEBUG_FUNCTION_CALLS + ///Remember to always when visiting a node create a PushPositiveValue object for the context /** A typical expression: @@ -1491,7 +1495,7 @@ if( constructedType && constructedType->declaration() && constructedType->declaration()->internalContext() ) { - m_lastDeclarations = convert(constructedType->declaration()->internalContext()->findLocalDeclarations( QualifiedIdentifier(constructedType->declaration()->identifier()), constructedType->declaration()->internalContext()->range().end, topContext(), AbstractType::Ptr(), true, DUContext::OnlyFunctions )); + m_lastDeclarations = convert(constructedType->declaration()->internalContext()->findLocalDeclarations( QualifiedIdentifier(constructedType->declaration()->identifier()), constructedType->declaration()->internalContext()->range().end, topContext(), AbstractType::Ptr(), DUContext::OnlyFunctions )); } } } @@ -1559,6 +1563,7 @@ if( !chosenFunction && !m_strict ) { //Because we do not want to rely too much on our understanding of the code, we take the first function instead of totally failing. +#ifdef DEBUG_FUNCTION_CALLS QString params; foreach(const OverloadResolver::Parameter& param, m_parameters) params += param.toString() + ", "; @@ -1575,6 +1580,7 @@ } problem(node, QString("Could not find a function that matches the parameters. Using first candidate function. Parameters: %1 Candidates: %2").arg(params).arg(candidates)); +#endif fail = true; } --- trunk/KDE/kdevelop/languages/cpp/cppduchain/overloadresolution.cpp #815017:815018 @@ -39,7 +39,7 @@ return 0; QList goodDeclarations; - QList declarations = m_context->findLocalDeclarations(m_context->localScopeIdentifier(), KDevelop::SimpleCursor(), m_topContext.data(), AbstractType::Ptr(), false, DUContext::OnlyFunctions); + QList declarations = m_context->findLocalDeclarations(m_context->localScopeIdentifier(), KDevelop::SimpleCursor(), m_topContext.data(), AbstractType::Ptr(), DUContext::OnlyFunctions); for( QList::iterator it = declarations.begin(); it != declarations.end(); ++it ) { if( (*it)->abstractType() ) --- trunk/KDE/kdevelop/languages/cpp/cppduchain/typeutils.cpp #815017:815018 @@ -279,7 +279,7 @@ return; } - QList declarations = context->findLocalDeclarations(QualifiedIdentifier(context->owner()->identifier()), SimpleCursor::invalid(), topContext, AbstractType::Ptr(), false, DUContext::OnlyFunctions); + QList declarations = context->findLocalDeclarations(QualifiedIdentifier(context->owner()->identifier()), SimpleCursor::invalid(), topContext, AbstractType::Ptr(), DUContext::OnlyFunctions); for( QList::iterator it = declarations.begin(); it != declarations.end(); ++it ) { ClassFunctionDeclaration* functionDeclaration = dynamic_cast( *it );