summaryrefslogtreecommitdiff
path: root/src/libs/3rdparty/cplusplus/Names.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/3rdparty/cplusplus/Names.cpp')
-rw-r--r--src/libs/3rdparty/cplusplus/Names.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/libs/3rdparty/cplusplus/Names.cpp b/src/libs/3rdparty/cplusplus/Names.cpp
index 9024b65a91..4c5cb7db79 100644
--- a/src/libs/3rdparty/cplusplus/Names.cpp
+++ b/src/libs/3rdparty/cplusplus/Names.cpp
@@ -128,6 +128,27 @@ bool TemplateNameId::isEqualTo(const Name *other) const
return true;
}
+bool TemplateNameId::Compare::operator()(const TemplateNameId *name,
+ const TemplateNameId *other) const
+{
+ const Identifier *id = name->identifier();
+ const Identifier *otherId = other->identifier();
+
+ if (id == otherId) {
+ // we have to differentiate TemplateNameId with respect to specialization or instantiation
+ if (name->isSpecialization() == other->isSpecialization()) {
+ return std::lexicographical_compare(name->firstTemplateArgument(),
+ name->lastTemplateArgument(),
+ other->firstTemplateArgument(),
+ other->lastTemplateArgument());
+ } else {
+ return name->isSpecialization();
+ }
+ }
+
+ return id < otherId;
+}
+
OperatorNameId::OperatorNameId(Kind kind)
: _kind(kind)
{ }