forked from qt-creator/qt-creator
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>
This commit is contained in:
23
src/libs/3rdparty/cplusplus/Control.cpp
vendored
23
src/libs/3rdparty/cplusplus/Control.cpp
vendored
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user