forked from qt-creator/qt-creator
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 <erik.verbruggen@digia.com>
This commit is contained in:
4
src/libs/3rdparty/cplusplus/Bind.cpp
vendored
4
src/libs/3rdparty/cplusplus/Bind.cpp
vendored
@@ -2691,12 +2691,12 @@ bool Bind::visit(SimpleSpecifierAST *ast)
|
|||||||
switch (tokenKind(ast->specifier_token)) {
|
switch (tokenKind(ast->specifier_token)) {
|
||||||
case T_IDENTIFIER: {
|
case T_IDENTIFIER: {
|
||||||
const Identifier *id = tokenAt(ast->specifier_token).identifier;
|
const Identifier *id = tokenAt(ast->specifier_token).identifier;
|
||||||
if (id->isEqualTo(control()->cpp11Override())) {
|
if (id->match(control()->cpp11Override())) {
|
||||||
if (_type.isOverride())
|
if (_type.isOverride())
|
||||||
translationUnit()->error(ast->specifier_token, "duplicate `override'");
|
translationUnit()->error(ast->specifier_token, "duplicate `override'");
|
||||||
_type.setOverride(true);
|
_type.setOverride(true);
|
||||||
}
|
}
|
||||||
else if (id->isEqualTo(control()->cpp11Final())) {
|
else if (id->match(control()->cpp11Final())) {
|
||||||
if (_type.isFinal())
|
if (_type.isFinal())
|
||||||
translationUnit()->error(ast->specifier_token, "duplicate `final'");
|
translationUnit()->error(ast->specifier_token, "duplicate `final'");
|
||||||
_type.setFinal(true);
|
_type.setFinal(true);
|
||||||
|
|||||||
85
src/libs/3rdparty/cplusplus/CoreTypes.cpp
vendored
85
src/libs/3rdparty/cplusplus/CoreTypes.cpp
vendored
@@ -26,14 +26,6 @@
|
|||||||
|
|
||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
|
|
||||||
bool UndefinedType::isEqualTo(const Type *other) const
|
|
||||||
{
|
|
||||||
if (other->isUndefinedType())
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UndefinedType::accept0(TypeVisitor *visitor)
|
void UndefinedType::accept0(TypeVisitor *visitor)
|
||||||
{ visitor->visit(this); }
|
{ visitor->visit(this); }
|
||||||
|
|
||||||
@@ -45,12 +37,6 @@ bool UndefinedType::match0(const Type *otherType, Matcher *matcher) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VoidType::isEqualTo(const Type *other) const
|
|
||||||
{
|
|
||||||
const VoidType *o = other->asVoidType();
|
|
||||||
return o != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void VoidType::accept0(TypeVisitor *visitor)
|
void VoidType::accept0(TypeVisitor *visitor)
|
||||||
{ visitor->visit(this); }
|
{ visitor->visit(this); }
|
||||||
|
|
||||||
@@ -76,16 +62,6 @@ const Name *PointerToMemberType::memberName() const
|
|||||||
FullySpecifiedType PointerToMemberType::elementType() const
|
FullySpecifiedType PointerToMemberType::elementType() const
|
||||||
{ return _elementType; }
|
{ 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)
|
void PointerToMemberType::accept0(TypeVisitor *visitor)
|
||||||
{ visitor->visit(this); }
|
{ visitor->visit(this); }
|
||||||
|
|
||||||
@@ -104,14 +80,6 @@ PointerType::PointerType(const FullySpecifiedType &elementType)
|
|||||||
PointerType::~PointerType()
|
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)
|
void PointerType::accept0(TypeVisitor *visitor)
|
||||||
{ visitor->visit(this); }
|
{ visitor->visit(this); }
|
||||||
|
|
||||||
@@ -133,16 +101,6 @@ ReferenceType::ReferenceType(const FullySpecifiedType &elementType, bool rvalueR
|
|||||||
ReferenceType::~ReferenceType()
|
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)
|
void ReferenceType::accept0(TypeVisitor *visitor)
|
||||||
{ visitor->visit(this); }
|
{ visitor->visit(this); }
|
||||||
|
|
||||||
@@ -167,14 +125,6 @@ IntegerType::IntegerType(int kind)
|
|||||||
IntegerType::~IntegerType()
|
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)
|
void IntegerType::accept0(TypeVisitor *visitor)
|
||||||
{ visitor->visit(this); }
|
{ visitor->visit(this); }
|
||||||
|
|
||||||
@@ -210,14 +160,6 @@ bool FloatType::match0(const Type *otherType, Matcher *matcher) const
|
|||||||
int FloatType::kind() const
|
int FloatType::kind() const
|
||||||
{ return _kind; }
|
{ 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)
|
ArrayType::ArrayType(const FullySpecifiedType &elementType, unsigned size)
|
||||||
: _elementType(elementType), _size(size)
|
: _elementType(elementType), _size(size)
|
||||||
{ }
|
{ }
|
||||||
@@ -225,16 +167,6 @@ ArrayType::ArrayType(const FullySpecifiedType &elementType, unsigned size)
|
|||||||
ArrayType::~ArrayType()
|
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)
|
void ArrayType::accept0(TypeVisitor *visitor)
|
||||||
{ visitor->visit(this); }
|
{ visitor->visit(this); }
|
||||||
|
|
||||||
@@ -262,23 +194,6 @@ NamedType::~NamedType()
|
|||||||
const Name *NamedType::name() const
|
const Name *NamedType::name() const
|
||||||
{ return _name; }
|
{ 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)
|
void NamedType::accept0(TypeVisitor *visitor)
|
||||||
{ visitor->visit(this); }
|
{ visitor->visit(this); }
|
||||||
|
|
||||||
|
|||||||
18
src/libs/3rdparty/cplusplus/CoreTypes.h
vendored
18
src/libs/3rdparty/cplusplus/CoreTypes.h
vendored
@@ -42,8 +42,6 @@ public:
|
|||||||
virtual UndefinedType *asUndefinedType()
|
virtual UndefinedType *asUndefinedType()
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
virtual bool isEqualTo(const Type *other) const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void accept0(TypeVisitor *visitor);
|
virtual void accept0(TypeVisitor *visitor);
|
||||||
virtual bool match0(const Type *otherType, Matcher *matcher) const;
|
virtual bool match0(const Type *otherType, Matcher *matcher) const;
|
||||||
@@ -52,8 +50,6 @@ protected:
|
|||||||
class CPLUSPLUS_EXPORT VoidType: public Type
|
class CPLUSPLUS_EXPORT VoidType: public Type
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual bool isEqualTo(const Type *other) const;
|
|
||||||
|
|
||||||
virtual const VoidType *asVoidType() const
|
virtual const VoidType *asVoidType() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
@@ -86,8 +82,6 @@ public:
|
|||||||
|
|
||||||
int kind() const;
|
int kind() const;
|
||||||
|
|
||||||
virtual bool isEqualTo(const Type *other) const;
|
|
||||||
|
|
||||||
virtual IntegerType *asIntegerType()
|
virtual IntegerType *asIntegerType()
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
@@ -117,8 +111,6 @@ public:
|
|||||||
|
|
||||||
int kind() const;
|
int kind() const;
|
||||||
|
|
||||||
virtual bool isEqualTo(const Type *other) const;
|
|
||||||
|
|
||||||
virtual const FloatType *asFloatType() const
|
virtual const FloatType *asFloatType() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
@@ -141,8 +133,6 @@ public:
|
|||||||
|
|
||||||
FullySpecifiedType elementType() const;
|
FullySpecifiedType elementType() const;
|
||||||
|
|
||||||
virtual bool isEqualTo(const Type *other) const;
|
|
||||||
|
|
||||||
virtual const PointerType *asPointerType() const
|
virtual const PointerType *asPointerType() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
@@ -166,8 +156,6 @@ public:
|
|||||||
const Name *memberName() const;
|
const Name *memberName() const;
|
||||||
FullySpecifiedType elementType() const;
|
FullySpecifiedType elementType() const;
|
||||||
|
|
||||||
virtual bool isEqualTo(const Type *other) const;
|
|
||||||
|
|
||||||
virtual const PointerToMemberType *asPointerToMemberType() const
|
virtual const PointerToMemberType *asPointerToMemberType() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
@@ -192,8 +180,6 @@ public:
|
|||||||
FullySpecifiedType elementType() const;
|
FullySpecifiedType elementType() const;
|
||||||
bool isRvalueReference() const;
|
bool isRvalueReference() const;
|
||||||
|
|
||||||
virtual bool isEqualTo(const Type *other) const;
|
|
||||||
|
|
||||||
virtual const ReferenceType *asReferenceType() const
|
virtual const ReferenceType *asReferenceType() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
@@ -218,8 +204,6 @@ public:
|
|||||||
FullySpecifiedType elementType() const;
|
FullySpecifiedType elementType() const;
|
||||||
unsigned size() const;
|
unsigned size() const;
|
||||||
|
|
||||||
virtual bool isEqualTo(const Type *other) const;
|
|
||||||
|
|
||||||
virtual const ArrayType *asArrayType() const
|
virtual const ArrayType *asArrayType() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
@@ -243,8 +227,6 @@ public:
|
|||||||
|
|
||||||
const Name *name() const;
|
const Name *name() const;
|
||||||
|
|
||||||
virtual bool isEqualTo(const Type *other) const;
|
|
||||||
|
|
||||||
virtual const NamedType *asNamedType() const
|
virtual const NamedType *asNamedType() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
|
|||||||
@@ -172,18 +172,6 @@ bool FullySpecifiedType::isUnavailable() const
|
|||||||
void FullySpecifiedType::setUnavailable(bool isUnavailable)
|
void FullySpecifiedType::setUnavailable(bool isUnavailable)
|
||||||
{ f._isUnavailable = 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*()
|
Type &FullySpecifiedType::operator*()
|
||||||
{ return *_type; }
|
{ return *_type; }
|
||||||
|
|
||||||
@@ -250,5 +238,5 @@ bool FullySpecifiedType::match(const FullySpecifiedType &otherTy, Matcher *match
|
|||||||
if (_flags != otherTy._flags)
|
if (_flags != otherTy._flags)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return Type::match(type(), otherTy.type(), matcher);
|
return type()->match(otherTy.type(), matcher);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,8 +94,6 @@ public:
|
|||||||
bool isUnavailable() const;
|
bool isUnavailable() const;
|
||||||
void setUnavailable(bool isUnavailable);
|
void setUnavailable(bool isUnavailable);
|
||||||
|
|
||||||
bool isEqualTo(const FullySpecifiedType &other) const;
|
|
||||||
|
|
||||||
Type &operator*();
|
Type &operator*();
|
||||||
const Type &operator*() const;
|
const Type &operator*() const;
|
||||||
|
|
||||||
@@ -106,7 +104,7 @@ public:
|
|||||||
bool operator != (const FullySpecifiedType &other) const;
|
bool operator != (const FullySpecifiedType &other) const;
|
||||||
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;
|
FullySpecifiedType simplified() const;
|
||||||
|
|
||||||
@@ -154,5 +152,4 @@ private:
|
|||||||
|
|
||||||
} // namespace CPlusPlus
|
} // namespace CPlusPlus
|
||||||
|
|
||||||
|
|
||||||
#endif // CPLUSPLUS_FULLYSPECIFIEDTYPE_H
|
#endif // CPLUSPLUS_FULLYSPECIFIEDTYPE_H
|
||||||
|
|||||||
12
src/libs/3rdparty/cplusplus/Literals.cpp
vendored
12
src/libs/3rdparty/cplusplus/Literals.cpp
vendored
@@ -207,15 +207,3 @@ bool Identifier::match0(const Name *otherName, Matcher *matcher) const
|
|||||||
return matcher->match(this, id);
|
return matcher->match(this, id);
|
||||||
return false;
|
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;
|
|
||||||
}
|
|
||||||
|
|||||||
2
src/libs/3rdparty/cplusplus/Literals.h
vendored
2
src/libs/3rdparty/cplusplus/Literals.h
vendored
@@ -106,8 +106,6 @@ public:
|
|||||||
|
|
||||||
virtual const Identifier *identifier() const { return this; }
|
virtual const Identifier *identifier() const { return this; }
|
||||||
|
|
||||||
virtual bool isEqualTo(const Name *other) const;
|
|
||||||
|
|
||||||
virtual const Identifier *asNameId() const
|
virtual const Identifier *asNameId() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
|
|||||||
30
src/libs/3rdparty/cplusplus/Matcher.cpp
vendored
30
src/libs/3rdparty/cplusplus/Matcher.cpp
vendored
@@ -106,7 +106,7 @@ bool Matcher::match(const PointerToMemberType *type, const PointerToMemberType *
|
|||||||
if (type == otherType)
|
if (type == otherType)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
else if (! Name::match(type->memberName(), otherType->memberName(), this))
|
else if (! Matcher::match(type->memberName(), otherType->memberName(), this))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
else if (! type->elementType().match(otherType->elementType(), this))
|
else if (! type->elementType().match(otherType->elementType(), this))
|
||||||
@@ -159,7 +159,7 @@ bool Matcher::match(const NamedType *type, const NamedType *otherType)
|
|||||||
if (type == otherType)
|
if (type == otherType)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
else if (! Name::match(type->name(), otherType->name(), this))
|
else if (! Matcher::match(type->name(), otherType->name(), this))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -184,7 +184,7 @@ bool Matcher::match(const Enum *type, const Enum *otherType)
|
|||||||
if (type == otherType)
|
if (type == otherType)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
else if (! Name::match(type->unqualifiedName(), otherType->unqualifiedName(), this))
|
else if (! Matcher::match(type->unqualifiedName(), otherType->unqualifiedName(), this))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -195,7 +195,7 @@ bool Matcher::match(const Namespace *type, const Namespace *otherType)
|
|||||||
if (type == otherType)
|
if (type == otherType)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
else if (! Name::match(type->unqualifiedName(), otherType->unqualifiedName(), this))
|
else if (! Matcher::match(type->unqualifiedName(), otherType->unqualifiedName(), this))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -214,7 +214,7 @@ bool Matcher::match(const ForwardClassDeclaration *type, const ForwardClassDecla
|
|||||||
if (type == otherType)
|
if (type == otherType)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
else if (! Name::match(type->name(), otherType->name(), this))
|
else if (! Matcher::match(type->name(), otherType->name(), this))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -225,7 +225,7 @@ bool Matcher::match(const Class *type, const Class *otherType)
|
|||||||
if (type == otherType)
|
if (type == otherType)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
else if (! Name::match(type->unqualifiedName(), otherType->unqualifiedName(), this))
|
else if (! Matcher::match(type->unqualifiedName(), otherType->unqualifiedName(), this))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -236,7 +236,7 @@ bool Matcher::match(const ObjCClass *type, const ObjCClass *otherType)
|
|||||||
if (type == otherType)
|
if (type == otherType)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
else if (! Name::match(type->unqualifiedName(), otherType->unqualifiedName(), this))
|
else if (! Matcher::match(type->unqualifiedName(), otherType->unqualifiedName(), this))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -247,7 +247,7 @@ bool Matcher::match(const ObjCProtocol *type, const ObjCProtocol *otherType)
|
|||||||
if (type == otherType)
|
if (type == otherType)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
else if (! Name::match(type->unqualifiedName(), otherType->unqualifiedName(), this))
|
else if (! Matcher::match(type->unqualifiedName(), otherType->unqualifiedName(), this))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -258,7 +258,7 @@ bool Matcher::match(const ObjCForwardClassDeclaration *type, const ObjCForwardCl
|
|||||||
if (type == otherType)
|
if (type == otherType)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
else if (! Name::match(type->name(), otherType->name(), this))
|
else if (! Matcher::match(type->name(), otherType->name(), this))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -269,7 +269,7 @@ bool Matcher::match(const ObjCForwardProtocolDeclaration *type, const ObjCForwar
|
|||||||
if (type == otherType)
|
if (type == otherType)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
else if (! Name::match(type->name(), otherType->name(), this))
|
else if (! Matcher::match(type->name(), otherType->name(), this))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -280,7 +280,7 @@ bool Matcher::match(const ObjCMethod *type, const ObjCMethod *otherType)
|
|||||||
if (type == otherType)
|
if (type == otherType)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
else if (! Name::match(type->unqualifiedName(), otherType->unqualifiedName(), this))
|
else if (! Matcher::match(type->unqualifiedName(), otherType->unqualifiedName(), this))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
else if (type->argumentCount() != otherType->argumentCount())
|
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)
|
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)
|
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)
|
bool Matcher::match(const QualifiedNameId *name, const QualifiedNameId *otherName)
|
||||||
{
|
{
|
||||||
if (Name::match(name->base(), otherName->base(), this))
|
if (Matcher::match(name->base(), otherName->base(), this))
|
||||||
return Name::match(name->name(), otherName->name(), this);
|
return Matcher::match(name->name(), otherName->name(), this);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -356,7 +356,7 @@ bool Matcher::match(const SelectorNameId *name, const SelectorNameId *otherName)
|
|||||||
if (name->hasArguments() != otherName->hasArguments() || nc != otherName->nameCount())
|
if (name->hasArguments() != otherName->hasArguments() || nc != otherName->nameCount())
|
||||||
return false;
|
return false;
|
||||||
for (unsigned i = 0; i < nc; ++i)
|
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 false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
10
src/libs/3rdparty/cplusplus/Name.cpp
vendored
10
src/libs/3rdparty/cplusplus/Name.cpp
vendored
@@ -58,11 +58,6 @@ bool Name::isQualifiedNameId() const
|
|||||||
bool Name::isSelectorNameId() const
|
bool Name::isSelectorNameId() const
|
||||||
{ return asSelectorNameId() != 0; }
|
{ 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
|
void Name::accept(NameVisitor *visitor) const
|
||||||
{
|
{
|
||||||
if (visitor->preVisit(this))
|
if (visitor->preVisit(this))
|
||||||
@@ -77,6 +72,11 @@ void Name::accept(const Name *name, NameVisitor *visitor)
|
|||||||
name->accept(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
|
bool Name::Compare::operator()(const Name *name, const Name *other) const
|
||||||
{
|
{
|
||||||
if (name == 0)
|
if (name == 0)
|
||||||
|
|||||||
7
src/libs/3rdparty/cplusplus/Name.h
vendored
7
src/libs/3rdparty/cplusplus/Name.h
vendored
@@ -22,6 +22,7 @@
|
|||||||
#define CPLUSPLUS_NAME_H
|
#define CPLUSPLUS_NAME_H
|
||||||
|
|
||||||
#include "CPlusPlusForwardDeclarations.h"
|
#include "CPlusPlusForwardDeclarations.h"
|
||||||
|
#include "Matcher.h"
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
@@ -53,13 +54,11 @@ public:
|
|||||||
virtual const QualifiedNameId *asQualifiedNameId() const { return 0; }
|
virtual const QualifiedNameId *asQualifiedNameId() const { return 0; }
|
||||||
virtual const SelectorNameId *asSelectorNameId() 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;
|
void accept(NameVisitor *visitor) const;
|
||||||
static void accept(const Name *name, NameVisitor *visitor);
|
static void accept(const Name *name, NameVisitor *visitor);
|
||||||
|
|
||||||
|
bool match(const Name *other, Matcher *matcher = 0) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
struct Compare: std::binary_function<const Name *, const Name *, bool> {
|
struct Compare: std::binary_function<const Name *, const Name *, bool> {
|
||||||
bool operator()(const Name *name, const Name *other) const;
|
bool operator()(const Name *name, const Name *other) const;
|
||||||
|
|||||||
104
src/libs/3rdparty/cplusplus/Names.cpp
vendored
104
src/libs/3rdparty/cplusplus/Names.cpp
vendored
@@ -54,21 +54,6 @@ const Name *QualifiedNameId::base() const
|
|||||||
const Name *QualifiedNameId::name() const
|
const Name *QualifiedNameId::name() const
|
||||||
{ return _name; }
|
{ 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)
|
DestructorNameId::DestructorNameId(const Name *name)
|
||||||
: _name(name)
|
: _name(name)
|
||||||
{ }
|
{ }
|
||||||
@@ -92,19 +77,6 @@ const Name *DestructorNameId::name() const
|
|||||||
const Identifier *DestructorNameId::identifier() const
|
const Identifier *DestructorNameId::identifier() const
|
||||||
{ return _name->identifier(); }
|
{ 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()
|
TemplateNameId::~TemplateNameId()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@@ -127,28 +99,6 @@ unsigned TemplateNameId::templateArgumentCount() const
|
|||||||
const FullySpecifiedType &TemplateNameId::templateArgumentAt(unsigned index) const
|
const FullySpecifiedType &TemplateNameId::templateArgumentAt(unsigned index) const
|
||||||
{ return _templateArguments[index]; }
|
{ 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,
|
bool TemplateNameId::Compare::operator()(const TemplateNameId *name,
|
||||||
const TemplateNameId *other) const
|
const TemplateNameId *other) const
|
||||||
{
|
{
|
||||||
@@ -206,17 +156,6 @@ OperatorNameId::Kind OperatorNameId::kind() const
|
|||||||
const Identifier *OperatorNameId::identifier() const
|
const Identifier *OperatorNameId::identifier() const
|
||||||
{ return 0; }
|
{ 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)
|
ConversionNameId::ConversionNameId(const FullySpecifiedType &type)
|
||||||
: _type(type)
|
: _type(type)
|
||||||
{ }
|
{ }
|
||||||
@@ -240,17 +179,6 @@ FullySpecifiedType ConversionNameId::type() const
|
|||||||
const Identifier *ConversionNameId::identifier() const
|
const Identifier *ConversionNameId::identifier() const
|
||||||
{ return 0; }
|
{ 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()
|
SelectorNameId::~SelectorNameId()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@@ -281,29 +209,6 @@ const Name *SelectorNameId::nameAt(unsigned index) const
|
|||||||
bool SelectorNameId::hasArguments() const
|
bool SelectorNameId::hasArguments() const
|
||||||
{ return _hasArguments; }
|
{ 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)
|
AnonymousNameId::AnonymousNameId(unsigned classTokenIndex)
|
||||||
: _classTokenIndex(classTokenIndex)
|
: _classTokenIndex(classTokenIndex)
|
||||||
{ }
|
{ }
|
||||||
@@ -328,12 +233,3 @@ bool AnonymousNameId::match0(const Name *otherName, Matcher *matcher) const
|
|||||||
|
|
||||||
const Identifier *AnonymousNameId::identifier() const
|
const Identifier *AnonymousNameId::identifier() const
|
||||||
{ return 0; }
|
{ return 0; }
|
||||||
|
|
||||||
bool AnonymousNameId::isEqualTo(const Name *other) const
|
|
||||||
{
|
|
||||||
if (other) {
|
|
||||||
const AnonymousNameId *c = other->asAnonymousNameId();
|
|
||||||
return (c && this->_classTokenIndex == c->_classTokenIndex);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|||||||
11
src/libs/3rdparty/cplusplus/Names.h
vendored
11
src/libs/3rdparty/cplusplus/Names.h
vendored
@@ -41,8 +41,6 @@ public:
|
|||||||
const Name *base() const;
|
const Name *base() const;
|
||||||
const Name *name() const;
|
const Name *name() const;
|
||||||
|
|
||||||
virtual bool isEqualTo(const Name *other) const;
|
|
||||||
|
|
||||||
virtual const QualifiedNameId *asQualifiedNameId() const
|
virtual const QualifiedNameId *asQualifiedNameId() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
@@ -65,8 +63,6 @@ public:
|
|||||||
|
|
||||||
virtual const Identifier *identifier() const;
|
virtual const Identifier *identifier() const;
|
||||||
|
|
||||||
virtual bool isEqualTo(const Name *other) const;
|
|
||||||
|
|
||||||
virtual const DestructorNameId *asDestructorNameId() const
|
virtual const DestructorNameId *asDestructorNameId() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
@@ -96,8 +92,6 @@ public:
|
|||||||
unsigned templateArgumentCount() const;
|
unsigned templateArgumentCount() const;
|
||||||
const FullySpecifiedType &templateArgumentAt(unsigned index) const;
|
const FullySpecifiedType &templateArgumentAt(unsigned index) const;
|
||||||
|
|
||||||
virtual bool isEqualTo(const Name *other) const;
|
|
||||||
|
|
||||||
virtual const TemplateNameId *asTemplateNameId() const
|
virtual const TemplateNameId *asTemplateNameId() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
@@ -190,7 +184,6 @@ public:
|
|||||||
Kind kind() const;
|
Kind kind() const;
|
||||||
|
|
||||||
virtual const Identifier *identifier() const;
|
virtual const Identifier *identifier() const;
|
||||||
virtual bool isEqualTo(const Name *other) const;
|
|
||||||
|
|
||||||
virtual const OperatorNameId *asOperatorNameId() const
|
virtual const OperatorNameId *asOperatorNameId() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
@@ -212,7 +205,6 @@ public:
|
|||||||
FullySpecifiedType type() const;
|
FullySpecifiedType type() const;
|
||||||
|
|
||||||
virtual const Identifier *identifier() const;
|
virtual const Identifier *identifier() const;
|
||||||
virtual bool isEqualTo(const Name *other) const;
|
|
||||||
|
|
||||||
virtual const ConversionNameId *asConversionNameId() const
|
virtual const ConversionNameId *asConversionNameId() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
@@ -240,8 +232,6 @@ public:
|
|||||||
const Name *nameAt(unsigned index) const;
|
const Name *nameAt(unsigned index) const;
|
||||||
bool hasArguments() const;
|
bool hasArguments() const;
|
||||||
|
|
||||||
virtual bool isEqualTo(const Name *other) const;
|
|
||||||
|
|
||||||
virtual const SelectorNameId *asSelectorNameId() const
|
virtual const SelectorNameId *asSelectorNameId() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
@@ -268,7 +258,6 @@ public:
|
|||||||
unsigned classTokenIndex() const;
|
unsigned classTokenIndex() const;
|
||||||
|
|
||||||
virtual const Identifier *identifier() const;
|
virtual const Identifier *identifier() const;
|
||||||
virtual bool isEqualTo(const Name *other) const;
|
|
||||||
|
|
||||||
virtual const AnonymousNameId *asAnonymousNameId() const
|
virtual const AnonymousNameId *asAnonymousNameId() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|||||||
8
src/libs/3rdparty/cplusplus/Scope.cpp
vendored
8
src/libs/3rdparty/cplusplus/Scope.cpp
vendored
@@ -144,18 +144,18 @@ Symbol *SymbolTable::lookat(const Identifier *id) const
|
|||||||
if (! identity) {
|
if (! identity) {
|
||||||
continue;
|
continue;
|
||||||
} else if (const Identifier *nameId = identity->asNameId()) {
|
} else if (const Identifier *nameId = identity->asNameId()) {
|
||||||
if (nameId->identifier()->isEqualTo(id))
|
if (nameId->identifier()->match(id))
|
||||||
break;
|
break;
|
||||||
} else if (const TemplateNameId *t = identity->asTemplateNameId()) {
|
} else if (const TemplateNameId *t = identity->asTemplateNameId()) {
|
||||||
if (t->identifier()->isEqualTo(id))
|
if (t->identifier()->match(id))
|
||||||
break;
|
break;
|
||||||
} else if (const DestructorNameId *d = identity->asDestructorNameId()) {
|
} else if (const DestructorNameId *d = identity->asDestructorNameId()) {
|
||||||
if (d->identifier()->isEqualTo(id))
|
if (d->identifier()->match(id))
|
||||||
break;
|
break;
|
||||||
} else if (identity->isQualifiedNameId()) {
|
} else if (identity->isQualifiedNameId()) {
|
||||||
return 0;
|
return 0;
|
||||||
} else if (const SelectorNameId *selectorNameId = identity->asSelectorNameId()) {
|
} else if (const SelectorNameId *selectorNameId = identity->asSelectorNameId()) {
|
||||||
if (selectorNameId->identifier()->isEqualTo(id))
|
if (selectorNameId->identifier()->match(id))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
143
src/libs/3rdparty/cplusplus/Symbols.cpp
vendored
143
src/libs/3rdparty/cplusplus/Symbols.cpp
vendored
@@ -245,14 +245,6 @@ bool Function::isSignatureEqualTo(const Function *other, Matcher *matcher) const
|
|||||||
return true;
|
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)
|
void Function::accept0(TypeVisitor *visitor)
|
||||||
{ visitor->visit(this); }
|
{ visitor->visit(this); }
|
||||||
|
|
||||||
@@ -457,20 +449,6 @@ Enum::~Enum()
|
|||||||
FullySpecifiedType Enum::type() const
|
FullySpecifiedType Enum::type() const
|
||||||
{ return FullySpecifiedType(const_cast<Enum *>(this)); }
|
{ return FullySpecifiedType(const_cast<Enum *>(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
|
bool Enum::isScoped() const
|
||||||
{
|
{
|
||||||
return _isScoped;
|
return _isScoped;
|
||||||
@@ -540,9 +518,6 @@ Symbol *Template::declaration() const
|
|||||||
FullySpecifiedType Template::type() const
|
FullySpecifiedType Template::type() const
|
||||||
{ return FullySpecifiedType(const_cast<Template *>(this)); }
|
{ return FullySpecifiedType(const_cast<Template *>(this)); }
|
||||||
|
|
||||||
bool Template::isEqualTo(const Type *other) const
|
|
||||||
{ return other == this; }
|
|
||||||
|
|
||||||
void Template::visitSymbol0(SymbolVisitor *visitor)
|
void Template::visitSymbol0(SymbolVisitor *visitor)
|
||||||
{
|
{
|
||||||
if (visitor->visit(this)) {
|
if (visitor->visit(this)) {
|
||||||
@@ -575,18 +550,6 @@ Namespace::Namespace(Clone *clone, Subst *subst, Namespace *original)
|
|||||||
Namespace::~Namespace()
|
Namespace::~Namespace()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
bool Namespace::isEqualTo(const Type *other) const
|
|
||||||
{
|
|
||||||
const Namespace *o = other->asNamespaceType();
|
|
||||||
if (! o)
|
|
||||||
return false;
|
|
||||||
const Name *l = unqualifiedName();
|
|
||||||
const Name *r = o->unqualifiedName();
|
|
||||||
if (l == r || (l && l->isEqualTo(r)))
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Namespace::accept0(TypeVisitor *visitor)
|
void Namespace::accept0(TypeVisitor *visitor)
|
||||||
{ visitor->visit(this); }
|
{ visitor->visit(this); }
|
||||||
|
|
||||||
@@ -654,19 +617,6 @@ ForwardClassDeclaration::~ForwardClassDeclaration()
|
|||||||
FullySpecifiedType ForwardClassDeclaration::type() const
|
FullySpecifiedType ForwardClassDeclaration::type() const
|
||||||
{ return FullySpecifiedType(const_cast<ForwardClassDeclaration *>(this)); }
|
{ return FullySpecifiedType(const_cast<ForwardClassDeclaration *>(this)); }
|
||||||
|
|
||||||
bool ForwardClassDeclaration::isEqualTo(const Type *other) const
|
|
||||||
{
|
|
||||||
if (const ForwardClassDeclaration *otherClassFwdTy = other->asForwardClassDeclarationType()) {
|
|
||||||
if (name() == otherClassFwdTy->name())
|
|
||||||
return true;
|
|
||||||
else if (name() && otherClassFwdTy->name())
|
|
||||||
return name()->isEqualTo(otherClassFwdTy->name());
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ForwardClassDeclaration::visitSymbol0(SymbolVisitor *visitor)
|
void ForwardClassDeclaration::visitSymbol0(SymbolVisitor *visitor)
|
||||||
{ visitor->visit(this); }
|
{ visitor->visit(this); }
|
||||||
|
|
||||||
@@ -735,19 +685,6 @@ void Class::addBaseClass(BaseClass *baseClass)
|
|||||||
FullySpecifiedType Class::type() const
|
FullySpecifiedType Class::type() const
|
||||||
{ return FullySpecifiedType(const_cast<Class *>(this)); }
|
{ return FullySpecifiedType(const_cast<Class *>(this)); }
|
||||||
|
|
||||||
bool Class::isEqualTo(const Type *other) const
|
|
||||||
{
|
|
||||||
const Class *o = other->asClassType();
|
|
||||||
if (! o)
|
|
||||||
return false;
|
|
||||||
const Name *l = unqualifiedName();
|
|
||||||
const Name *r = o->unqualifiedName();
|
|
||||||
if (l == r || (l && l->isEqualTo(r)))
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Class::visitSymbol0(SymbolVisitor *visitor)
|
void Class::visitSymbol0(SymbolVisitor *visitor)
|
||||||
{
|
{
|
||||||
if (visitor->visit(this)) {
|
if (visitor->visit(this)) {
|
||||||
@@ -898,20 +835,6 @@ void ObjCClass::addProtocol(ObjCBaseProtocol *protocol)
|
|||||||
FullySpecifiedType ObjCClass::type() const
|
FullySpecifiedType ObjCClass::type() const
|
||||||
{ return FullySpecifiedType(const_cast<ObjCClass *>(this)); }
|
{ return FullySpecifiedType(const_cast<ObjCClass *>(this)); }
|
||||||
|
|
||||||
bool ObjCClass::isEqualTo(const Type *other) const
|
|
||||||
{
|
|
||||||
const ObjCClass *o = other->asObjCClassType();
|
|
||||||
if (!o)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
const Name *l = unqualifiedName();
|
|
||||||
const Name *r = o->unqualifiedName();
|
|
||||||
if (l == r || (l && l->isEqualTo(r)))
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ObjCClass::visitSymbol0(SymbolVisitor *visitor)
|
void ObjCClass::visitSymbol0(SymbolVisitor *visitor)
|
||||||
{
|
{
|
||||||
if (visitor->visit(this)) {
|
if (visitor->visit(this)) {
|
||||||
@@ -964,20 +887,6 @@ void ObjCProtocol::addProtocol(ObjCBaseProtocol *protocol)
|
|||||||
FullySpecifiedType ObjCProtocol::type() const
|
FullySpecifiedType ObjCProtocol::type() const
|
||||||
{ return FullySpecifiedType(const_cast<ObjCProtocol *>(this)); }
|
{ return FullySpecifiedType(const_cast<ObjCProtocol *>(this)); }
|
||||||
|
|
||||||
bool ObjCProtocol::isEqualTo(const Type *other) const
|
|
||||||
{
|
|
||||||
const ObjCProtocol *o = other->asObjCProtocolType();
|
|
||||||
if (!o)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
const Name *l = unqualifiedName();
|
|
||||||
const Name *r = o->unqualifiedName();
|
|
||||||
if (l == r || (l && l->isEqualTo(r)))
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ObjCProtocol::visitSymbol0(SymbolVisitor *visitor)
|
void ObjCProtocol::visitSymbol0(SymbolVisitor *visitor)
|
||||||
{
|
{
|
||||||
if (visitor->visit(this)) {
|
if (visitor->visit(this)) {
|
||||||
@@ -1013,20 +922,6 @@ ObjCForwardClassDeclaration::~ObjCForwardClassDeclaration()
|
|||||||
FullySpecifiedType ObjCForwardClassDeclaration::type() const
|
FullySpecifiedType ObjCForwardClassDeclaration::type() const
|
||||||
{ return FullySpecifiedType(); }
|
{ return FullySpecifiedType(); }
|
||||||
|
|
||||||
bool ObjCForwardClassDeclaration::isEqualTo(const Type *other) const
|
|
||||||
{
|
|
||||||
if (const ObjCForwardClassDeclaration *otherFwdClass = other->asObjCForwardClassDeclarationType()) {
|
|
||||||
if (name() == otherFwdClass->name())
|
|
||||||
return true;
|
|
||||||
else if (name() && otherFwdClass->name())
|
|
||||||
return name()->isEqualTo(otherFwdClass->name());
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ObjCForwardClassDeclaration::visitSymbol0(SymbolVisitor *visitor)
|
void ObjCForwardClassDeclaration::visitSymbol0(SymbolVisitor *visitor)
|
||||||
{ visitor->visit(this); }
|
{ visitor->visit(this); }
|
||||||
|
|
||||||
@@ -1057,20 +952,6 @@ ObjCForwardProtocolDeclaration::~ObjCForwardProtocolDeclaration()
|
|||||||
FullySpecifiedType ObjCForwardProtocolDeclaration::type() const
|
FullySpecifiedType ObjCForwardProtocolDeclaration::type() const
|
||||||
{ return FullySpecifiedType(); }
|
{ return FullySpecifiedType(); }
|
||||||
|
|
||||||
bool ObjCForwardProtocolDeclaration::isEqualTo(const Type *other) const
|
|
||||||
{
|
|
||||||
if (const ObjCForwardProtocolDeclaration *otherFwdProtocol = other->asObjCForwardProtocolDeclarationType()) {
|
|
||||||
if (name() == otherFwdProtocol->name())
|
|
||||||
return true;
|
|
||||||
else if (name() && otherFwdProtocol->name())
|
|
||||||
return name()->isEqualTo(otherFwdProtocol->name());
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ObjCForwardProtocolDeclaration::visitSymbol0(SymbolVisitor *visitor)
|
void ObjCForwardProtocolDeclaration::visitSymbol0(SymbolVisitor *visitor)
|
||||||
{ visitor->visit(this); }
|
{ visitor->visit(this); }
|
||||||
|
|
||||||
@@ -1099,30 +980,6 @@ ObjCMethod::ObjCMethod(Clone *clone, Subst *subst, ObjCMethod *original)
|
|||||||
ObjCMethod::~ObjCMethod()
|
ObjCMethod::~ObjCMethod()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
bool ObjCMethod::isEqualTo(const Type *other) const
|
|
||||||
{
|
|
||||||
const ObjCMethod *o = other->asObjCMethodType();
|
|
||||||
if (! o)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
const Name *l = unqualifiedName();
|
|
||||||
const Name *r = o->unqualifiedName();
|
|
||||||
if (l == r || (l && l->isEqualTo(r))) {
|
|
||||||
if (argumentCount() != o->argumentCount())
|
|
||||||
return false;
|
|
||||||
else if (! _returnType.isEqualTo(o->_returnType))
|
|
||||||
return false;
|
|
||||||
for (unsigned i = 0; i < argumentCount(); ++i) {
|
|
||||||
Symbol *l = argumentAt(i);
|
|
||||||
Symbol *r = o->argumentAt(i);
|
|
||||||
if (! l->type().isEqualTo(r->type()))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ObjCMethod::accept0(TypeVisitor *visitor)
|
void ObjCMethod::accept0(TypeVisitor *visitor)
|
||||||
{ visitor->visit(this); }
|
{ visitor->visit(this); }
|
||||||
|
|
||||||
|
|||||||
60
src/libs/3rdparty/cplusplus/Symbols.h
vendored
60
src/libs/3rdparty/cplusplus/Symbols.h
vendored
@@ -232,16 +232,16 @@ public:
|
|||||||
ForwardClassDeclaration(Clone *clone, Subst *subst, ForwardClassDeclaration *original);
|
ForwardClassDeclaration(Clone *clone, Subst *subst, ForwardClassDeclaration *original);
|
||||||
virtual ~ForwardClassDeclaration();
|
virtual ~ForwardClassDeclaration();
|
||||||
|
|
||||||
|
// Symbol's interface
|
||||||
virtual FullySpecifiedType type() const;
|
virtual FullySpecifiedType type() const;
|
||||||
|
|
||||||
virtual bool isEqualTo(const Type *other) const;
|
|
||||||
|
|
||||||
virtual const ForwardClassDeclaration *asForwardClassDeclaration() const
|
virtual const ForwardClassDeclaration *asForwardClassDeclaration() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
virtual ForwardClassDeclaration *asForwardClassDeclaration()
|
virtual ForwardClassDeclaration *asForwardClassDeclaration()
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
|
// Type's interface
|
||||||
virtual const ForwardClassDeclaration *asForwardClassDeclarationType() const
|
virtual const ForwardClassDeclaration *asForwardClassDeclarationType() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
@@ -261,27 +261,25 @@ public:
|
|||||||
Enum(Clone *clone, Subst *subst, Enum *original);
|
Enum(Clone *clone, Subst *subst, Enum *original);
|
||||||
virtual ~Enum();
|
virtual ~Enum();
|
||||||
|
|
||||||
|
bool isScoped() const;
|
||||||
|
void setScoped(bool scoped);
|
||||||
|
|
||||||
// Symbol's interface
|
// Symbol's interface
|
||||||
virtual FullySpecifiedType type() const;
|
virtual FullySpecifiedType type() const;
|
||||||
|
|
||||||
// Type's interface
|
|
||||||
virtual bool isEqualTo(const Type *other) const;
|
|
||||||
|
|
||||||
virtual const Enum *asEnum() const
|
virtual const Enum *asEnum() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
virtual Enum *asEnum()
|
virtual Enum *asEnum()
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
|
// Type's interface
|
||||||
virtual const Enum *asEnumType() const
|
virtual const Enum *asEnumType() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
virtual Enum *asEnumType()
|
virtual Enum *asEnumType()
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
bool isScoped() const;
|
|
||||||
void setScoped(bool scoped);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void visitSymbol0(SymbolVisitor *visitor);
|
virtual void visitSymbol0(SymbolVisitor *visitor);
|
||||||
virtual void accept0(TypeVisitor *visitor);
|
virtual void accept0(TypeVisitor *visitor);
|
||||||
@@ -349,29 +347,27 @@ public:
|
|||||||
|
|
||||||
bool isSignatureEqualTo(const Function *other, Matcher *matcher = 0) const;
|
bool isSignatureEqualTo(const Function *other, Matcher *matcher = 0) const;
|
||||||
|
|
||||||
|
bool isAmbiguous() const; // internal
|
||||||
|
void setAmbiguous(bool isAmbiguous); // internal
|
||||||
|
|
||||||
|
bool maybeValidPrototype(unsigned actualArgumentCount) const;
|
||||||
|
|
||||||
// Symbol's interface
|
// Symbol's interface
|
||||||
virtual FullySpecifiedType type() const;
|
virtual FullySpecifiedType type() const;
|
||||||
|
|
||||||
// Type's interface
|
|
||||||
virtual bool isEqualTo(const Type *other) const;
|
|
||||||
|
|
||||||
virtual const Function *asFunction() const
|
virtual const Function *asFunction() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
virtual Function *asFunction()
|
virtual Function *asFunction()
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
|
// Type's interface
|
||||||
virtual const Function *asFunctionType() const
|
virtual const Function *asFunctionType() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
virtual Function *asFunctionType()
|
virtual Function *asFunctionType()
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
bool isAmbiguous() const; // internal
|
|
||||||
void setAmbiguous(bool isAmbiguous); // internal
|
|
||||||
|
|
||||||
bool maybeValidPrototype(unsigned actualArgumentCount) const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void visitSymbol0(SymbolVisitor *visitor);
|
virtual void visitSymbol0(SymbolVisitor *visitor);
|
||||||
virtual void accept0(TypeVisitor *visitor);
|
virtual void accept0(TypeVisitor *visitor);
|
||||||
@@ -410,15 +406,13 @@ public:
|
|||||||
// Symbol's interface
|
// Symbol's interface
|
||||||
virtual FullySpecifiedType type() const;
|
virtual FullySpecifiedType type() const;
|
||||||
|
|
||||||
// Type's interface
|
|
||||||
virtual bool isEqualTo(const Type *other) const;
|
|
||||||
|
|
||||||
virtual const Template *asTemplate() const
|
virtual const Template *asTemplate() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
virtual Template *asTemplate()
|
virtual Template *asTemplate()
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
|
// Type's interface
|
||||||
virtual const Template *asTemplateType() const
|
virtual const Template *asTemplateType() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
@@ -442,15 +436,13 @@ public:
|
|||||||
// Symbol's interface
|
// Symbol's interface
|
||||||
virtual FullySpecifiedType type() const;
|
virtual FullySpecifiedType type() const;
|
||||||
|
|
||||||
// Type's interface
|
|
||||||
virtual bool isEqualTo(const Type *other) const;
|
|
||||||
|
|
||||||
virtual const Namespace *asNamespace() const
|
virtual const Namespace *asNamespace() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
virtual Namespace *asNamespace()
|
virtual Namespace *asNamespace()
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
|
// Type's interface
|
||||||
virtual const Namespace *asNamespaceType() const
|
virtual const Namespace *asNamespaceType() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
@@ -526,15 +518,13 @@ public:
|
|||||||
// Symbol's interface
|
// Symbol's interface
|
||||||
virtual FullySpecifiedType type() const;
|
virtual FullySpecifiedType type() const;
|
||||||
|
|
||||||
// Type's interface
|
|
||||||
virtual bool isEqualTo(const Type *other) const;
|
|
||||||
|
|
||||||
virtual const Class *asClass() const
|
virtual const Class *asClass() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
virtual Class *asClass()
|
virtual Class *asClass()
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
|
// Type's interface
|
||||||
virtual const Class *asClassType() const
|
virtual const Class *asClassType() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
@@ -667,16 +657,16 @@ public:
|
|||||||
ObjCForwardProtocolDeclaration(Clone *clone, Subst *subst, ObjCForwardProtocolDeclaration *original);
|
ObjCForwardProtocolDeclaration(Clone *clone, Subst *subst, ObjCForwardProtocolDeclaration *original);
|
||||||
virtual ~ObjCForwardProtocolDeclaration();
|
virtual ~ObjCForwardProtocolDeclaration();
|
||||||
|
|
||||||
|
// Symbol's interface
|
||||||
virtual FullySpecifiedType type() const;
|
virtual FullySpecifiedType type() const;
|
||||||
|
|
||||||
virtual bool isEqualTo(const Type *other) const;
|
|
||||||
|
|
||||||
virtual const ObjCForwardProtocolDeclaration *asObjCForwardProtocolDeclaration() const
|
virtual const ObjCForwardProtocolDeclaration *asObjCForwardProtocolDeclaration() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
virtual ObjCForwardProtocolDeclaration *asObjCForwardProtocolDeclaration()
|
virtual ObjCForwardProtocolDeclaration *asObjCForwardProtocolDeclaration()
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
|
// Type's interface
|
||||||
virtual const ObjCForwardProtocolDeclaration *asObjCForwardProtocolDeclarationType() const
|
virtual const ObjCForwardProtocolDeclaration *asObjCForwardProtocolDeclarationType() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
@@ -703,15 +693,13 @@ public:
|
|||||||
// Symbol's interface
|
// Symbol's interface
|
||||||
virtual FullySpecifiedType type() const;
|
virtual FullySpecifiedType type() const;
|
||||||
|
|
||||||
// Type's interface
|
|
||||||
virtual bool isEqualTo(const Type *other) const;
|
|
||||||
|
|
||||||
virtual const ObjCProtocol *asObjCProtocol() const
|
virtual const ObjCProtocol *asObjCProtocol() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
virtual ObjCProtocol *asObjCProtocol()
|
virtual ObjCProtocol *asObjCProtocol()
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
|
// Type's interface
|
||||||
virtual const ObjCProtocol *asObjCProtocolType() const
|
virtual const ObjCProtocol *asObjCProtocolType() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
@@ -734,16 +722,16 @@ public:
|
|||||||
ObjCForwardClassDeclaration(Clone *clone, Subst *subst, ObjCForwardClassDeclaration *original);
|
ObjCForwardClassDeclaration(Clone *clone, Subst *subst, ObjCForwardClassDeclaration *original);
|
||||||
virtual ~ObjCForwardClassDeclaration();
|
virtual ~ObjCForwardClassDeclaration();
|
||||||
|
|
||||||
|
// Symbol's interface
|
||||||
virtual FullySpecifiedType type() const;
|
virtual FullySpecifiedType type() const;
|
||||||
|
|
||||||
virtual bool isEqualTo(const Type *other) const;
|
|
||||||
|
|
||||||
virtual const ObjCForwardClassDeclaration *asObjCForwardClassDeclaration() const
|
virtual const ObjCForwardClassDeclaration *asObjCForwardClassDeclaration() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
virtual ObjCForwardClassDeclaration *asObjCForwardClassDeclaration()
|
virtual ObjCForwardClassDeclaration *asObjCForwardClassDeclaration()
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
|
// Type's interface
|
||||||
virtual const ObjCForwardClassDeclaration *asObjCForwardClassDeclarationType() const
|
virtual const ObjCForwardClassDeclaration *asObjCForwardClassDeclarationType() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
@@ -780,15 +768,13 @@ public:
|
|||||||
// Symbol's interface
|
// Symbol's interface
|
||||||
virtual FullySpecifiedType type() const;
|
virtual FullySpecifiedType type() const;
|
||||||
|
|
||||||
// Type's interface
|
|
||||||
virtual bool isEqualTo(const Type *other) const;
|
|
||||||
|
|
||||||
virtual const ObjCClass *asObjCClass() const
|
virtual const ObjCClass *asObjCClass() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
virtual ObjCClass *asObjCClass()
|
virtual ObjCClass *asObjCClass()
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
|
// Type's interface
|
||||||
virtual const ObjCClass *asObjCClassType() const
|
virtual const ObjCClass *asObjCClassType() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
@@ -832,15 +818,13 @@ public:
|
|||||||
// Symbol's interface
|
// Symbol's interface
|
||||||
virtual FullySpecifiedType type() const;
|
virtual FullySpecifiedType type() const;
|
||||||
|
|
||||||
// Type's interface
|
|
||||||
virtual bool isEqualTo(const Type *other) const;
|
|
||||||
|
|
||||||
virtual const ObjCMethod *asObjCMethod() const
|
virtual const ObjCMethod *asObjCMethod() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
virtual ObjCMethod *asObjCMethod()
|
virtual ObjCMethod *asObjCMethod()
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
|
// Type's interface
|
||||||
virtual const ObjCMethod *asObjCMethodType() const
|
virtual const ObjCMethod *asObjCMethodType() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
|
|
||||||
|
|||||||
4
src/libs/3rdparty/cplusplus/Type.cpp
vendored
4
src/libs/3rdparty/cplusplus/Type.cpp
vendored
@@ -107,7 +107,7 @@ void Type::accept(Type *type, TypeVisitor *visitor)
|
|||||||
type->accept(visitor);
|
type->accept(visitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Type::match(const Type *type, const Type *otherType, Matcher *matcher)
|
bool Type::match(const Type *other, Matcher *matcher) const
|
||||||
{
|
{
|
||||||
return Matcher::match(type, otherType, matcher);
|
return Matcher::match(this, other, matcher);
|
||||||
}
|
}
|
||||||
|
|||||||
6
src/libs/3rdparty/cplusplus/Type.h
vendored
6
src/libs/3rdparty/cplusplus/Type.h
vendored
@@ -97,10 +97,7 @@ public:
|
|||||||
void accept(TypeVisitor *visitor);
|
void accept(TypeVisitor *visitor);
|
||||||
static void accept(Type *type, TypeVisitor *visitor);
|
static void accept(Type *type, TypeVisitor *visitor);
|
||||||
|
|
||||||
static bool match(const Type *type, const Type *otherType, Matcher *matcher);
|
bool match(const Type *other, Matcher *matcher = 0) const;
|
||||||
|
|
||||||
|
|
||||||
virtual bool isEqualTo(const Type *other) const = 0; // ### remove
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void accept0(TypeVisitor *visitor) = 0;
|
virtual void accept0(TypeVisitor *visitor) = 0;
|
||||||
@@ -112,5 +109,4 @@ protected: // for Matcher
|
|||||||
|
|
||||||
} // namespace CPlusPlus
|
} // namespace CPlusPlus
|
||||||
|
|
||||||
|
|
||||||
#endif // CPLUSPLUS_TYPE_H
|
#endif // CPLUSPLUS_TYPE_H
|
||||||
|
|||||||
@@ -368,7 +368,7 @@ FullySpecifiedType SubstitutionMap::apply(const Name *name, Rewrite *) const
|
|||||||
for (int n = _map.size() - 1; n != -1; --n) {
|
for (int n = _map.size() - 1; n != -1; --n) {
|
||||||
const QPair<const Name *, FullySpecifiedType> &p = _map.at(n);
|
const QPair<const Name *, FullySpecifiedType> &p = _map.at(n);
|
||||||
|
|
||||||
if (name->isEqualTo(p.first))
|
if (name->match(p.first))
|
||||||
return p.second;
|
return p.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -371,7 +371,7 @@ int ApplySubstitution::findSubstitution(const Identifier *id) const
|
|||||||
for (int index = 0; index < substitution.size(); ++index) {
|
for (int index = 0; index < substitution.size(); ++index) {
|
||||||
QPair<const Identifier *, FullySpecifiedType> s = substitution.at(index);
|
QPair<const Identifier *, FullySpecifiedType> s = substitution.at(index);
|
||||||
|
|
||||||
if (id->isEqualTo(s.first))
|
if (id->match(s.first))
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ static inline bool compareName(const Name *name, const Name *other)
|
|||||||
const Identifier *id = name->identifier();
|
const Identifier *id = name->identifier();
|
||||||
const Identifier *otherId = other->identifier();
|
const Identifier *otherId = other->identifier();
|
||||||
|
|
||||||
if (id == otherId || (id && id->isEqualTo(otherId)))
|
if (id == otherId || (id && id->match(otherId)))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,7 +255,7 @@ QList<LookupItem> LookupContext::lookupByUsing(const Name *name, Scope *scope) c
|
|||||||
if (const Name *usingDeclarationName = u->name()) {
|
if (const Name *usingDeclarationName = u->name()) {
|
||||||
if (const QualifiedNameId *q = usingDeclarationName->asQualifiedNameId()) {
|
if (const QualifiedNameId *q = usingDeclarationName->asQualifiedNameId()) {
|
||||||
if (q->name() && q->identifier() && name->identifier()
|
if (q->name() && q->identifier() && name->identifier()
|
||||||
&& q->name()->identifier()->isEqualTo(name->identifier())) {
|
&& q->name()->identifier()->match(name->identifier())) {
|
||||||
candidates = bindings()->globalNamespace()->find(q);
|
candidates = bindings()->globalNamespace()->find(q);
|
||||||
|
|
||||||
// if it is not a global scope(scope of scope is not equal 0)
|
// if it is not a global scope(scope of scope is not equal 0)
|
||||||
@@ -312,7 +312,7 @@ ClassOrNamespace *LookupContext::lookupType(const Name *name, Scope *scope,
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
} else if (Declaration *d = m->asDeclaration()) {
|
} else if (Declaration *d = m->asDeclaration()) {
|
||||||
if (d->name() && d->name()->isEqualTo(name->asNameId())) {
|
if (d->name() && d->name()->match(name->asNameId())) {
|
||||||
if (d->isTypedef() && d->type()) {
|
if (d->isTypedef() && d->type()) {
|
||||||
#ifdef DEBUG_LOOKUP
|
#ifdef DEBUG_LOOKUP
|
||||||
Overview oo;
|
Overview oo;
|
||||||
@@ -332,7 +332,7 @@ ClassOrNamespace *LookupContext::lookupType(const Name *name, Scope *scope,
|
|||||||
if (name->isNameId()) {
|
if (name->isNameId()) {
|
||||||
if (const Name *usingDeclarationName = ud->name()) {
|
if (const Name *usingDeclarationName = ud->name()) {
|
||||||
if (const QualifiedNameId *q = usingDeclarationName->asQualifiedNameId()) {
|
if (const QualifiedNameId *q = usingDeclarationName->asQualifiedNameId()) {
|
||||||
if (q->name() && q->name()->isEqualTo(name))
|
if (q->name() && q->name()->match(name))
|
||||||
return bindings()->globalNamespace()->lookupType(q);
|
return bindings()->globalNamespace()->lookupType(q);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -652,7 +652,7 @@ void ClassOrNamespace::lookup_helper(const Name *name, ClassOrNamespace *binding
|
|||||||
if (Scope *scope = s->asScope()) {
|
if (Scope *scope = s->asScope()) {
|
||||||
if (Class *klass = scope->asClass()) {
|
if (Class *klass = scope->asClass()) {
|
||||||
if (const Identifier *id = klass->identifier()) {
|
if (const Identifier *id = klass->identifier()) {
|
||||||
if (nameId && nameId->isEqualTo(id)) {
|
if (nameId && nameId->match(id)) {
|
||||||
LookupItem item;
|
LookupItem item;
|
||||||
item.setDeclaration(klass);
|
item.setDeclaration(klass);
|
||||||
item.setBinding(binding);
|
item.setBinding(binding);
|
||||||
@@ -695,7 +695,7 @@ void CreateBindings::lookupInScope(const Name *name, Scope *scope,
|
|||||||
continue;
|
continue;
|
||||||
else if (s->isFriend())
|
else if (s->isFriend())
|
||||||
continue;
|
continue;
|
||||||
else if (! s->name()->isEqualTo(op))
|
else if (! s->name()->match(op))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
LookupItem item;
|
LookupItem item;
|
||||||
@@ -710,7 +710,7 @@ void CreateBindings::lookupInScope(const Name *name, Scope *scope,
|
|||||||
continue; // skip friends
|
continue; // skip friends
|
||||||
else if (s->isUsingNamespaceDirective())
|
else if (s->isUsingNamespaceDirective())
|
||||||
continue; // skip using namespace directives
|
continue; // skip using namespace directives
|
||||||
else if (! id->isEqualTo(s->identifier()))
|
else if (! id->match(s->identifier()))
|
||||||
continue;
|
continue;
|
||||||
else if (s->name()->isQualifiedNameId())
|
else if (s->name()->isQualifiedNameId())
|
||||||
continue; // skip qualified ids.
|
continue; // skip qualified ids.
|
||||||
@@ -857,12 +857,12 @@ ClassOrNamespace *ClassOrNamespace::lookupType_helper(const Name *name,
|
|||||||
|
|
||||||
foreach (Symbol *s, symbols()) {
|
foreach (Symbol *s, symbols()) {
|
||||||
if (Class *klass = s->asClass()) {
|
if (Class *klass = s->asClass()) {
|
||||||
if (klass->identifier() && klass->identifier()->isEqualTo(name->identifier()))
|
if (klass->identifier() && klass->identifier()->match(name->identifier()))
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach (Enum *e, unscopedEnums()) {
|
foreach (Enum *e, unscopedEnums()) {
|
||||||
if (e->identifier() && e->identifier()->isEqualTo(name->identifier()))
|
if (e->identifier() && e->identifier()->match(name->identifier()))
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -643,9 +643,9 @@ bool ResolveExpression::maybeValidPrototype(Function *funTy, unsigned actualArgu
|
|||||||
|
|
||||||
bool ResolveExpression::implicitConversion(const FullySpecifiedType &sourceTy, const FullySpecifiedType &targetTy) const
|
bool ResolveExpression::implicitConversion(const FullySpecifiedType &sourceTy, const FullySpecifiedType &targetTy) const
|
||||||
{
|
{
|
||||||
if (sourceTy.isEqualTo(targetTy))
|
if (sourceTy.match(targetTy))
|
||||||
return true;
|
return true;
|
||||||
else if (sourceTy.simplified().isEqualTo(targetTy.simplified()))
|
else if (sourceTy.simplified().match(targetTy.simplified()))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -963,7 +963,7 @@ private:
|
|||||||
{
|
{
|
||||||
if (declaration->isTypedef()) {
|
if (declaration->isTypedef()) {
|
||||||
const Identifier *identifier = declaration->name()->identifier();
|
const Identifier *identifier = declaration->name()->identifier();
|
||||||
if (name->identifier()->isEqualTo(identifier))
|
if (name->identifier()->match(identifier))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ protected:
|
|||||||
if (const QualifiedNameId *q = name->asQualifiedNameId())
|
if (const QualifiedNameId *q = name->asQualifiedNameId())
|
||||||
name = q->name();
|
name = q->name();
|
||||||
|
|
||||||
if (_declarationName->isEqualTo(name))
|
if (_declarationName->match(name))
|
||||||
_functions->append(function);
|
_functions->append(function);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -242,7 +242,7 @@ struct CanonicalSymbol
|
|||||||
const Identifier *declId = decl->identifier();
|
const Identifier *declId = decl->identifier();
|
||||||
const Identifier *classId = classScope->identifier();
|
const Identifier *classId = classScope->identifier();
|
||||||
|
|
||||||
if (classId && classId->isEqualTo(declId))
|
if (classId && classId->match(declId))
|
||||||
continue; // skip it, it's a ctor or a dtor.
|
continue; // skip it, it's a ctor or a dtor.
|
||||||
|
|
||||||
if (Function *funTy = r.declaration()->type()->asFunctionType()) {
|
if (Function *funTy = r.declaration()->type()->asFunctionType()) {
|
||||||
@@ -1164,7 +1164,7 @@ void CPPEditorWidget::switchDeclarationDefinition(bool inNextSplit)
|
|||||||
foreach (const LookupItem &r, declarations) {
|
foreach (const LookupItem &r, declarations) {
|
||||||
if (Symbol *decl = r.declaration()) {
|
if (Symbol *decl = r.declaration()) {
|
||||||
if (Function *funTy = decl->type()->asFunctionType()) {
|
if (Function *funTy = decl->type()->asFunctionType()) {
|
||||||
if (funTy->isEqualTo(functionDefinitionSymbol)) {
|
if (funTy->match(functionDefinitionSymbol)) {
|
||||||
if (decl != functionDefinitionSymbol && binding == r.binding())
|
if (decl != functionDefinitionSymbol && binding == r.binding())
|
||||||
best.prepend(decl);
|
best.prepend(decl);
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ void CppElementEvaluator::handleLookupItemMatch(const Snapshot &snapshot,
|
|||||||
const QString &type = Overview().prettyType(lookupItem.type(), QString());
|
const QString &type = Overview().prettyType(lookupItem.type(), QString());
|
||||||
// special case for bug QTCREATORBUG-4780
|
// special case for bug QTCREATORBUG-4780
|
||||||
if (scope && scope->isFunction()
|
if (scope && scope->isFunction()
|
||||||
&& lookupItem.type().isEqualTo(scope->asFunction()->returnType())) {
|
&& lookupItem.type().match(scope->asFunction()->returnType())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_element = QSharedPointer<CppElement>(new Unknown(type));
|
m_element = QSharedPointer<CppElement>(new Unknown(type));
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ bool FunctionDeclDefLink::isMarkerVisible() const
|
|||||||
|
|
||||||
static bool namesEqual(const Name *n1, const Name *n2)
|
static bool namesEqual(const Name *n1, const Name *n2)
|
||||||
{
|
{
|
||||||
return n1 == n2 || (n1 && n2 && n1->isEqualTo(n2));
|
return n1 == n2 || (n1 && n2 && n1->match(n2));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FunctionDeclDefLink::apply(CPPEditorWidget *editor, bool jumpToMatch)
|
void FunctionDeclDefLink::apply(CPPEditorWidget *editor, bool jumpToMatch)
|
||||||
@@ -487,7 +487,7 @@ static int findUniqueTypeMatch(int sourceParamIndex, Function *sourceFunction, F
|
|||||||
int otherSourceParamIndex = sourceParams.at(i);
|
int otherSourceParamIndex = sourceParams.at(i);
|
||||||
if (sourceParamIndex == otherSourceParamIndex)
|
if (sourceParamIndex == otherSourceParamIndex)
|
||||||
continue;
|
continue;
|
||||||
if (sourceParam->type().isEqualTo(sourceFunction->argumentAt(otherSourceParamIndex)->type()))
|
if (sourceParam->type().match(sourceFunction->argumentAt(otherSourceParamIndex)->type()))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -496,7 +496,7 @@ static int findUniqueTypeMatch(int sourceParamIndex, Function *sourceFunction, F
|
|||||||
int newParamWithSameTypeIndex = -1;
|
int newParamWithSameTypeIndex = -1;
|
||||||
for (int i = 0; i < newParams.size(); ++i) {
|
for (int i = 0; i < newParams.size(); ++i) {
|
||||||
int newParamIndex = newParams.at(i);
|
int newParamIndex = newParams.at(i);
|
||||||
if (sourceParam->type().isEqualTo(newFunction->argumentAt(newParamIndex)->type())) {
|
if (sourceParam->type().match(newFunction->argumentAt(newParamIndex)->type())) {
|
||||||
if (newParamWithSameTypeIndex != -1)
|
if (newParamWithSameTypeIndex != -1)
|
||||||
return -1;
|
return -1;
|
||||||
newParamWithSameTypeIndex = newParamIndex;
|
newParamWithSameTypeIndex = newParamIndex;
|
||||||
@@ -635,8 +635,8 @@ Utils::ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targ
|
|||||||
else
|
else
|
||||||
returnTypeStart = targetFile->startOf(declarator);
|
returnTypeStart = targetFile->startOf(declarator);
|
||||||
|
|
||||||
if (!newFunction->returnType().isEqualTo(sourceFunction->returnType())
|
if (!newFunction->returnType().match(sourceFunction->returnType())
|
||||||
&& !newFunction->returnType().isEqualTo(targetFunction->returnType())) {
|
&& !newFunction->returnType().match(targetFunction->returnType())) {
|
||||||
FullySpecifiedType type = rewriteType(newFunction->returnType(), &env, control);
|
FullySpecifiedType type = rewriteType(newFunction->returnType(), &env, control);
|
||||||
const QString replacement = overview.prettyType(type, targetFunction->name());
|
const QString replacement = overview.prettyType(type, targetFunction->name());
|
||||||
changes.replace(returnTypeStart,
|
changes.replace(returnTypeStart,
|
||||||
@@ -811,8 +811,8 @@ Utils::ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targ
|
|||||||
renamedTargetParameters[targetParam] = overview.prettyName(replacementName);
|
renamedTargetParameters[targetParam] = overview.prettyName(replacementName);
|
||||||
|
|
||||||
// need to change the type (and name)?
|
// need to change the type (and name)?
|
||||||
if (!newParam->type().isEqualTo(sourceParam->type())
|
if (!newParam->type().match(sourceParam->type())
|
||||||
&& !newParam->type().isEqualTo(targetParam->type())) {
|
&& !newParam->type().match(targetParam->type())) {
|
||||||
const int parameterTypeStart = targetFile->startOf(targetParamAst);
|
const int parameterTypeStart = targetFile->startOf(targetParamAst);
|
||||||
int parameterTypeEnd = 0;
|
int parameterTypeEnd = 0;
|
||||||
if (targetParamAst->declarator)
|
if (targetParamAst->declarator)
|
||||||
|
|||||||
@@ -545,10 +545,10 @@ public:
|
|||||||
for (Symbol *symbol = m_classAST->symbol->find(funcName->identifier());
|
for (Symbol *symbol = m_classAST->symbol->find(funcName->identifier());
|
||||||
symbol; symbol = symbol->next()) {
|
symbol; symbol = symbol->next()) {
|
||||||
if (!symbol->name()
|
if (!symbol->name()
|
||||||
|| !funcName->identifier()->isEqualTo(symbol->identifier())) {
|
|| !funcName->identifier()->match(symbol->identifier())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (symbol->type().isEqualTo(func->type())) {
|
if (symbol->type().match(func->type())) {
|
||||||
funcExistsInClass = true;
|
funcExistsInClass = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2294,7 +2294,7 @@ Enum *findEnum(const QList<LookupItem> &results, const LookupContext &ctxt)
|
|||||||
const Name *referenceName = namedType->name();
|
const Name *referenceName = namedType->name();
|
||||||
foreach (Enum *e, enums) {
|
foreach (Enum *e, enums) {
|
||||||
if (const Name *candidateName = e->name()) {
|
if (const Name *candidateName = e->name()) {
|
||||||
if (candidateName->isEqualTo(referenceName))
|
if (candidateName->match(referenceName))
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2485,11 +2485,11 @@ void InsertDeclFromDef::match(const CppQuickFixInterface &interface, QuickFixOpe
|
|||||||
const QualifiedNameId *qName = fun->name()->asQualifiedNameId();
|
const QualifiedNameId *qName = fun->name()->asQualifiedNameId();
|
||||||
for (Symbol *s = matchingClass->find(qName->identifier()); s; s = s->next()) {
|
for (Symbol *s = matchingClass->find(qName->identifier()); s; s = s->next()) {
|
||||||
if (!s->name()
|
if (!s->name()
|
||||||
|| !qName->identifier()->isEqualTo(s->identifier())
|
|| !qName->identifier()->match(s->identifier())
|
||||||
|| !s->type()->isFunctionType())
|
|| !s->type()->isFunctionType())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (s->type().isEqualTo(fun->type())) {
|
if (s->type().match(fun->type())) {
|
||||||
// Declaration exists.
|
// Declaration exists.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -3671,9 +3671,9 @@ public:
|
|||||||
const QualifiedNameId *qName = func->name()->asQualifiedNameId();
|
const QualifiedNameId *qName = func->name()->asQualifiedNameId();
|
||||||
for (Symbol *s = matchingClass->find(qName->identifier()); s; s = s->next()) {
|
for (Symbol *s = matchingClass->find(qName->identifier()); s; s = s->next()) {
|
||||||
if (!s->name()
|
if (!s->name()
|
||||||
|| !qName->identifier()->isEqualTo(s->identifier())
|
|| !qName->identifier()->match(s->identifier())
|
||||||
|| !s->type()->isFunctionType()
|
|| !s->type()->isFunctionType()
|
||||||
|| !s->type().isEqualTo(func->type())
|
|| !s->type().match(func->type())
|
||||||
|| s->isFunction()) {
|
|| s->isFunction()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -4391,9 +4391,9 @@ void MoveFuncDefToDecl::match(const CppQuickFixInterface &interface, QuickFixOpe
|
|||||||
const QualifiedNameId *qName = func->name()->asQualifiedNameId();
|
const QualifiedNameId *qName = func->name()->asQualifiedNameId();
|
||||||
for (Symbol *s = matchingClass->find(qName->identifier()); s; s = s->next()) {
|
for (Symbol *s = matchingClass->find(qName->identifier()); s; s = s->next()) {
|
||||||
if (!s->name()
|
if (!s->name()
|
||||||
|| !qName->identifier()->isEqualTo(s->identifier())
|
|| !qName->identifier()->match(s->identifier())
|
||||||
|| !s->type()->isFunctionType()
|
|| !s->type()->isFunctionType()
|
||||||
|| !s->type().isEqualTo(func->type())
|
|| !s->type().match(func->type())
|
||||||
|| s->isFunction()) {
|
|| s->isFunction()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -744,7 +744,7 @@ bool CheckSymbols::hasVirtualDestructor(Class *klass) const
|
|||||||
continue;
|
continue;
|
||||||
if (s->name()->isDestructorNameId()) {
|
if (s->name()->isDestructorNameId()) {
|
||||||
if (Function *funTy = s->type()->asFunctionType()) {
|
if (Function *funTy = s->type()->asFunctionType()) {
|
||||||
if (funTy->isVirtual() && id->isEqualTo(s->identifier()))
|
if (funTy->isVirtual() && id->match(s->identifier()))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1419,7 +1419,7 @@ bool CheckSymbols::isConstructorDeclaration(Symbol *declaration)
|
|||||||
{
|
{
|
||||||
Class *clazz = declaration->enclosingClass();
|
Class *clazz = declaration->enclosingClass();
|
||||||
if (clazz && clazz->name())
|
if (clazz && clazz->name())
|
||||||
return declaration->name()->isEqualTo(clazz->name());
|
return declaration->name()->match(clazz->name());
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -593,7 +593,7 @@ bool isQPrivateSignal(const Symbol *symbol)
|
|||||||
if (FullySpecifiedType type = symbol->type()) {
|
if (FullySpecifiedType type = symbol->type()) {
|
||||||
if (NamedType *namedType = type->asNamedType()) {
|
if (NamedType *namedType = type->asNamedType()) {
|
||||||
if (const Name *name = namedType->name()) {
|
if (const Name *name = namedType->name()) {
|
||||||
if (name->isEqualTo(&qPrivateSignalIdentifier))
|
if (name->match(&qPrivateSignalIdentifier))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1785,7 +1785,7 @@ bool CppCompletionAssistProcessor::completeConstructorOrFunction(const QList<CPl
|
|||||||
continue; // skip
|
continue; // skip
|
||||||
|
|
||||||
if (Function *funTy = member->type()->asFunctionType()) {
|
if (Function *funTy = member->type()->asFunctionType()) {
|
||||||
if (memberName->isEqualTo(className)) {
|
if (memberName->match(className)) {
|
||||||
// it's a ctor.
|
// it's a ctor.
|
||||||
functions.append(funTy);
|
functions.append(funTy);
|
||||||
}
|
}
|
||||||
@@ -1813,7 +1813,7 @@ bool CppCompletionAssistProcessor::completeConstructorOrFunction(const QList<CPl
|
|||||||
bool newOverload = true;
|
bool newOverload = true;
|
||||||
|
|
||||||
foreach (Function *f, functions) {
|
foreach (Function *f, functions) {
|
||||||
if (fun->isEqualTo(f)) {
|
if (fun->match(f)) {
|
||||||
newOverload = false;
|
newOverload = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ QList<Function *> FunctionUtils::overrides(Function *function, Class *functionsC
|
|||||||
Function *candidateFunc = candidate->type()->asFunctionType();
|
Function *candidateFunc = candidate->type()->asFunctionType();
|
||||||
if (!candidateName || !candidateFunc)
|
if (!candidateName || !candidateFunc)
|
||||||
continue;
|
continue;
|
||||||
if (candidateName->isEqualTo(referenceName)
|
if (candidateName->match(referenceName)
|
||||||
&& candidateFunc->isSignatureEqualTo(function)) {
|
&& candidateFunc->isSignatureEqualTo(function)) {
|
||||||
result << candidateFunc;
|
result << candidateFunc;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ protected:
|
|||||||
{
|
{
|
||||||
if (!ast->lbrace_token || !ast->rbrace_token)
|
if (!ast->lbrace_token || !ast->rbrace_token)
|
||||||
return true;
|
return true;
|
||||||
if (!ast->symbol || !ast->symbol->isEqualTo(_clazz))
|
if (!ast->symbol || !ast->symbol->match(_clazz))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
QList<AccessRange> ranges = collectAccessRanges(
|
QList<AccessRange> ranges = collectAccessRanges(
|
||||||
|
|||||||
@@ -70,11 +70,11 @@ public:
|
|||||||
{
|
{
|
||||||
if (_oper) {
|
if (_oper) {
|
||||||
if (const Name *name = fun->unqualifiedName()) {
|
if (const Name *name = fun->unqualifiedName()) {
|
||||||
if (_oper->isEqualTo(name))
|
if (_oper->match(name))
|
||||||
_result.append(fun);
|
_result.append(fun);
|
||||||
}
|
}
|
||||||
} else if (Function *decl = _declaration->type()->asFunctionType()) {
|
} else if (Function *decl = _declaration->type()->asFunctionType()) {
|
||||||
if (fun->isEqualTo(decl))
|
if (fun->match(decl))
|
||||||
_result.append(fun);
|
_result.append(fun);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@ Function *SymbolFinder::findMatchingDefinition(Symbol *declaration,
|
|||||||
|
|
||||||
foreach (Function *fun, viableFunctions) {
|
foreach (Function *fun, viableFunctions) {
|
||||||
if (!(fun->unqualifiedName()
|
if (!(fun->unqualifiedName()
|
||||||
&& fun->unqualifiedName()->isEqualTo(declaration->unqualifiedName()))) {
|
&& fun->unqualifiedName()->match(declaration->unqualifiedName()))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (fun->argumentCount() == declarationTy->argumentCount()) {
|
if (fun->argumentCount() == declarationTy->argumentCount()) {
|
||||||
@@ -187,7 +187,7 @@ Function *SymbolFinder::findMatchingDefinition(Symbol *declaration,
|
|||||||
for (; argIt < argc; ++argIt) {
|
for (; argIt < argc; ++argIt) {
|
||||||
Symbol *arg = fun->argumentAt(argIt);
|
Symbol *arg = fun->argumentAt(argIt);
|
||||||
Symbol *otherArg = declarationTy->argumentAt(argIt);
|
Symbol *otherArg = declarationTy->argumentAt(argIt);
|
||||||
if (!arg->type().isEqualTo(otherArg->type()))
|
if (!arg->type().match(otherArg->type()))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,7 +252,7 @@ static void findDeclarationOfSymbol(Symbol *s,
|
|||||||
{
|
{
|
||||||
if (Declaration *decl = s->asDeclaration()) {
|
if (Declaration *decl = s->asDeclaration()) {
|
||||||
if (Function *declFunTy = decl->type()->asFunctionType()) {
|
if (Function *declFunTy = decl->type()->asFunctionType()) {
|
||||||
if (functionType->isEqualTo(declFunTy))
|
if (functionType->match(declFunTy))
|
||||||
typeMatch->prepend(decl);
|
typeMatch->prepend(decl);
|
||||||
else if (functionType->argumentCount() == declFunTy->argumentCount())
|
else if (functionType->argumentCount() == declFunTy->argumentCount())
|
||||||
argumentCountMatch->prepend(decl);
|
argumentCountMatch->prepend(decl);
|
||||||
@@ -316,7 +316,7 @@ void SymbolFinder::findMatchingDeclaration(const LookupContext &context,
|
|||||||
|
|
||||||
if (funcId) {
|
if (funcId) {
|
||||||
for (Symbol *s = scope->find(funcId); s; s = s->next()) {
|
for (Symbol *s = scope->find(funcId); s; s = s->next()) {
|
||||||
if (!s->name() || !funcId->isEqualTo(s->identifier()) || !s->type()->isFunctionType())
|
if (!s->name() || !funcId->match(s->identifier()) || !s->type()->isFunctionType())
|
||||||
continue;
|
continue;
|
||||||
findDeclarationOfSymbol(s, functionType, typeMatch, argumentCountMatch, nameMatch);
|
findDeclarationOfSymbol(s, functionType, typeMatch, argumentCountMatch, nameMatch);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user