diff options
author | Christian Kamm <christian.d.kamm@nokia.com> | 2011-10-31 12:09:27 +0100 |
---|---|---|
committer | Christian Kamm <christian.d.kamm@nokia.com> | 2011-10-31 14:00:27 +0100 |
commit | 0021c4c3eea6582d01d25a7fd674129b7c9fcadf (patch) | |
tree | 532a4db9d74116fb979532691d86b06098f1cfea /src/libs/cplusplus/CppRewriter.cpp | |
parent | e202e4b8e0c891c362c29905e2f310ff9ee02279 (diff) | |
download | qt-creator-0021c4c3eea6582d01d25a7fd674129b7c9fcadf.tar.gz |
C++ insert def: Fix bug when minimizing name.
Constructors would not get the correct name before. Now rewriting the
function's name is not done by going through the 'rewrite type' func-
tionality but rather by minimizing the symbol's name directly.
Task-number: QTCREATORBUG-6223
Change-Id: I3c25e414337937f5dd0f54570c899ca2ca21d2ef
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
Diffstat (limited to 'src/libs/cplusplus/CppRewriter.cpp')
-rw-r--r-- | src/libs/cplusplus/CppRewriter.cpp | 33 |
1 files changed, 1 insertions, 32 deletions
diff --git a/src/libs/cplusplus/CppRewriter.cpp b/src/libs/cplusplus/CppRewriter.cpp index 8948b9297e..432f6bcbe4 100644 --- a/src/libs/cplusplus/CppRewriter.cpp +++ b/src/libs/cplusplus/CppRewriter.cpp @@ -387,18 +387,6 @@ UseMinimalNames::~UseMinimalNames() } -static bool symbolIdentical(Symbol *s1, Symbol *s2) -{ - if (!s1 || !s2) - return false; - if (s1->line() != s2->line()) - return false; - if (s1->column() != s2->column()) - return false; - - return QByteArray(s1->fileName()) == QByteArray(s2->fileName()); -} - FullySpecifiedType UseMinimalNames::apply(const Name *name, Rewrite *rewrite) const { SubstitutionEnvironment *env = rewrite->env; @@ -416,26 +404,7 @@ FullySpecifiedType UseMinimalNames::apply(const Name *name, Rewrite *rewrite) co const QList<LookupItem> results = context.lookup(name, scope); foreach (const LookupItem &r, results) { if (Symbol *d = r.declaration()) { - const Name *n = 0; - QList<const Name *> names = LookupContext::fullyQualifiedName(d); - for (int i = names.size() - 1; i >= 0; --i) { - if (! n) - n = names.at(i); - else - n = control->qualifiedNameId(names.at(i), n); - if (_target) { - // minimize the qualifications - const QList<LookupItem> tresults = _target->lookup(n); - foreach (const LookupItem &tr, tresults) { - if (symbolIdentical(tr.declaration(), d)) { - i = 0; // break outer - break; - } - } - } - } - - return control->namedType(n); + return control->namedType(LookupContext::minimalName(d, _target, control)); } return r.type(); |