diff options
Diffstat (limited to 'src/libs/3rdparty/cplusplus/Names.cpp')
-rw-r--r-- | src/libs/3rdparty/cplusplus/Names.cpp | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/src/libs/3rdparty/cplusplus/Names.cpp b/src/libs/3rdparty/cplusplus/Names.cpp index 7f26ea1ad6..c0c2fe0d21 100644 --- a/src/libs/3rdparty/cplusplus/Names.cpp +++ b/src/libs/3rdparty/cplusplus/Names.cpp @@ -19,6 +19,7 @@ // THE SOFTWARE. #include "Names.h" +#include "Matcher.h" #include "NameVisitor.h" #include "Literals.h" #include <algorithm> @@ -32,6 +33,13 @@ QualifiedNameId::~QualifiedNameId() void QualifiedNameId::accept0(NameVisitor *visitor) const { visitor->visit(this); } +bool QualifiedNameId::match0(const Name *otherName, Matcher *matcher) const +{ + if (const QualifiedNameId *name = otherName->asQualifiedNameId()) + return matcher->match(this, name); + return false; +} + const Identifier *QualifiedNameId::identifier() const { if (const Name *u = name()) @@ -71,6 +79,13 @@ DestructorNameId::~DestructorNameId() void DestructorNameId::accept0(NameVisitor *visitor) const { visitor->visit(this); } +bool DestructorNameId::match0(const Name *otherName, Matcher *matcher) const +{ + if (const DestructorNameId *name = otherName->asDestructorNameId()) + return matcher->match(this, name); + return false; +} + const Name *DestructorNameId::name() const { return _name; } @@ -96,6 +111,13 @@ TemplateNameId::~TemplateNameId() void TemplateNameId::accept0(NameVisitor *visitor) const { visitor->visit(this); } +bool TemplateNameId::match0(const Name *otherName, Matcher *matcher) const +{ + if (const TemplateNameId *other = otherName->asTemplateNameId()) + return matcher->match(this, other); + return false; +} + const Identifier *TemplateNameId::identifier() const { return _identifier; } @@ -117,7 +139,7 @@ bool TemplateNameId::isEqualTo(const Name *other) const return false; if (templateArgumentCount() != t->templateArgumentCount()) return false; - for (unsigned i = 0; i < templateArgumentCount(); ++i) { + for (unsigned i = 0, ei = templateArgumentCount(); i != ei; ++i) { const FullySpecifiedType &l = _templateArguments[i]; const FullySpecifiedType &r = t->_templateArguments[i]; if (! l.isEqualTo(r)) @@ -171,6 +193,13 @@ OperatorNameId::~OperatorNameId() void OperatorNameId::accept0(NameVisitor *visitor) const { visitor->visit(this); } +bool OperatorNameId::match0(const Name *otherName, Matcher *matcher) const +{ + if (const OperatorNameId *name = otherName->asOperatorNameId()) + return matcher->match(this, name); + return false; +} + OperatorNameId::Kind OperatorNameId::kind() const { return _kind; } @@ -198,6 +227,13 @@ ConversionNameId::~ConversionNameId() void ConversionNameId::accept0(NameVisitor *visitor) const { visitor->visit(this); } +bool ConversionNameId::match0(const Name *otherName, Matcher *matcher) const +{ + if (const ConversionNameId *name = otherName->asConversionNameId()) + return matcher->match(this, name); + return false; +} + FullySpecifiedType ConversionNameId::type() const { return _type; } @@ -221,6 +257,13 @@ SelectorNameId::~SelectorNameId() void SelectorNameId::accept0(NameVisitor *visitor) const { visitor->visit(this); } +bool SelectorNameId::match0(const Name *otherName, Matcher *matcher) const +{ + if (const SelectorNameId *name = otherName->asSelectorNameId()) + return matcher->match(this, name); + return false; +} + const Identifier *SelectorNameId::identifier() const { if (_names.empty()) @@ -276,6 +319,13 @@ unsigned AnonymousNameId::classTokenIndex() const void AnonymousNameId::accept0(NameVisitor *visitor) const { visitor->visit(this); } +bool AnonymousNameId::match0(const Name *otherName, Matcher *matcher) const +{ + if (const AnonymousNameId *id = otherName->asAnonymousNameId()) + return matcher->match(this, id); + return false; +} + const Identifier *AnonymousNameId::identifier() const { return 0; } |