Commit 9ef97873 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by hjk

CPlusPlus: Avoid reversing results for call lookup

Task-number: QTCREATORBUG-5876

Change-Id: Ia94f4aa67af2b79862acd7869a3952f6a44932cb
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent 422eee29
......@@ -49,6 +49,7 @@
#include <QList>
#include <QDebug>
#include <QSet>
#include <map>
using namespace CPlusPlus;
......@@ -630,7 +631,8 @@ bool ResolveExpression::visit(CallAST *ast)
}
if (_reference) {
_results.clear();
typedef std::multimap<int, LookupItem> LookupMap;
LookupMap sortedResults;
foreach (const LookupItem &base, baseResults) {
if (Function *funTy = base.type()->asFunctionType()) {
if (! maybeValidPrototype(funTy, actualArgumentCount))
......@@ -655,13 +657,13 @@ bool ResolveExpression::visit(CallAST *ast)
++score;
}
if (score)
_results.prepend(base);
else
_results.append(base);
sortedResults.insert(LookupMap::value_type(-score, base));
}
}
_results.clear();
for (LookupMap::const_iterator it = sortedResults.begin(); it != sortedResults.end(); ++it)
_results.append(it->second);
if (_results.isEmpty())
_results = baseResults;
......
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