forked from OSchip/llvm-project
Rename TypenameType to DependentNameType in anticipation of some
refactoring work in this area. llvm-svn: 100019
This commit is contained in:
parent
30e631862f
commit
c1d2d8a014
|
@ -117,7 +117,7 @@ class ASTContext {
|
|||
llvm::FoldingSet<SubstTemplateTypeParmType> SubstTemplateTypeParmTypes;
|
||||
llvm::FoldingSet<TemplateSpecializationType> TemplateSpecializationTypes;
|
||||
llvm::FoldingSet<QualifiedNameType> QualifiedNameTypes;
|
||||
llvm::FoldingSet<TypenameType> TypenameTypes;
|
||||
llvm::FoldingSet<DependentNameType> DependentNameTypes;
|
||||
llvm::FoldingSet<ObjCInterfaceType> ObjCInterfaceTypes;
|
||||
llvm::FoldingSet<ObjCObjectPointerType> ObjCObjectPointerTypes;
|
||||
llvm::FoldingSet<ElaboratedType> ElaboratedTypes;
|
||||
|
@ -630,10 +630,10 @@ public:
|
|||
|
||||
QualType getQualifiedNameType(NestedNameSpecifier *NNS,
|
||||
QualType NamedType);
|
||||
QualType getTypenameType(NestedNameSpecifier *NNS,
|
||||
QualType getDependentNameType(NestedNameSpecifier *NNS,
|
||||
const IdentifierInfo *Name,
|
||||
QualType Canon = QualType());
|
||||
QualType getTypenameType(NestedNameSpecifier *NNS,
|
||||
QualType getDependentNameType(NestedNameSpecifier *NNS,
|
||||
const TemplateSpecializationType *TemplateId,
|
||||
QualType Canon = QualType());
|
||||
QualType getElaboratedType(QualType UnderlyingType,
|
||||
|
|
|
@ -2604,16 +2604,16 @@ public:
|
|||
/// \brief Represents a 'typename' specifier that names a type within
|
||||
/// a dependent type, e.g., "typename T::type".
|
||||
///
|
||||
/// TypenameType has a very similar structure to QualifiedNameType,
|
||||
/// DependentNameType has a very similar structure to QualifiedNameType,
|
||||
/// which also involves a nested-name-specifier following by a type,
|
||||
/// and (FIXME!) both can even be prefixed by the 'typename'
|
||||
/// keyword. However, the two types serve very different roles:
|
||||
/// QualifiedNameType is a non-semantic type that serves only as sugar
|
||||
/// to show how a particular type was written in the source
|
||||
/// code. TypenameType, on the other hand, only occurs when the
|
||||
/// code. DependentNameType, on the other hand, only occurs when the
|
||||
/// nested-name-specifier is dependent, such that we cannot resolve
|
||||
/// the actual type until after instantiation.
|
||||
class TypenameType : public Type, public llvm::FoldingSetNode {
|
||||
class DependentNameType : public Type, public llvm::FoldingSetNode {
|
||||
/// \brief The nested name specifier containing the qualifier.
|
||||
NestedNameSpecifier *NNS;
|
||||
|
||||
|
@ -2623,18 +2623,18 @@ class TypenameType : public Type, public llvm::FoldingSetNode {
|
|||
/// \brief The type that this typename specifier refers to.
|
||||
NameType Name;
|
||||
|
||||
TypenameType(NestedNameSpecifier *NNS, const IdentifierInfo *Name,
|
||||
DependentNameType(NestedNameSpecifier *NNS, const IdentifierInfo *Name,
|
||||
QualType CanonType)
|
||||
: Type(Typename, CanonType, true), NNS(NNS), Name(Name) {
|
||||
: Type(DependentName, CanonType, true), NNS(NNS), Name(Name) {
|
||||
assert(NNS->isDependent() &&
|
||||
"TypenameType requires a dependent nested-name-specifier");
|
||||
"DependentNameType requires a dependent nested-name-specifier");
|
||||
}
|
||||
|
||||
TypenameType(NestedNameSpecifier *NNS, const TemplateSpecializationType *Ty,
|
||||
DependentNameType(NestedNameSpecifier *NNS, const TemplateSpecializationType *Ty,
|
||||
QualType CanonType)
|
||||
: Type(Typename, CanonType, true), NNS(NNS), Name(Ty) {
|
||||
: Type(DependentName, CanonType, true), NNS(NNS), Name(Ty) {
|
||||
assert(NNS->isDependent() &&
|
||||
"TypenameType requires a dependent nested-name-specifier");
|
||||
"DependentNameType requires a dependent nested-name-specifier");
|
||||
}
|
||||
|
||||
friend class ASTContext; // ASTContext creates these
|
||||
|
@ -2673,9 +2673,9 @@ public:
|
|||
}
|
||||
|
||||
static bool classof(const Type *T) {
|
||||
return T->getTypeClass() == Typename;
|
||||
return T->getTypeClass() == DependentName;
|
||||
}
|
||||
static bool classof(const TypenameType *T) { return true; }
|
||||
static bool classof(const DependentNameType *T) { return true; }
|
||||
};
|
||||
|
||||
/// ObjCInterfaceType - Interfaces are the core concept in Objective-C for
|
||||
|
@ -3260,6 +3260,6 @@ CLANG_ISA_STATISTIC(SubstTemplateTypeParmType, cxx_type_checks)
|
|||
CLANG_ISA_STATISTIC(TemplateSpecializationType, cxx_type_checks)
|
||||
CLANG_ISA_STATISTIC(QualifiedNameType, cxx_type_checks)
|
||||
CLANG_ISA_STATISTIC(InjectedClassNameType, cxx_type_checks)
|
||||
CLANG_ISA_STATISTIC(TypenameType, cxx_type_checks)
|
||||
CLANG_ISA_STATISTIC(DependentNameType, cxx_type_checks)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1242,9 +1242,9 @@ class QualifiedNameTypeLoc :
|
|||
};
|
||||
|
||||
// FIXME: locations for the typename keyword and nested name specifier.
|
||||
class TypenameTypeLoc : public InheritingConcreteTypeLoc<TypeSpecTypeLoc,
|
||||
TypenameTypeLoc,
|
||||
TypenameType> {
|
||||
class DependentNameTypeLoc : public InheritingConcreteTypeLoc<TypeSpecTypeLoc,
|
||||
DependentNameTypeLoc,
|
||||
DependentNameType> {
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ NON_CANONICAL_TYPE(SubstTemplateTypeParm, Type)
|
|||
NON_CANONICAL_UNLESS_DEPENDENT_TYPE(TemplateSpecialization, Type)
|
||||
NON_CANONICAL_TYPE(QualifiedName, Type)
|
||||
NON_CANONICAL_TYPE(InjectedClassName, Type)
|
||||
DEPENDENT_TYPE(Typename, Type)
|
||||
DEPENDENT_TYPE(DependentName, Type)
|
||||
TYPE(ObjCInterface, Type)
|
||||
TYPE(ObjCObjectPointer, Type)
|
||||
|
||||
|
|
|
@ -233,7 +233,7 @@ NODE_XML(QualifiedNameType, "QualifiedNameType")
|
|||
TYPE_ATTRIBUTE_XML(getNamedType())
|
||||
END_NODE_XML
|
||||
|
||||
NODE_XML(TypenameType, "TypenameType")
|
||||
NODE_XML(DependentNameType, "DependentNameType")
|
||||
ID_ATTRIBUTE_XML
|
||||
END_NODE_XML
|
||||
|
||||
|
|
|
@ -1962,7 +1962,7 @@ ASTContext::getQualifiedNameType(NestedNameSpecifier *NNS,
|
|||
return QualType(T, 0);
|
||||
}
|
||||
|
||||
QualType ASTContext::getTypenameType(NestedNameSpecifier *NNS,
|
||||
QualType ASTContext::getDependentNameType(NestedNameSpecifier *NNS,
|
||||
const IdentifierInfo *Name,
|
||||
QualType Canon) {
|
||||
assert(NNS->isDependent() && "nested-name-specifier must be dependent");
|
||||
|
@ -1970,36 +1970,36 @@ QualType ASTContext::getTypenameType(NestedNameSpecifier *NNS,
|
|||
if (Canon.isNull()) {
|
||||
NestedNameSpecifier *CanonNNS = getCanonicalNestedNameSpecifier(NNS);
|
||||
if (CanonNNS != NNS)
|
||||
Canon = getTypenameType(CanonNNS, Name);
|
||||
Canon = getDependentNameType(CanonNNS, Name);
|
||||
}
|
||||
|
||||
llvm::FoldingSetNodeID ID;
|
||||
TypenameType::Profile(ID, NNS, Name);
|
||||
DependentNameType::Profile(ID, NNS, Name);
|
||||
|
||||
void *InsertPos = 0;
|
||||
TypenameType *T
|
||||
= TypenameTypes.FindNodeOrInsertPos(ID, InsertPos);
|
||||
DependentNameType *T
|
||||
= DependentNameTypes.FindNodeOrInsertPos(ID, InsertPos);
|
||||
if (T)
|
||||
return QualType(T, 0);
|
||||
|
||||
T = new (*this) TypenameType(NNS, Name, Canon);
|
||||
T = new (*this) DependentNameType(NNS, Name, Canon);
|
||||
Types.push_back(T);
|
||||
TypenameTypes.InsertNode(T, InsertPos);
|
||||
DependentNameTypes.InsertNode(T, InsertPos);
|
||||
return QualType(T, 0);
|
||||
}
|
||||
|
||||
QualType
|
||||
ASTContext::getTypenameType(NestedNameSpecifier *NNS,
|
||||
ASTContext::getDependentNameType(NestedNameSpecifier *NNS,
|
||||
const TemplateSpecializationType *TemplateId,
|
||||
QualType Canon) {
|
||||
assert(NNS->isDependent() && "nested-name-specifier must be dependent");
|
||||
|
||||
llvm::FoldingSetNodeID ID;
|
||||
TypenameType::Profile(ID, NNS, TemplateId);
|
||||
DependentNameType::Profile(ID, NNS, TemplateId);
|
||||
|
||||
void *InsertPos = 0;
|
||||
TypenameType *T
|
||||
= TypenameTypes.FindNodeOrInsertPos(ID, InsertPos);
|
||||
DependentNameType *T
|
||||
= DependentNameTypes.FindNodeOrInsertPos(ID, InsertPos);
|
||||
if (T)
|
||||
return QualType(T, 0);
|
||||
|
||||
|
@ -2011,17 +2011,17 @@ ASTContext::getTypenameType(NestedNameSpecifier *NNS,
|
|||
= CanonType->getAs<TemplateSpecializationType>();
|
||||
assert(CanonTemplateId &&
|
||||
"Canonical type must also be a template specialization type");
|
||||
Canon = getTypenameType(CanonNNS, CanonTemplateId);
|
||||
Canon = getDependentNameType(CanonNNS, CanonTemplateId);
|
||||
}
|
||||
|
||||
TypenameType *CheckT
|
||||
= TypenameTypes.FindNodeOrInsertPos(ID, InsertPos);
|
||||
DependentNameType *CheckT
|
||||
= DependentNameTypes.FindNodeOrInsertPos(ID, InsertPos);
|
||||
assert(!CheckT && "Typename canonical type is broken"); (void)CheckT;
|
||||
}
|
||||
|
||||
T = new (*this) TypenameType(NNS, TemplateId, Canon);
|
||||
T = new (*this) DependentNameType(NNS, TemplateId, Canon);
|
||||
Types.push_back(T);
|
||||
TypenameTypes.InsertNode(T, InsertPos);
|
||||
DependentNameTypes.InsertNode(T, InsertPos);
|
||||
return QualType(T, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace {
|
|||
// FIXME: SubstTemplateTypeParmType
|
||||
// FIXME: TemplateSpecializationType
|
||||
QualType VisitQualifiedNameType(QualifiedNameType *T);
|
||||
// FIXME: TypenameType
|
||||
// FIXME: DependentNameType
|
||||
QualType VisitObjCInterfaceType(ObjCInterfaceType *T);
|
||||
QualType VisitObjCObjectPointerType(ObjCObjectPointerType *T);
|
||||
|
||||
|
@ -618,9 +618,9 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context,
|
|||
break;
|
||||
}
|
||||
|
||||
case Type::Typename: {
|
||||
const TypenameType *Typename1 = cast<TypenameType>(T1);
|
||||
const TypenameType *Typename2 = cast<TypenameType>(T2);
|
||||
case Type::DependentName: {
|
||||
const DependentNameType *Typename1 = cast<DependentNameType>(T1);
|
||||
const DependentNameType *Typename2 = cast<DependentNameType>(T2);
|
||||
if (!IsStructurallyEquivalent(Context,
|
||||
Typename1->getQualifier(),
|
||||
Typename2->getQualifier()))
|
||||
|
|
|
@ -757,7 +757,7 @@ bool Type::isSpecifierType() const {
|
|||
case SubstTemplateTypeParm:
|
||||
case TemplateSpecialization:
|
||||
case QualifiedName:
|
||||
case Typename:
|
||||
case DependentName:
|
||||
case ObjCInterface:
|
||||
case ObjCObjectPointer:
|
||||
case Elaborated:
|
||||
|
|
|
@ -567,7 +567,7 @@ void TypePrinter::PrintQualifiedName(const QualifiedNameType *T,
|
|||
S = MyString + ' ' + S;
|
||||
}
|
||||
|
||||
void TypePrinter::PrintTypename(const TypenameType *T, std::string &S) {
|
||||
void TypePrinter::PrintDependentName(const DependentNameType *T, std::string &S) {
|
||||
std::string MyString;
|
||||
|
||||
{
|
||||
|
|
|
@ -1164,7 +1164,7 @@ void CXXNameMangler::mangleType(const TemplateSpecializationType *T) {
|
|||
mangleName(TD, T->getArgs(), T->getNumArgs());
|
||||
}
|
||||
|
||||
void CXXNameMangler::mangleType(const TypenameType *T) {
|
||||
void CXXNameMangler::mangleType(const DependentNameType *T) {
|
||||
// Typename types are always nested
|
||||
Out << 'N';
|
||||
mangleUnresolvedScope(T->getQualifier());
|
||||
|
@ -1456,7 +1456,7 @@ void CXXNameMangler::mangleExpression(const Expr *E) {
|
|||
// It isn't clear that we ever actually want to have such a
|
||||
// nested-name-specifier; why not just represent it as a typename type?
|
||||
if (!QTy && NNS->getAsIdentifier() && NNS->getPrefix()) {
|
||||
QTy = getASTContext().getTypenameType(NNS->getPrefix(),
|
||||
QTy = getASTContext().getDependentNameType(NNS->getPrefix(),
|
||||
NNS->getAsIdentifier())
|
||||
.getTypePtr();
|
||||
}
|
||||
|
|
|
@ -2351,7 +2351,7 @@ void TypeLocReader::VisitQualifiedNameTypeLoc(QualifiedNameTypeLoc TL) {
|
|||
void TypeLocReader::VisitInjectedClassNameTypeLoc(InjectedClassNameTypeLoc TL) {
|
||||
TL.setNameLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
||||
}
|
||||
void TypeLocReader::VisitTypenameTypeLoc(TypenameTypeLoc TL) {
|
||||
void TypeLocReader::VisitDependentNameTypeLoc(DependentNameTypeLoc TL) {
|
||||
TL.setNameLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
||||
}
|
||||
void TypeLocReader::VisitObjCInterfaceTypeLoc(ObjCInterfaceTypeLoc TL) {
|
||||
|
|
|
@ -406,7 +406,7 @@ void TypeLocWriter::VisitQualifiedNameTypeLoc(QualifiedNameTypeLoc TL) {
|
|||
void TypeLocWriter::VisitInjectedClassNameTypeLoc(InjectedClassNameTypeLoc TL) {
|
||||
Writer.AddSourceLocation(TL.getNameLoc(), Record);
|
||||
}
|
||||
void TypeLocWriter::VisitTypenameTypeLoc(TypenameTypeLoc TL) {
|
||||
void TypeLocWriter::VisitDependentNameTypeLoc(DependentNameTypeLoc TL) {
|
||||
Writer.AddSourceLocation(TL.getNameLoc(), Record);
|
||||
}
|
||||
void TypeLocWriter::VisitObjCInterfaceTypeLoc(ObjCInterfaceTypeLoc TL) {
|
||||
|
|
|
@ -88,8 +88,8 @@ Sema::TypeTy *Sema::getTypeName(IdentifierInfo &II, SourceLocation NameLoc,
|
|||
return 0;
|
||||
|
||||
// We know from the grammar that this name refers to a type, so build a
|
||||
// TypenameType node to describe the type.
|
||||
// FIXME: Record somewhere that this TypenameType node has no "typename"
|
||||
// DependentNameType node to describe the type.
|
||||
// FIXME: Record somewhere that this DependentNameType node has no "typename"
|
||||
// keyword associated with it.
|
||||
return CheckTypenameType((NestedNameSpecifier *)SS->getScopeRep(),
|
||||
II, SS->getRange()).getAsOpaquePtr();
|
||||
|
@ -198,7 +198,7 @@ Sema::TypeTy *Sema::getTypeName(IdentifierInfo &II, SourceLocation NameLoc,
|
|||
} else if (UnresolvedUsingTypenameDecl *UUDecl =
|
||||
dyn_cast<UnresolvedUsingTypenameDecl>(IIDecl)) {
|
||||
// FIXME: preserve source structure information.
|
||||
T = Context.getTypenameType(UUDecl->getTargetNestedNameSpecifier(), &II);
|
||||
T = Context.getDependentNameType(UUDecl->getTargetNestedNameSpecifier(), &II);
|
||||
} else {
|
||||
// If it's not plausibly a type, suppress diagnostics.
|
||||
Result.suppressDiagnostics();
|
||||
|
|
|
@ -4962,7 +4962,7 @@ Sema::ActOnTypenameType(SourceLocation TypenameLoc, const CXXScopeSpec &SS,
|
|||
return Context.getQualifiedNameType(NNS, T).getAsOpaquePtr();
|
||||
}
|
||||
|
||||
return Context.getTypenameType(NNS, TemplateId).getAsOpaquePtr();
|
||||
return Context.getDependentNameType(NNS, TemplateId).getAsOpaquePtr();
|
||||
}
|
||||
|
||||
/// \brief Build the type that describes a C++ typename specifier,
|
||||
|
@ -4977,7 +4977,7 @@ Sema::CheckTypenameType(NestedNameSpecifier *NNS, const IdentifierInfo &II,
|
|||
// If the nested-name-specifier does not refer to the current
|
||||
// instantiation, then build a typename type.
|
||||
if (!CurrentInstantiation)
|
||||
return Context.getTypenameType(NNS, &II);
|
||||
return Context.getDependentNameType(NNS, &II);
|
||||
|
||||
// The nested-name-specifier refers to the current instantiation, so the
|
||||
// "typename" keyword itself is superfluous. In C++03, the program is
|
||||
|
@ -5013,7 +5013,7 @@ Sema::CheckTypenameType(NestedNameSpecifier *NNS, const IdentifierInfo &II,
|
|||
|
||||
case LookupResult::NotFoundInCurrentInstantiation:
|
||||
// Okay, it's a member of an unknown instantiation.
|
||||
return Context.getTypenameType(NNS, &II);
|
||||
return Context.getDependentNameType(NNS, &II);
|
||||
|
||||
case LookupResult::Found:
|
||||
if (TypeDecl *Type = dyn_cast<TypeDecl>(Result.getFoundDecl())) {
|
||||
|
@ -5098,16 +5098,16 @@ namespace {
|
|||
/// \brief Transforms a typename type by determining whether the type now
|
||||
/// refers to a member of the current instantiation, and then
|
||||
/// type-checking and building a QualifiedNameType (when possible).
|
||||
QualType TransformTypenameType(TypeLocBuilder &TLB, TypenameTypeLoc TL,
|
||||
QualType TransformDependentNameType(TypeLocBuilder &TLB, DependentNameTypeLoc TL,
|
||||
QualType ObjectType);
|
||||
};
|
||||
}
|
||||
|
||||
QualType
|
||||
CurrentInstantiationRebuilder::TransformTypenameType(TypeLocBuilder &TLB,
|
||||
TypenameTypeLoc TL,
|
||||
CurrentInstantiationRebuilder::TransformDependentNameType(TypeLocBuilder &TLB,
|
||||
DependentNameTypeLoc TL,
|
||||
QualType ObjectType) {
|
||||
TypenameType *T = TL.getTypePtr();
|
||||
DependentNameType *T = TL.getTypePtr();
|
||||
|
||||
NestedNameSpecifier *NNS
|
||||
= TransformNestedNameSpecifier(T->getQualifier(),
|
||||
|
@ -5139,15 +5139,15 @@ CurrentInstantiationRebuilder::TransformTypenameType(TypeLocBuilder &TLB,
|
|||
NewTemplateId == QualType(TemplateId, 0))
|
||||
Result = QualType(T, 0);
|
||||
else
|
||||
Result = getDerived().RebuildTypenameType(NNS, NewTemplateId);
|
||||
Result = getDerived().RebuildDependentNameType(NNS, NewTemplateId);
|
||||
} else
|
||||
Result = getDerived().RebuildTypenameType(NNS, T->getIdentifier(),
|
||||
Result = getDerived().RebuildDependentNameType(NNS, T->getIdentifier(),
|
||||
SourceRange(TL.getNameLoc()));
|
||||
|
||||
if (Result.isNull())
|
||||
return QualType();
|
||||
|
||||
TypenameTypeLoc NewTL = TLB.push<TypenameTypeLoc>(Result);
|
||||
DependentNameTypeLoc NewTL = TLB.push<DependentNameTypeLoc>(Result);
|
||||
NewTL.setNameLoc(TL.getNameLoc());
|
||||
return Result;
|
||||
}
|
||||
|
@ -5172,7 +5172,7 @@ CurrentInstantiationRebuilder::TransformTypenameType(TypeLocBuilder &TLB,
|
|||
/// typename X<T>::pointer X<T>::data() { ... }
|
||||
/// \endcode
|
||||
///
|
||||
/// Here, the type "typename X<T>::pointer" will be created as a TypenameType,
|
||||
/// Here, the type "typename X<T>::pointer" will be created as a DependentNameType,
|
||||
/// since we do not know that we can look into X<T> when we parsed the type.
|
||||
/// This function will rebuild the type, performing the lookup of "pointer"
|
||||
/// in X<T> and returning a QualifiedNameType whose canonical type is the same
|
||||
|
|
|
@ -773,7 +773,7 @@ DeduceTemplateArguments(Sema &S,
|
|||
|
||||
case Type::TypeOfExpr:
|
||||
case Type::TypeOf:
|
||||
case Type::Typename:
|
||||
case Type::DependentName:
|
||||
// No template argument deduction for these types
|
||||
return Sema::TDK_Success;
|
||||
|
||||
|
@ -2555,10 +2555,10 @@ MarkUsedTemplateParameters(Sema &SemaRef, QualType T,
|
|||
OnlyDeduced, Depth, Used);
|
||||
break;
|
||||
|
||||
case Type::Typename:
|
||||
case Type::DependentName:
|
||||
if (!OnlyDeduced)
|
||||
MarkUsedTemplateParameters(SemaRef,
|
||||
cast<TypenameType>(T)->getQualifier(),
|
||||
cast<DependentNameType>(T)->getQualifier(),
|
||||
OnlyDeduced, Depth, Used);
|
||||
break;
|
||||
|
||||
|
|
|
@ -1262,7 +1262,7 @@ QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S,
|
|||
NestedNameSpecifier *NNSPrefix = NNS->getPrefix();
|
||||
switch (NNS->getKind()) {
|
||||
case NestedNameSpecifier::Identifier:
|
||||
ClsType = Context.getTypenameType(NNSPrefix, NNS->getAsIdentifier());
|
||||
ClsType = Context.getDependentNameType(NNSPrefix, NNS->getAsIdentifier());
|
||||
break;
|
||||
|
||||
case NestedNameSpecifier::Namespace:
|
||||
|
|
|
@ -537,15 +537,15 @@ public:
|
|||
|
||||
/// \brief Build a new typename type that refers to a template-id.
|
||||
///
|
||||
/// By default, builds a new TypenameType type from the nested-name-specifier
|
||||
/// By default, builds a new DependentNameType type from the nested-name-specifier
|
||||
/// and the given type. Subclasses may override this routine to provide
|
||||
/// different behavior.
|
||||
QualType RebuildTypenameType(NestedNameSpecifier *NNS, QualType T) {
|
||||
QualType RebuildDependentNameType(NestedNameSpecifier *NNS, QualType T) {
|
||||
if (NNS->isDependent()) {
|
||||
CXXScopeSpec SS;
|
||||
SS.setScopeRep(NNS);
|
||||
if (!SemaRef.computeDeclContext(SS))
|
||||
return SemaRef.Context.getTypenameType(NNS,
|
||||
return SemaRef.Context.getDependentNameType(NNS,
|
||||
cast<TemplateSpecializationType>(T));
|
||||
}
|
||||
|
||||
|
@ -557,7 +557,7 @@ public:
|
|||
/// By default, performs semantic analysis when building the typename type
|
||||
/// (or qualified name type). Subclasses may override this routine to provide
|
||||
/// different behavior.
|
||||
QualType RebuildTypenameType(NestedNameSpecifier *NNS,
|
||||
QualType RebuildDependentNameType(NestedNameSpecifier *NNS,
|
||||
const IdentifierInfo *Id,
|
||||
SourceRange SR) {
|
||||
return SemaRef.CheckTypenameType(NNS, *Id, SR);
|
||||
|
@ -2996,10 +2996,10 @@ TreeTransform<Derived>::TransformQualifiedNameType(TypeLocBuilder &TLB,
|
|||
}
|
||||
|
||||
template<typename Derived>
|
||||
QualType TreeTransform<Derived>::TransformTypenameType(TypeLocBuilder &TLB,
|
||||
TypenameTypeLoc TL,
|
||||
QualType TreeTransform<Derived>::TransformDependentNameType(TypeLocBuilder &TLB,
|
||||
DependentNameTypeLoc TL,
|
||||
QualType ObjectType) {
|
||||
TypenameType *T = TL.getTypePtr();
|
||||
DependentNameType *T = TL.getTypePtr();
|
||||
|
||||
/* FIXME: preserve source information better than this */
|
||||
SourceRange SR(TL.getNameLoc());
|
||||
|
@ -3023,14 +3023,14 @@ QualType TreeTransform<Derived>::TransformTypenameType(TypeLocBuilder &TLB,
|
|||
NewTemplateId == QualType(TemplateId, 0))
|
||||
return QualType(T, 0);
|
||||
|
||||
Result = getDerived().RebuildTypenameType(NNS, NewTemplateId);
|
||||
Result = getDerived().RebuildDependentNameType(NNS, NewTemplateId);
|
||||
} else {
|
||||
Result = getDerived().RebuildTypenameType(NNS, T->getIdentifier(), SR);
|
||||
Result = getDerived().RebuildDependentNameType(NNS, T->getIdentifier(), SR);
|
||||
}
|
||||
if (Result.isNull())
|
||||
return QualType();
|
||||
|
||||
TypenameTypeLoc NewTL = TLB.push<TypenameTypeLoc>(Result);
|
||||
DependentNameTypeLoc NewTL = TLB.push<DependentNameTypeLoc>(Result);
|
||||
NewTL.setNameLoc(TL.getNameLoc());
|
||||
|
||||
return Result;
|
||||
|
|
Loading…
Reference in New Issue