diff options
author | Przemyslaw Gorszkowski <pgorszkowski@gmail.com> | 2013-01-12 22:05:41 +0100 |
---|---|---|
committer | Przemyslaw Gorszkowski <pgorszkowski@gmail.com> | 2013-01-30 18:49:25 +0100 |
commit | ffba28d26ab6aaf9a953f42d5fa15c55a85c75a7 (patch) | |
tree | 010c0eb03d5caf768b3206ee7b69fe68b93a333c /src/libs/3rdparty/cplusplus/Control.cpp | |
parent | 0135609973b8c8f9b380aefb618659f698c5c2c5 (diff) |
C++: Fix code compl. for instantiation of template specialization
It works for full specialization. Instantiate of the partial
specialization has to be implemented(finding appropriate partial
specialization-on going)
Added unit test.
Change-Id: I8ef5ea963e7c665e0d67d390b3a833486773dab0
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Diffstat (limited to 'src/libs/3rdparty/cplusplus/Control.cpp')
-rw-r--r-- | src/libs/3rdparty/cplusplus/Control.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/libs/3rdparty/cplusplus/Control.cpp b/src/libs/3rdparty/cplusplus/Control.cpp index ba709de052..8f6136534f 100644 --- a/src/libs/3rdparty/cplusplus/Control.cpp +++ b/src/libs/3rdparty/cplusplus/Control.cpp @@ -131,9 +131,18 @@ template <> struct Compare<TemplateNameId> const Identifier *id = name.identifier(); const Identifier *otherId = otherName.identifier(); - if (id == otherId) - return std::lexicographical_compare(name.firstTemplateArgument(), name.lastTemplateArgument(), - otherName.firstTemplateArgument(), otherName.lastTemplateArgument()); + if (id == otherId) { + // we have to differentiate TemplateNameId with respect to specialization or + // instantiation + if (name.isSpecialization() == otherName.isSpecialization()) { + return std::lexicographical_compare(name.firstTemplateArgument(), + name.lastTemplateArgument(), + otherName.firstTemplateArgument(), + otherName.lastTemplateArgument()); + } else { + return name.isSpecialization(); + } + } return id < otherId; } @@ -211,9 +220,10 @@ public: } template <typename _Iterator> - const TemplateNameId *findOrInsertTemplateNameId(const Identifier *id, _Iterator first, _Iterator last) + const TemplateNameId *findOrInsertTemplateNameId(const Identifier *id, bool isSpecialization, + _Iterator first, _Iterator last) { - return templateNameIds.intern(TemplateNameId(id, first, last)); + return templateNameIds.intern(TemplateNameId(id, isSpecialization, first, last)); } const DestructorNameId *findOrInsertDestructorNameId(const Name *name) @@ -598,10 +608,11 @@ const NumericLiteral *Control::numericLiteral(const char *chars) } const TemplateNameId *Control::templateNameId(const Identifier *id, + bool isSpecialization, const FullySpecifiedType *const args, unsigned argv) { - return d->findOrInsertTemplateNameId(id, args, args + argv); + return d->findOrInsertTemplateNameId(id, isSpecialization, args, args + argv); } const DestructorNameId *Control::destructorNameId(const Name *name) |