summaryrefslogtreecommitdiff
path: root/src/libs/cplusplus/LookupContext.cpp
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@digia.com>2013-04-23 11:46:55 +0200
committerNikolai Kosjar <nikolai.kosjar@digia.com>2013-04-23 12:36:06 +0200
commit849534ec6fd20ef8f2c5821e96a5e0e3cfbd32b5 (patch)
tree8f7e939dbfcfb153b9416baac45f324251d1892e /src/libs/cplusplus/LookupContext.cpp
parente8c23e1d713733a47d2eb169f0c7dc0f9508a2b9 (diff)
downloadqt-creator-849534ec6fd20ef8f2c5821e96a5e0e3cfbd32b5.tar.gz
Revert "C++: fix support for typedef of templated typedefs"
Still crashes when opening the Qt Creator project, g++ (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2 (Ubuntu 12.10). This reverts commit 564c9b2842663062658a0febdcc5787098d871b2. Change-Id: Ief5c0aad463d245f68805f747d277ac298796c3d Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Diffstat (limited to 'src/libs/cplusplus/LookupContext.cpp')
-rw-r--r--src/libs/cplusplus/LookupContext.cpp67
1 files changed, 3 insertions, 64 deletions
diff --git a/src/libs/cplusplus/LookupContext.cpp b/src/libs/cplusplus/LookupContext.cpp
index 623a1be8ec..dde50df687 100644
--- a/src/libs/cplusplus/LookupContext.cpp
+++ b/src/libs/cplusplus/LookupContext.cpp
@@ -719,22 +719,10 @@ ClassOrNamespace *ClassOrNamespace::lookupType_helper(const Name *name,
if (name->isNameId() || name->isTemplateNameId() || name->isAnonymousNameId()) {
flush();
- if (name->isTemplateNameId()) {
- // if it is a base specialization, the 'name' could be an instantiation
- QMap<const TemplateNameId *, ClassOrNamespace *>::iterator it
- = _instantiations.find(name->asTemplateNameId());
- if (it != _instantiations.end())
- return it.value();
- }
-
foreach (Symbol *s, symbols()) {
if (Class *klass = s->asClass()) {
if (klass->identifier() && klass->identifier()->isEqualTo(name->identifier()))
return this;
-
- if (ClassOrNamespace *typedefedType
- = resolveTypedef(klass, name, searchInEnclosingScope, origin))
- return typedefedType;
}
}
@@ -758,9 +746,6 @@ ClassOrNamespace *ClassOrNamespace::lookupType_helper(const Name *name,
}
foreach (ClassOrNamespace *u, usings()) {
- // usings are not instantiated for templates
- if (_templateId && u->_templateId)
- continue;
if (ClassOrNamespace *r = u->lookupType_helper(name,
processed,
/*searchInEnclosingScope =*/ false,
@@ -769,21 +754,8 @@ ClassOrNamespace *ClassOrNamespace::lookupType_helper(const Name *name,
}
}
- return lookupType_helper_inParent(name, processed, searchInEnclosingScope, origin);
- }
-
- return 0;
-}
-
-ClassOrNamespace *ClassOrNamespace::lookupType_helper_inParent(const Name *name, QSet<ClassOrNamespace *> *processed,
- bool searchInEnclosingScope, ClassOrNamespace *origin)
-{
- if (_parent && searchInEnclosingScope) {
- // for templates _parent is a base specialization,
- // so we should take here rather _parent of this base specialization
- ClassOrNamespace *parent = _templateId ? _parent->_parent : _parent;
- if (parent)
- return parent->lookupType_helper(name, processed, searchInEnclosingScope, origin);
+ if (_parent && searchInEnclosingScope)
+ return _parent->lookupType_helper(name, processed, searchInEnclosingScope, origin);
}
return 0;
@@ -823,39 +795,6 @@ ClassOrNamespace *ClassOrNamespace::findSpecializationWithPointer(const Template
return 0;
}
-ClassOrNamespace *ClassOrNamespace::resolveTypedef(Class *klass, const Name *name,
- bool searchInEnclosingScope,
- ClassOrNamespace *origin)
-{
- // it can be a typedef
- const unsigned memberClassCount = klass->memberCount();
- for (unsigned i = 0; i < memberClassCount; ++i) {
- Symbol *memberClassAsSymbol = klass->memberAt(i);
- if (Declaration *declaration = memberClassAsSymbol->asDeclaration()) {
- if (declaration->isTypedef()
- && name->identifier()->isEqualTo(declaration->name()->identifier())) {
- if (NamedType *namedType = declaration->type()->asNamedType()) {
- QSet<ClassOrNamespace *> innerProcessed;
- const Name *namedTypeName = namedType->name();
- const QualifiedNameId *q = namedTypeName->asQualifiedNameId();
- if (q) {
- if (name->isEqualTo(q->base()) && name->isEqualTo(q->name()))
- return lookupType_helper_inParent(name, &innerProcessed,
- searchInEnclosingScope,
- origin);
- if ((klass->identifier()
- && klass->identifier()->isEqualTo(q->base()->identifier())))
- return this;
- }
-
- return lookupType_helper(namedTypeName, &innerProcessed, true, origin);
- }
- }
- }
- }
- return 0;
-}
-
ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name, ClassOrNamespace *origin)
{
Q_ASSERT(name != 0);
@@ -1020,7 +959,7 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name, ClassOrNamespac
oo.showReturnTypes = true;
oo.showTemplateParameters = true;
qDebug()<<"cloned"<<oo(clone->type());
- if (Class *klass = clone->asClass()) {
+ if (Class *klass = s->asClass()) {
const unsigned klassMemberCount = klass->memberCount();
for (unsigned i = 0; i < klassMemberCount; ++i){
Symbol *klassMemberAsSymbol = klass->memberAt(i);