From acbc4b9f07ee8278ee88857c5be224d15e070ffc Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Thu, 15 May 2014 12:00:13 -0400 Subject: [PATCH] C++: Get rid of {Name,Type}::isEqualTo() ...since it's superseded by the class Matcher. For consistency, rename FullySpecifiedType::isEqualTo() to match(). Change-Id: I07640f9218d814e0350265de45f05929e5d595a9 Reviewed-by: Erik Verbruggen --- src/libs/3rdparty/cplusplus/Bind.cpp | 4 +- src/libs/3rdparty/cplusplus/CoreTypes.cpp | 85 ----------- src/libs/3rdparty/cplusplus/CoreTypes.h | 18 --- .../3rdparty/cplusplus/FullySpecifiedType.cpp | 14 +- .../3rdparty/cplusplus/FullySpecifiedType.h | 5 +- src/libs/3rdparty/cplusplus/Literals.cpp | 12 -- src/libs/3rdparty/cplusplus/Literals.h | 2 - src/libs/3rdparty/cplusplus/Matcher.cpp | 30 ++-- src/libs/3rdparty/cplusplus/Name.cpp | 10 +- src/libs/3rdparty/cplusplus/Name.h | 7 +- src/libs/3rdparty/cplusplus/Names.cpp | 104 ------------- src/libs/3rdparty/cplusplus/Names.h | 11 -- src/libs/3rdparty/cplusplus/Scope.cpp | 8 +- src/libs/3rdparty/cplusplus/Symbols.cpp | 143 ------------------ src/libs/3rdparty/cplusplus/Symbols.h | 60 +++----- src/libs/3rdparty/cplusplus/Type.cpp | 4 +- src/libs/3rdparty/cplusplus/Type.h | 6 +- src/libs/cplusplus/CppRewriter.cpp | 2 +- .../DeprecatedGenTemplateInstance.cpp | 2 +- src/libs/cplusplus/LookupContext.cpp | 18 +-- src/libs/cplusplus/ResolveExpression.cpp | 6 +- src/plugins/cppeditor/cppeditor.cpp | 6 +- src/plugins/cppeditor/cppelementevaluator.cpp | 2 +- .../cppeditor/cppfunctiondecldeflink.cpp | 14 +- .../cppeditor/cppinsertvirtualmethods.cpp | 4 +- src/plugins/cppeditor/cppquickfixes.cpp | 14 +- src/plugins/cpptools/cppchecksymbols.cpp | 4 +- src/plugins/cpptools/cppcompletionassist.cpp | 6 +- src/plugins/cpptools/functionutils.cpp | 2 +- .../cpptools/insertionpointlocator.cpp | 2 +- src/plugins/cpptools/symbolfinder.cpp | 12 +- 31 files changed, 103 insertions(+), 514 deletions(-) diff --git a/src/libs/3rdparty/cplusplus/Bind.cpp b/src/libs/3rdparty/cplusplus/Bind.cpp index 93c1932c549..67d9f2f8773 100644 --- a/src/libs/3rdparty/cplusplus/Bind.cpp +++ b/src/libs/3rdparty/cplusplus/Bind.cpp @@ -2691,12 +2691,12 @@ bool Bind::visit(SimpleSpecifierAST *ast) switch (tokenKind(ast->specifier_token)) { case T_IDENTIFIER: { const Identifier *id = tokenAt(ast->specifier_token).identifier; - if (id->isEqualTo(control()->cpp11Override())) { + if (id->match(control()->cpp11Override())) { if (_type.isOverride()) translationUnit()->error(ast->specifier_token, "duplicate `override'"); _type.setOverride(true); } - else if (id->isEqualTo(control()->cpp11Final())) { + else if (id->match(control()->cpp11Final())) { if (_type.isFinal()) translationUnit()->error(ast->specifier_token, "duplicate `final'"); _type.setFinal(true); diff --git a/src/libs/3rdparty/cplusplus/CoreTypes.cpp b/src/libs/3rdparty/cplusplus/CoreTypes.cpp index fd1e2e05b18..0561f660584 100644 --- a/src/libs/3rdparty/cplusplus/CoreTypes.cpp +++ b/src/libs/3rdparty/cplusplus/CoreTypes.cpp @@ -26,14 +26,6 @@ using namespace CPlusPlus; -bool UndefinedType::isEqualTo(const Type *other) const -{ - if (other->isUndefinedType()) - return true; - - return false; -} - void UndefinedType::accept0(TypeVisitor *visitor) { visitor->visit(this); } @@ -45,12 +37,6 @@ bool UndefinedType::match0(const Type *otherType, Matcher *matcher) const return false; } -bool VoidType::isEqualTo(const Type *other) const -{ - const VoidType *o = other->asVoidType(); - return o != 0; -} - void VoidType::accept0(TypeVisitor *visitor) { visitor->visit(this); } @@ -76,16 +62,6 @@ const Name *PointerToMemberType::memberName() const FullySpecifiedType PointerToMemberType::elementType() const { return _elementType; } -bool PointerToMemberType::isEqualTo(const Type *other) const -{ - const PointerToMemberType *o = other->asPointerToMemberType(); - if (! o) - return false; - else if (! _memberName->isEqualTo(o->_memberName)) - return false; - return _elementType.isEqualTo(o->_elementType); -} - void PointerToMemberType::accept0(TypeVisitor *visitor) { visitor->visit(this); } @@ -104,14 +80,6 @@ PointerType::PointerType(const FullySpecifiedType &elementType) PointerType::~PointerType() { } -bool PointerType::isEqualTo(const Type *other) const -{ - const PointerType *o = other->asPointerType(); - if (! o) - return false; - return _elementType.isEqualTo(o->_elementType); -} - void PointerType::accept0(TypeVisitor *visitor) { visitor->visit(this); } @@ -133,16 +101,6 @@ ReferenceType::ReferenceType(const FullySpecifiedType &elementType, bool rvalueR ReferenceType::~ReferenceType() { } -bool ReferenceType::isEqualTo(const Type *other) const -{ - const ReferenceType *o = other->asReferenceType(); - if (! o) - return false; - else if (isRvalueReference() != o->isRvalueReference()) - return false; - return _elementType.isEqualTo(o->_elementType); -} - void ReferenceType::accept0(TypeVisitor *visitor) { visitor->visit(this); } @@ -167,14 +125,6 @@ IntegerType::IntegerType(int kind) IntegerType::~IntegerType() { } -bool IntegerType::isEqualTo(const Type *other) const -{ - const IntegerType *o = other->asIntegerType(); - if (! o) - return false; - return _kind == o->_kind; -} - void IntegerType::accept0(TypeVisitor *visitor) { visitor->visit(this); } @@ -210,14 +160,6 @@ bool FloatType::match0(const Type *otherType, Matcher *matcher) const int FloatType::kind() const { return _kind; } -bool FloatType::isEqualTo(const Type *other) const -{ - const FloatType *o = other->asFloatType(); - if (! o) - return false; - return _kind == o->_kind; -} - ArrayType::ArrayType(const FullySpecifiedType &elementType, unsigned size) : _elementType(elementType), _size(size) { } @@ -225,16 +167,6 @@ ArrayType::ArrayType(const FullySpecifiedType &elementType, unsigned size) ArrayType::~ArrayType() { } -bool ArrayType::isEqualTo(const Type *other) const -{ - const ArrayType *o = other->asArrayType(); - if (! o) - return false; - else if (_size != o->_size) - return false; - return _elementType.isEqualTo(o->_elementType); -} - void ArrayType::accept0(TypeVisitor *visitor) { visitor->visit(this); } @@ -262,23 +194,6 @@ NamedType::~NamedType() const Name *NamedType::name() const { return _name; } -bool NamedType::isEqualTo(const Type *other) const -{ - const NamedType *o = other->asNamedType(); - if (! o) - return false; - - const Name *name = _name; - if (const QualifiedNameId *q = name->asQualifiedNameId()) - name = q->name(); - - const Name *otherName = o->name(); - if (const QualifiedNameId *q = otherName->asQualifiedNameId()) - otherName = q->name(); - - return name->isEqualTo(otherName); -} - void NamedType::accept0(TypeVisitor *visitor) { visitor->visit(this); } diff --git a/src/libs/3rdparty/cplusplus/CoreTypes.h b/src/libs/3rdparty/cplusplus/CoreTypes.h index d9577671780..04eee89498d 100644 --- a/src/libs/3rdparty/cplusplus/CoreTypes.h +++ b/src/libs/3rdparty/cplusplus/CoreTypes.h @@ -42,8 +42,6 @@ public: virtual UndefinedType *asUndefinedType() { return this; } - virtual bool isEqualTo(const Type *other) const; - protected: virtual void accept0(TypeVisitor *visitor); virtual bool match0(const Type *otherType, Matcher *matcher) const; @@ -52,8 +50,6 @@ protected: class CPLUSPLUS_EXPORT VoidType: public Type { public: - virtual bool isEqualTo(const Type *other) const; - virtual const VoidType *asVoidType() const { return this; } @@ -86,8 +82,6 @@ public: int kind() const; - virtual bool isEqualTo(const Type *other) const; - virtual IntegerType *asIntegerType() { return this; } @@ -117,8 +111,6 @@ public: int kind() const; - virtual bool isEqualTo(const Type *other) const; - virtual const FloatType *asFloatType() const { return this; } @@ -141,8 +133,6 @@ public: FullySpecifiedType elementType() const; - virtual bool isEqualTo(const Type *other) const; - virtual const PointerType *asPointerType() const { return this; } @@ -166,8 +156,6 @@ public: const Name *memberName() const; FullySpecifiedType elementType() const; - virtual bool isEqualTo(const Type *other) const; - virtual const PointerToMemberType *asPointerToMemberType() const { return this; } @@ -192,8 +180,6 @@ public: FullySpecifiedType elementType() const; bool isRvalueReference() const; - virtual bool isEqualTo(const Type *other) const; - virtual const ReferenceType *asReferenceType() const { return this; } @@ -218,8 +204,6 @@ public: FullySpecifiedType elementType() const; unsigned size() const; - virtual bool isEqualTo(const Type *other) const; - virtual const ArrayType *asArrayType() const { return this; } @@ -243,8 +227,6 @@ public: const Name *name() const; - virtual bool isEqualTo(const Type *other) const; - virtual const NamedType *asNamedType() const { return this; } diff --git a/src/libs/3rdparty/cplusplus/FullySpecifiedType.cpp b/src/libs/3rdparty/cplusplus/FullySpecifiedType.cpp index 8ae82349ac1..9685148baf9 100644 --- a/src/libs/3rdparty/cplusplus/FullySpecifiedType.cpp +++ b/src/libs/3rdparty/cplusplus/FullySpecifiedType.cpp @@ -172,18 +172,6 @@ bool FullySpecifiedType::isUnavailable() const void FullySpecifiedType::setUnavailable(bool isUnavailable) { f._isUnavailable = isUnavailable; } -bool FullySpecifiedType::isEqualTo(const FullySpecifiedType &other) const -{ - if (_flags != other._flags) - return false; - if (_type == other._type) - return true; - else if (! _type) - return false; - else - return _type->isEqualTo(other._type); -} - Type &FullySpecifiedType::operator*() { return *_type; } @@ -250,5 +238,5 @@ bool FullySpecifiedType::match(const FullySpecifiedType &otherTy, Matcher *match if (_flags != otherTy._flags) return false; - return Type::match(type(), otherTy.type(), matcher); + return type()->match(otherTy.type(), matcher); } diff --git a/src/libs/3rdparty/cplusplus/FullySpecifiedType.h b/src/libs/3rdparty/cplusplus/FullySpecifiedType.h index 2656939d084..bf376b3f7c2 100644 --- a/src/libs/3rdparty/cplusplus/FullySpecifiedType.h +++ b/src/libs/3rdparty/cplusplus/FullySpecifiedType.h @@ -94,8 +94,6 @@ public: bool isUnavailable() const; void setUnavailable(bool isUnavailable); - bool isEqualTo(const FullySpecifiedType &other) const; - Type &operator*(); const Type &operator*() const; @@ -106,7 +104,7 @@ public: bool operator != (const FullySpecifiedType &other) const; bool operator < (const FullySpecifiedType &other) const; - bool match(const FullySpecifiedType &otherTy, Matcher *matcher) const; + bool match(const FullySpecifiedType &otherTy, Matcher *matcher = 0) const; FullySpecifiedType simplified() const; @@ -154,5 +152,4 @@ private: } // namespace CPlusPlus - #endif // CPLUSPLUS_FULLYSPECIFIEDTYPE_H diff --git a/src/libs/3rdparty/cplusplus/Literals.cpp b/src/libs/3rdparty/cplusplus/Literals.cpp index 17d02cf8bf4..cceda10d2d6 100644 --- a/src/libs/3rdparty/cplusplus/Literals.cpp +++ b/src/libs/3rdparty/cplusplus/Literals.cpp @@ -207,15 +207,3 @@ bool Identifier::match0(const Name *otherName, Matcher *matcher) const return matcher->match(this, id); return false; } - -bool Identifier::isEqualTo(const Name *other) const -{ - if (this == other) - return true; - - else if (other) { - if (const Identifier *nameId = other->asNameId()) - return equalTo(nameId); - } - return false; -} diff --git a/src/libs/3rdparty/cplusplus/Literals.h b/src/libs/3rdparty/cplusplus/Literals.h index 0ff88d4d09d..1e5e8b23f91 100644 --- a/src/libs/3rdparty/cplusplus/Literals.h +++ b/src/libs/3rdparty/cplusplus/Literals.h @@ -106,8 +106,6 @@ public: virtual const Identifier *identifier() const { return this; } - virtual bool isEqualTo(const Name *other) const; - virtual const Identifier *asNameId() const { return this; } diff --git a/src/libs/3rdparty/cplusplus/Matcher.cpp b/src/libs/3rdparty/cplusplus/Matcher.cpp index e1a05f183ea..518664b3be3 100644 --- a/src/libs/3rdparty/cplusplus/Matcher.cpp +++ b/src/libs/3rdparty/cplusplus/Matcher.cpp @@ -106,7 +106,7 @@ bool Matcher::match(const PointerToMemberType *type, const PointerToMemberType * if (type == otherType) return true; - else if (! Name::match(type->memberName(), otherType->memberName(), this)) + else if (! Matcher::match(type->memberName(), otherType->memberName(), this)) return false; else if (! type->elementType().match(otherType->elementType(), this)) @@ -159,7 +159,7 @@ bool Matcher::match(const NamedType *type, const NamedType *otherType) if (type == otherType) return true; - else if (! Name::match(type->name(), otherType->name(), this)) + else if (! Matcher::match(type->name(), otherType->name(), this)) return false; return true; @@ -184,7 +184,7 @@ bool Matcher::match(const Enum *type, const Enum *otherType) if (type == otherType) return true; - else if (! Name::match(type->unqualifiedName(), otherType->unqualifiedName(), this)) + else if (! Matcher::match(type->unqualifiedName(), otherType->unqualifiedName(), this)) return false; return true; @@ -195,7 +195,7 @@ bool Matcher::match(const Namespace *type, const Namespace *otherType) if (type == otherType) return true; - else if (! Name::match(type->unqualifiedName(), otherType->unqualifiedName(), this)) + else if (! Matcher::match(type->unqualifiedName(), otherType->unqualifiedName(), this)) return false; return true; @@ -214,7 +214,7 @@ bool Matcher::match(const ForwardClassDeclaration *type, const ForwardClassDecla if (type == otherType) return true; - else if (! Name::match(type->name(), otherType->name(), this)) + else if (! Matcher::match(type->name(), otherType->name(), this)) return false; return true; @@ -225,7 +225,7 @@ bool Matcher::match(const Class *type, const Class *otherType) if (type == otherType) return true; - else if (! Name::match(type->unqualifiedName(), otherType->unqualifiedName(), this)) + else if (! Matcher::match(type->unqualifiedName(), otherType->unqualifiedName(), this)) return false; return true; @@ -236,7 +236,7 @@ bool Matcher::match(const ObjCClass *type, const ObjCClass *otherType) if (type == otherType) return true; - else if (! Name::match(type->unqualifiedName(), otherType->unqualifiedName(), this)) + else if (! Matcher::match(type->unqualifiedName(), otherType->unqualifiedName(), this)) return false; return true; @@ -247,7 +247,7 @@ bool Matcher::match(const ObjCProtocol *type, const ObjCProtocol *otherType) if (type == otherType) return true; - else if (! Name::match(type->unqualifiedName(), otherType->unqualifiedName(), this)) + else if (! Matcher::match(type->unqualifiedName(), otherType->unqualifiedName(), this)) return false; return true; @@ -258,7 +258,7 @@ bool Matcher::match(const ObjCForwardClassDeclaration *type, const ObjCForwardCl if (type == otherType) return true; - else if (! Name::match(type->name(), otherType->name(), this)) + else if (! Matcher::match(type->name(), otherType->name(), this)) return false; return true; @@ -269,7 +269,7 @@ bool Matcher::match(const ObjCForwardProtocolDeclaration *type, const ObjCForwar if (type == otherType) return true; - else if (! Name::match(type->name(), otherType->name(), this)) + else if (! Matcher::match(type->name(), otherType->name(), this)) return false; return true; @@ -280,7 +280,7 @@ bool Matcher::match(const ObjCMethod *type, const ObjCMethod *otherType) if (type == otherType) return true; - else if (! Name::match(type->unqualifiedName(), otherType->unqualifiedName(), this)) + else if (! Matcher::match(type->unqualifiedName(), otherType->unqualifiedName(), this)) return false; else if (type->argumentCount() != otherType->argumentCount()) @@ -330,7 +330,7 @@ bool Matcher::match(const TemplateNameId *name, const TemplateNameId *otherName) bool Matcher::match(const DestructorNameId *name, const DestructorNameId *otherName) { - return Name::match(name->name(), otherName->name(), this); + return Matcher::match(name->name(), otherName->name(), this); } bool Matcher::match(const OperatorNameId *name, const OperatorNameId *otherName) @@ -345,8 +345,8 @@ bool Matcher::match(const ConversionNameId *name, const ConversionNameId *otherN bool Matcher::match(const QualifiedNameId *name, const QualifiedNameId *otherName) { - if (Name::match(name->base(), otherName->base(), this)) - return Name::match(name->name(), otherName->name(), this); + if (Matcher::match(name->base(), otherName->base(), this)) + return Matcher::match(name->name(), otherName->name(), this); return false; } @@ -356,7 +356,7 @@ bool Matcher::match(const SelectorNameId *name, const SelectorNameId *otherName) if (name->hasArguments() != otherName->hasArguments() || nc != otherName->nameCount()) return false; for (unsigned i = 0; i < nc; ++i) - if (!Name::match(name->nameAt(i), otherName->nameAt(i), this)) + if (! Matcher::match(name->nameAt(i), otherName->nameAt(i), this)) return false; return true; } diff --git a/src/libs/3rdparty/cplusplus/Name.cpp b/src/libs/3rdparty/cplusplus/Name.cpp index a7fe40f4b8b..1016586c891 100644 --- a/src/libs/3rdparty/cplusplus/Name.cpp +++ b/src/libs/3rdparty/cplusplus/Name.cpp @@ -58,11 +58,6 @@ bool Name::isQualifiedNameId() const bool Name::isSelectorNameId() const { return asSelectorNameId() != 0; } -bool Name::match(const Name *name, const Name *otherName, Matcher *matcher) -{ - return Matcher::match(name, otherName, matcher); -} - void Name::accept(NameVisitor *visitor) const { if (visitor->preVisit(this)) @@ -77,6 +72,11 @@ void Name::accept(const Name *name, NameVisitor *visitor) name->accept(visitor); } +bool Name::match(const Name *other, Matcher *matcher) const +{ + return Matcher::match(this, other, matcher); +} + bool Name::Compare::operator()(const Name *name, const Name *other) const { if (name == 0) diff --git a/src/libs/3rdparty/cplusplus/Name.h b/src/libs/3rdparty/cplusplus/Name.h index 9f6ae89e30b..507195bead1 100644 --- a/src/libs/3rdparty/cplusplus/Name.h +++ b/src/libs/3rdparty/cplusplus/Name.h @@ -22,6 +22,7 @@ #define CPLUSPLUS_NAME_H #include "CPlusPlusForwardDeclarations.h" +#include "Matcher.h" #include @@ -53,13 +54,11 @@ public: virtual const QualifiedNameId *asQualifiedNameId() const { return 0; } virtual const SelectorNameId *asSelectorNameId() const { return 0; } - virtual bool isEqualTo(const Name *other) const = 0; // TODO: remove me - - static bool match(const Name *name, const Name *otherName, Matcher *matcher); - void accept(NameVisitor *visitor) const; static void accept(const Name *name, NameVisitor *visitor); + bool match(const Name *other, Matcher *matcher = 0) const; + public: struct Compare: std::binary_function { bool operator()(const Name *name, const Name *other) const; diff --git a/src/libs/3rdparty/cplusplus/Names.cpp b/src/libs/3rdparty/cplusplus/Names.cpp index c0c2fe0d216..10bbf389d28 100644 --- a/src/libs/3rdparty/cplusplus/Names.cpp +++ b/src/libs/3rdparty/cplusplus/Names.cpp @@ -54,21 +54,6 @@ const Name *QualifiedNameId::base() const const Name *QualifiedNameId::name() const { return _name; } -bool QualifiedNameId::isEqualTo(const Name *other) const -{ - if (other) { - if (const QualifiedNameId *q = other->asQualifiedNameId()) { - if (_base == q->_base || (_base && _base->isEqualTo(q->_base))) { - if (_name == q->_name || (_name && _name->isEqualTo(q->_name))) { - return true; - } - } - } - } - - return false; -} - DestructorNameId::DestructorNameId(const Name *name) : _name(name) { } @@ -92,19 +77,6 @@ const Name *DestructorNameId::name() const const Identifier *DestructorNameId::identifier() const { return _name->identifier(); } -bool DestructorNameId::isEqualTo(const Name *other) const -{ - if (other) { - const DestructorNameId *d = other->asDestructorNameId(); - if (! d) - return false; - const Name *l = name(); - const Name *r = d->name(); - return l->isEqualTo(r); - } - return false; -} - TemplateNameId::~TemplateNameId() { } @@ -127,28 +99,6 @@ unsigned TemplateNameId::templateArgumentCount() const const FullySpecifiedType &TemplateNameId::templateArgumentAt(unsigned index) const { return _templateArguments[index]; } -bool TemplateNameId::isEqualTo(const Name *other) const -{ - if (other) { - const TemplateNameId *t = other->asTemplateNameId(); - if (! t) - return false; - const Identifier *l = identifier(); - const Identifier *r = t->identifier(); - if (! l->isEqualTo(r)) - return false; - if (templateArgumentCount() != t->templateArgumentCount()) - return false; - for (unsigned i = 0, ei = templateArgumentCount(); i != ei; ++i) { - const FullySpecifiedType &l = _templateArguments[i]; - const FullySpecifiedType &r = t->_templateArguments[i]; - if (! l.isEqualTo(r)) - return false; - } - } - return true; -} - bool TemplateNameId::Compare::operator()(const TemplateNameId *name, const TemplateNameId *other) const { @@ -206,17 +156,6 @@ OperatorNameId::Kind OperatorNameId::kind() const const Identifier *OperatorNameId::identifier() const { return 0; } -bool OperatorNameId::isEqualTo(const Name *other) const -{ - if (other) { - const OperatorNameId *o = other->asOperatorNameId(); - if (! o) - return false; - return _kind == o->kind(); - } - return false; -} - ConversionNameId::ConversionNameId(const FullySpecifiedType &type) : _type(type) { } @@ -240,17 +179,6 @@ FullySpecifiedType ConversionNameId::type() const const Identifier *ConversionNameId::identifier() const { return 0; } -bool ConversionNameId::isEqualTo(const Name *other) const -{ - if (other) { - const ConversionNameId *c = other->asConversionNameId(); - if (! c) - return false; - return _type.isEqualTo(c->type()); - } - return false; -} - SelectorNameId::~SelectorNameId() { } @@ -281,29 +209,6 @@ const Name *SelectorNameId::nameAt(unsigned index) const bool SelectorNameId::hasArguments() const { return _hasArguments; } -bool SelectorNameId::isEqualTo(const Name *other) const -{ - if (other) { - const SelectorNameId *q = other->asSelectorNameId(); - if (! q) - return false; - else if (hasArguments() != q->hasArguments()) - return false; - else { - const unsigned count = nameCount(); - if (count != q->nameCount()) - return false; - for (unsigned i = 0; i < count; ++i) { - const Name *l = nameAt(i); - const Name *r = q->nameAt(i); - if (! l->isEqualTo(r)) - return false; - } - } - } - return true; -} - AnonymousNameId::AnonymousNameId(unsigned classTokenIndex) : _classTokenIndex(classTokenIndex) { } @@ -328,12 +233,3 @@ bool AnonymousNameId::match0(const Name *otherName, Matcher *matcher) const const Identifier *AnonymousNameId::identifier() const { return 0; } - -bool AnonymousNameId::isEqualTo(const Name *other) const -{ - if (other) { - const AnonymousNameId *c = other->asAnonymousNameId(); - return (c && this->_classTokenIndex == c->_classTokenIndex); - } - return false; -} diff --git a/src/libs/3rdparty/cplusplus/Names.h b/src/libs/3rdparty/cplusplus/Names.h index ca59da702f4..3d48b6a237d 100644 --- a/src/libs/3rdparty/cplusplus/Names.h +++ b/src/libs/3rdparty/cplusplus/Names.h @@ -41,8 +41,6 @@ public: const Name *base() const; const Name *name() const; - virtual bool isEqualTo(const Name *other) const; - virtual const QualifiedNameId *asQualifiedNameId() const { return this; } @@ -65,8 +63,6 @@ public: virtual const Identifier *identifier() const; - virtual bool isEqualTo(const Name *other) const; - virtual const DestructorNameId *asDestructorNameId() const { return this; } @@ -96,8 +92,6 @@ public: unsigned templateArgumentCount() const; const FullySpecifiedType &templateArgumentAt(unsigned index) const; - virtual bool isEqualTo(const Name *other) const; - virtual const TemplateNameId *asTemplateNameId() const { return this; } @@ -190,7 +184,6 @@ public: Kind kind() const; virtual const Identifier *identifier() const; - virtual bool isEqualTo(const Name *other) const; virtual const OperatorNameId *asOperatorNameId() const { return this; } @@ -212,7 +205,6 @@ public: FullySpecifiedType type() const; virtual const Identifier *identifier() const; - virtual bool isEqualTo(const Name *other) const; virtual const ConversionNameId *asConversionNameId() const { return this; } @@ -240,8 +232,6 @@ public: const Name *nameAt(unsigned index) const; bool hasArguments() const; - virtual bool isEqualTo(const Name *other) const; - virtual const SelectorNameId *asSelectorNameId() const { return this; } @@ -268,7 +258,6 @@ public: unsigned classTokenIndex() const; virtual const Identifier *identifier() const; - virtual bool isEqualTo(const Name *other) const; virtual const AnonymousNameId *asAnonymousNameId() const { return this; } diff --git a/src/libs/3rdparty/cplusplus/Scope.cpp b/src/libs/3rdparty/cplusplus/Scope.cpp index ab1ba2710dd..eff79368e44 100644 --- a/src/libs/3rdparty/cplusplus/Scope.cpp +++ b/src/libs/3rdparty/cplusplus/Scope.cpp @@ -144,18 +144,18 @@ Symbol *SymbolTable::lookat(const Identifier *id) const if (! identity) { continue; } else if (const Identifier *nameId = identity->asNameId()) { - if (nameId->identifier()->isEqualTo(id)) + if (nameId->identifier()->match(id)) break; } else if (const TemplateNameId *t = identity->asTemplateNameId()) { - if (t->identifier()->isEqualTo(id)) + if (t->identifier()->match(id)) break; } else if (const DestructorNameId *d = identity->asDestructorNameId()) { - if (d->identifier()->isEqualTo(id)) + if (d->identifier()->match(id)) break; } else if (identity->isQualifiedNameId()) { return 0; } else if (const SelectorNameId *selectorNameId = identity->asSelectorNameId()) { - if (selectorNameId->identifier()->isEqualTo(id)) + if (selectorNameId->identifier()->match(id)) break; } } diff --git a/src/libs/3rdparty/cplusplus/Symbols.cpp b/src/libs/3rdparty/cplusplus/Symbols.cpp index 24647f22144..df29feeca94 100644 --- a/src/libs/3rdparty/cplusplus/Symbols.cpp +++ b/src/libs/3rdparty/cplusplus/Symbols.cpp @@ -245,14 +245,6 @@ bool Function::isSignatureEqualTo(const Function *other, Matcher *matcher) const return true; } -bool Function::isEqualTo(const Type *other) const -{ - const Function *o = other->asFunctionType(); - if (!isSignatureEqualTo(o)) - return false; - return _returnType.isEqualTo(o->_returnType); -} - void Function::accept0(TypeVisitor *visitor) { visitor->visit(this); } @@ -457,20 +449,6 @@ Enum::~Enum() FullySpecifiedType Enum::type() const { return FullySpecifiedType(const_cast(this)); } -bool Enum::isEqualTo(const Type *other) const -{ - const Enum *o = other->asEnumType(); - if (! o) - return false; - const Name *l = unqualifiedName(); - const Name *r = o->unqualifiedName(); - if (l == r) - return true; - else if (! l) - return false; - return l->isEqualTo(r); -} - bool Enum::isScoped() const { return _isScoped; @@ -540,9 +518,6 @@ Symbol *Template::declaration() const FullySpecifiedType Template::type() const { return FullySpecifiedType(const_cast