QualType getTemplateSpecializationType(TemplateName T,
const TemplateArgument *Args,
unsigned NumArgs,
- QualType Canon = QualType(),
- bool IsCurrentInstantiation = false);
+ QualType Canon = QualType());
QualType getTemplateSpecializationType(TemplateName T,
const TemplateArgumentListInfo &Args,
- QualType Canon = QualType(),
- bool IsCurrentInstantiation = false);
+ QualType Canon = QualType());
TypeSourceInfo *
getTemplateSpecializationTypeInfo(TemplateName T, SourceLocation TLoc,
/// dependent.
class TemplateSpecializationType
: public Type, public llvm::FoldingSetNode {
-
- // The bool is whether this is a current instantiation.
- bool IsCurrentInstantiation;
-
/// \brief The name of the template being specialized.
TemplateName Template;
unsigned NumArgs;
TemplateSpecializationType(TemplateName T,
- bool IsCurrentInstantiation,
const TemplateArgument *Args,
unsigned NumArgs, QualType Canon);
/// True if this template specialization type matches a current
/// instantiation in the context in which it is found.
bool isCurrentInstantiation() const {
- return IsCurrentInstantiation;
+ return isa<InjectedClassNameType>(getCanonicalTypeInternal());
}
typedef const TemplateArgument * iterator;
QualType desugar() const { return getCanonicalTypeInternal(); }
void Profile(llvm::FoldingSetNodeID &ID, ASTContext &Ctx) {
- Profile(ID, Template, isCurrentInstantiation(), getArgs(), NumArgs, Ctx);
+ Profile(ID, Template, getArgs(), NumArgs, Ctx);
}
static void Profile(llvm::FoldingSetNodeID &ID, TemplateName T,
- bool IsCurrentInstantiation,
const TemplateArgument *Args,
unsigned NumArgs,
ASTContext &Context);
QualType
ASTContext::getTemplateSpecializationType(TemplateName Template,
const TemplateArgumentListInfo &Args,
- QualType Canon,
- bool IsCurrentInstantiation) {
+ QualType Canon) {
unsigned NumArgs = Args.size();
llvm::SmallVector<TemplateArgument, 4> ArgVec;
ArgVec.push_back(Args[i].getArgument());
return getTemplateSpecializationType(Template, ArgVec.data(), NumArgs,
- Canon, IsCurrentInstantiation);
+ Canon);
}
QualType
ASTContext::getTemplateSpecializationType(TemplateName Template,
const TemplateArgument *Args,
unsigned NumArgs,
- QualType Canon,
- bool IsCurrentInstantiation) {
+ QualType Canon) {
if (!Canon.isNull())
Canon = getCanonicalType(Canon);
else {
- assert(!IsCurrentInstantiation &&
- "current-instantiation specializations should always "
- "have a canonical type");
-
// Build the canonical template specialization type.
TemplateName CanonTemplate = getCanonicalTemplateName(Template);
llvm::SmallVector<TemplateArgument, 4> CanonArgs;
// Determine whether this canonical template specialization type already
// exists.
llvm::FoldingSetNodeID ID;
- TemplateSpecializationType::Profile(ID, CanonTemplate, false,
+ TemplateSpecializationType::Profile(ID, CanonTemplate,
CanonArgs.data(), NumArgs, *this);
void *InsertPos = 0;
void *Mem = Allocate((sizeof(TemplateSpecializationType) +
sizeof(TemplateArgument) * NumArgs),
TypeAlignment);
- Spec = new (Mem) TemplateSpecializationType(CanonTemplate, false,
+ Spec = new (Mem) TemplateSpecializationType(CanonTemplate,
CanonArgs.data(), NumArgs,
Canon);
Types.push_back(Spec);
TypeAlignment);
TemplateSpecializationType *Spec
= new (Mem) TemplateSpecializationType(Template,
- IsCurrentInstantiation,
Args, NumArgs,
Canon);
TemplateSpecializationType::
TemplateSpecializationType(TemplateName T,
- bool IsCurrentInstantiation,
const TemplateArgument *Args,
unsigned NumArgs, QualType Canon)
: Type(TemplateSpecialization,
Canon.isNull()? QualType(this, 0) : Canon,
T.isDependent() || anyDependentTemplateArguments(Args, NumArgs)),
- IsCurrentInstantiation(IsCurrentInstantiation),
Template(T), NumArgs(NumArgs) {
assert((!Canon.isNull() ||
T.isDependent() || anyDependentTemplateArguments(Args, NumArgs)) &&
void
TemplateSpecializationType::Profile(llvm::FoldingSetNodeID &ID,
TemplateName T,
- bool IsCurrentInstantiation,
const TemplateArgument *Args,
unsigned NumArgs,
ASTContext &Context) {
- ID.AddBoolean(IsCurrentInstantiation);
T.Profile(ID);
for (unsigned Idx = 0; Idx < NumArgs; ++Idx)
Args[Idx].Profile(ID, Context);
"Converted template argument list is too short!");
QualType CanonType;
- bool IsCurrentInstantiation = false;
if (Name.isDependent() ||
TemplateSpecializationType::anyDependentTemplateArguments(
// class name type of the record we just found.
assert(ICNT.isCanonical());
CanonType = ICNT;
- IsCurrentInstantiation = true;
break;
}
}
// Build the fully-sugared type for this class template
// specialization, which refers back to the class template
// specialization we created or found.
- return Context.getTemplateSpecializationType(Name, TemplateArgs, CanonType,
- IsCurrentInstantiation);
+ return Context.getTemplateSpecializationType(Name, TemplateArgs, CanonType);
}
Action::TypeResult