From adfdb51660f3d4251101283efa46b6617cbe43d4 Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Mon, 12 Jul 2010 13:41:54 +0200 Subject: Recursive definition of CPlusPlus::QualifiedNameId. Done-with: Erik Verbruggen --- src/shared/cplusplus/Control.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'src/shared/cplusplus/Control.cpp') diff --git a/src/shared/cplusplus/Control.cpp b/src/shared/cplusplus/Control.cpp index 93f77e3aae..15b2c51787 100644 --- a/src/shared/cplusplus/Control.cpp +++ b/src/shared/cplusplus/Control.cpp @@ -177,11 +177,10 @@ template <> struct Compare { bool operator()(const QualifiedNameId &name, const QualifiedNameId &otherName) const { - if (name.isGlobal() == otherName.isGlobal()) - return std::lexicographical_compare(name.firstName(), name.lastName(), - otherName.firstName(), otherName.lastName()); + if (name.base() == otherName.base()) + return name.name() < otherName.name(); - return name.isGlobal() < otherName.isGlobal(); + return name.base() < otherName.base(); } }; @@ -285,10 +284,9 @@ public: return conversionNameIds.intern(ConversionNameId(type)); } - template - const QualifiedNameId *findOrInsertQualifiedNameId(_Iterator first, _Iterator last, bool isGlobal) + const QualifiedNameId *findOrInsertQualifiedNameId(const Name *base, const Name *name) { - return qualifiedNameIds.intern(QualifiedNameId(first, last, isGlobal)); + return qualifiedNameIds.intern(QualifiedNameId(base, name)); } template @@ -641,11 +639,9 @@ const OperatorNameId *Control::operatorNameId(int kind) const ConversionNameId *Control::conversionNameId(const FullySpecifiedType &type) { return d->findOrInsertConversionNameId(type); } -const QualifiedNameId *Control::qualifiedNameId(const Name *const *names, - unsigned nameCount, - bool isGlobal) +const QualifiedNameId *Control::qualifiedNameId(const Name *base, const Name *name) { - return d->findOrInsertQualifiedNameId(names, names + nameCount, isGlobal); + return d->findOrInsertQualifiedNameId(base, name); } const SelectorNameId *Control::selectorNameId(const Name *const *names, -- cgit v1.2.1