summaryrefslogtreecommitdiff
path: root/src/libs/cplusplus/ResolveExpression.cpp
diff options
context:
space:
mode:
authorPrzemyslaw Gorszkowski <pgorszkowski@gmail.com>2013-02-21 15:06:02 +0100
committerErik Verbruggen <erik.verbruggen@digia.com>2013-02-21 16:44:13 +0100
commit798d84b391817d1d32fa571d00d3d4c859f9c1fd (patch)
tree6c6142c81ded6cb83d7742ed4b8d3ce078382abe /src/libs/cplusplus/ResolveExpression.cpp
parentea32191542ad0d2f9f02ad77ad38f94b5152e04e (diff)
downloadqt-creator-798d84b391817d1d32fa571d00d3d4c859f9c1fd.tar.gz
C++: fix 'using' for templates in typedefs
Fix resolving typedef of templates which is from different namespace and there was 'using' used for it. Examples are in tests. Another step to bring code completion for stl containters. Task-number: QTCREATORBUG-7978 Change-Id: I2e9e71b45d60536c1e25cf2d371c4719b15edf79 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Diffstat (limited to 'src/libs/cplusplus/ResolveExpression.cpp')
-rw-r--r--src/libs/cplusplus/ResolveExpression.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libs/cplusplus/ResolveExpression.cpp b/src/libs/cplusplus/ResolveExpression.cpp
index 23c9b201b8..db69deb0ed 100644
--- a/src/libs/cplusplus/ResolveExpression.cpp
+++ b/src/libs/cplusplus/ResolveExpression.cpp
@@ -835,8 +835,9 @@ public:
void resolve(FullySpecifiedType *type, Scope **scope, ClassOrNamespace *binding)
{
QSet<Symbol *> visited;
+ _binding = binding;
while (NamedType *namedTy = getNamedType(*type)) {
- QList<LookupItem> namedTypeItems = getNamedTypeItems(namedTy->name(), *scope, binding);
+ QList<LookupItem> namedTypeItems = getNamedTypeItems(namedTy->name(), *scope, _binding);
#ifdef DEBUG_LOOKUP
qDebug() << "-- we have" << namedTypeItems.size() << "candidates";
@@ -908,7 +909,7 @@ private:
}
bool findTypedef(const QList<LookupItem>& namedTypeItems, FullySpecifiedType *type,
- Scope **scope, QSet<Symbol *>& visited) const
+ Scope **scope, QSet<Symbol *>& visited)
{
bool foundTypedef = false;
foreach (const LookupItem &it, namedTypeItems) {
@@ -921,6 +922,7 @@ private:
// continue working with the typedefed type and scope
*type = declaration->type();
*scope = it.scope();
+ _binding = it.binding();
foundTypedef = true;
break;
}
@@ -930,6 +932,8 @@ private:
}
const LookupContext &_context;
+ // binding has to be remembered in case of resolving typedefs for templates
+ ClassOrNamespace *_binding;
};
ClassOrNamespace *ResolveExpression::baseExpression(const QList<LookupItem> &baseResults,