forked from qt-creator/qt-creator
Revert "C++: fix support for typedef of templated typedefs"
Infinite recursion in the lookup of:
struct common_type {
public:
typedef typename common_type<typename common_type<_Tp, _Up>::type,
V>::type type;
};
This reverts commit 9a56ce4e85bec81c521258f44e9076d0bc9cce92
Change-Id: I675fe39018789cd04127d105eb983d2cb7798ca5
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
@@ -719,43 +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;
|
||||
|
||||
// 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 && name->isEqualTo(q->base())
|
||||
&& name->isEqualTo(q->name())) {
|
||||
return lookupType_helper_inParent(name, &innerProcessed,
|
||||
searchInEnclosingScope,
|
||||
origin);
|
||||
}
|
||||
return lookupType_helper(namedTypeName, &innerProcessed,
|
||||
true, origin);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -779,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,
|
||||
@@ -790,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;
|
||||
@@ -1008,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);
|
||||
|
||||
Reference in New Issue
Block a user