Rename TypenameType to DependentNameType in anticipation of some

refactoring work in this area.

llvm-svn: 100019
This commit is contained in:
Douglas Gregor 2010-03-31 17:34:00 +00:00
parent 30e631862f
commit c1d2d8a014
17 changed files with 74 additions and 74 deletions

View File

@ -117,7 +117,7 @@ class ASTContext {
llvm::FoldingSet<SubstTemplateTypeParmType> SubstTemplateTypeParmTypes; llvm::FoldingSet<SubstTemplateTypeParmType> SubstTemplateTypeParmTypes;
llvm::FoldingSet<TemplateSpecializationType> TemplateSpecializationTypes; llvm::FoldingSet<TemplateSpecializationType> TemplateSpecializationTypes;
llvm::FoldingSet<QualifiedNameType> QualifiedNameTypes; llvm::FoldingSet<QualifiedNameType> QualifiedNameTypes;
llvm::FoldingSet<TypenameType> TypenameTypes; llvm::FoldingSet<DependentNameType> DependentNameTypes;
llvm::FoldingSet<ObjCInterfaceType> ObjCInterfaceTypes; llvm::FoldingSet<ObjCInterfaceType> ObjCInterfaceTypes;
llvm::FoldingSet<ObjCObjectPointerType> ObjCObjectPointerTypes; llvm::FoldingSet<ObjCObjectPointerType> ObjCObjectPointerTypes;
llvm::FoldingSet<ElaboratedType> ElaboratedTypes; llvm::FoldingSet<ElaboratedType> ElaboratedTypes;
@ -630,10 +630,10 @@ public:
QualType getQualifiedNameType(NestedNameSpecifier *NNS, QualType getQualifiedNameType(NestedNameSpecifier *NNS,
QualType NamedType); QualType NamedType);
QualType getTypenameType(NestedNameSpecifier *NNS, QualType getDependentNameType(NestedNameSpecifier *NNS,
const IdentifierInfo *Name, const IdentifierInfo *Name,
QualType Canon = QualType()); QualType Canon = QualType());
QualType getTypenameType(NestedNameSpecifier *NNS, QualType getDependentNameType(NestedNameSpecifier *NNS,
const TemplateSpecializationType *TemplateId, const TemplateSpecializationType *TemplateId,
QualType Canon = QualType()); QualType Canon = QualType());
QualType getElaboratedType(QualType UnderlyingType, QualType getElaboratedType(QualType UnderlyingType,

View File

@ -2604,16 +2604,16 @@ public:
/// \brief Represents a 'typename' specifier that names a type within /// \brief Represents a 'typename' specifier that names a type within
/// a dependent type, e.g., "typename T::type". /// 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, /// which also involves a nested-name-specifier following by a type,
/// and (FIXME!) both can even be prefixed by the 'typename' /// and (FIXME!) both can even be prefixed by the 'typename'
/// keyword. However, the two types serve very different roles: /// keyword. However, the two types serve very different roles:
/// QualifiedNameType is a non-semantic type that serves only as sugar /// QualifiedNameType is a non-semantic type that serves only as sugar
/// to show how a particular type was written in the source /// 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 /// nested-name-specifier is dependent, such that we cannot resolve
/// the actual type until after instantiation. /// 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. /// \brief The nested name specifier containing the qualifier.
NestedNameSpecifier *NNS; NestedNameSpecifier *NNS;
@ -2623,18 +2623,18 @@ class TypenameType : public Type, public llvm::FoldingSetNode {
/// \brief The type that this typename specifier refers to. /// \brief The type that this typename specifier refers to.
NameType Name; NameType Name;
TypenameType(NestedNameSpecifier *NNS, const IdentifierInfo *Name, DependentNameType(NestedNameSpecifier *NNS, const IdentifierInfo *Name,
QualType CanonType) QualType CanonType)
: Type(Typename, CanonType, true), NNS(NNS), Name(Name) { : Type(DependentName, CanonType, true), NNS(NNS), Name(Name) {
assert(NNS->isDependent() && 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) QualType CanonType)
: Type(Typename, CanonType, true), NNS(NNS), Name(Ty) { : Type(DependentName, CanonType, true), NNS(NNS), Name(Ty) {
assert(NNS->isDependent() && assert(NNS->isDependent() &&
"TypenameType requires a dependent nested-name-specifier"); "DependentNameType requires a dependent nested-name-specifier");
} }
friend class ASTContext; // ASTContext creates these friend class ASTContext; // ASTContext creates these
@ -2673,9 +2673,9 @@ public:
} }
static bool classof(const Type *T) { 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 /// 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(TemplateSpecializationType, cxx_type_checks)
CLANG_ISA_STATISTIC(QualifiedNameType, cxx_type_checks) CLANG_ISA_STATISTIC(QualifiedNameType, cxx_type_checks)
CLANG_ISA_STATISTIC(InjectedClassNameType, 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 #endif

View File

@ -1242,9 +1242,9 @@ class QualifiedNameTypeLoc :
}; };
// FIXME: locations for the typename keyword and nested name specifier. // FIXME: locations for the typename keyword and nested name specifier.
class TypenameTypeLoc : public InheritingConcreteTypeLoc<TypeSpecTypeLoc, class DependentNameTypeLoc : public InheritingConcreteTypeLoc<TypeSpecTypeLoc,
TypenameTypeLoc, DependentNameTypeLoc,
TypenameType> { DependentNameType> {
}; };
} }

View File

@ -92,7 +92,7 @@ NON_CANONICAL_TYPE(SubstTemplateTypeParm, Type)
NON_CANONICAL_UNLESS_DEPENDENT_TYPE(TemplateSpecialization, Type) NON_CANONICAL_UNLESS_DEPENDENT_TYPE(TemplateSpecialization, Type)
NON_CANONICAL_TYPE(QualifiedName, Type) NON_CANONICAL_TYPE(QualifiedName, Type)
NON_CANONICAL_TYPE(InjectedClassName, Type) NON_CANONICAL_TYPE(InjectedClassName, Type)
DEPENDENT_TYPE(Typename, Type) DEPENDENT_TYPE(DependentName, Type)
TYPE(ObjCInterface, Type) TYPE(ObjCInterface, Type)
TYPE(ObjCObjectPointer, Type) TYPE(ObjCObjectPointer, Type)

View File

@ -233,7 +233,7 @@ NODE_XML(QualifiedNameType, "QualifiedNameType")
TYPE_ATTRIBUTE_XML(getNamedType()) TYPE_ATTRIBUTE_XML(getNamedType())
END_NODE_XML END_NODE_XML
NODE_XML(TypenameType, "TypenameType") NODE_XML(DependentNameType, "DependentNameType")
ID_ATTRIBUTE_XML ID_ATTRIBUTE_XML
END_NODE_XML END_NODE_XML

View File

@ -1962,7 +1962,7 @@ ASTContext::getQualifiedNameType(NestedNameSpecifier *NNS,
return QualType(T, 0); return QualType(T, 0);
} }
QualType ASTContext::getTypenameType(NestedNameSpecifier *NNS, QualType ASTContext::getDependentNameType(NestedNameSpecifier *NNS,
const IdentifierInfo *Name, const IdentifierInfo *Name,
QualType Canon) { QualType Canon) {
assert(NNS->isDependent() && "nested-name-specifier must be dependent"); assert(NNS->isDependent() && "nested-name-specifier must be dependent");
@ -1970,36 +1970,36 @@ QualType ASTContext::getTypenameType(NestedNameSpecifier *NNS,
if (Canon.isNull()) { if (Canon.isNull()) {
NestedNameSpecifier *CanonNNS = getCanonicalNestedNameSpecifier(NNS); NestedNameSpecifier *CanonNNS = getCanonicalNestedNameSpecifier(NNS);
if (CanonNNS != NNS) if (CanonNNS != NNS)
Canon = getTypenameType(CanonNNS, Name); Canon = getDependentNameType(CanonNNS, Name);
} }
llvm::FoldingSetNodeID ID; llvm::FoldingSetNodeID ID;
TypenameType::Profile(ID, NNS, Name); DependentNameType::Profile(ID, NNS, Name);
void *InsertPos = 0; void *InsertPos = 0;
TypenameType *T DependentNameType *T
= TypenameTypes.FindNodeOrInsertPos(ID, InsertPos); = DependentNameTypes.FindNodeOrInsertPos(ID, InsertPos);
if (T) if (T)
return QualType(T, 0); return QualType(T, 0);
T = new (*this) TypenameType(NNS, Name, Canon); T = new (*this) DependentNameType(NNS, Name, Canon);
Types.push_back(T); Types.push_back(T);
TypenameTypes.InsertNode(T, InsertPos); DependentNameTypes.InsertNode(T, InsertPos);
return QualType(T, 0); return QualType(T, 0);
} }
QualType QualType
ASTContext::getTypenameType(NestedNameSpecifier *NNS, ASTContext::getDependentNameType(NestedNameSpecifier *NNS,
const TemplateSpecializationType *TemplateId, const TemplateSpecializationType *TemplateId,
QualType Canon) { QualType Canon) {
assert(NNS->isDependent() && "nested-name-specifier must be dependent"); assert(NNS->isDependent() && "nested-name-specifier must be dependent");
llvm::FoldingSetNodeID ID; llvm::FoldingSetNodeID ID;
TypenameType::Profile(ID, NNS, TemplateId); DependentNameType::Profile(ID, NNS, TemplateId);
void *InsertPos = 0; void *InsertPos = 0;
TypenameType *T DependentNameType *T
= TypenameTypes.FindNodeOrInsertPos(ID, InsertPos); = DependentNameTypes.FindNodeOrInsertPos(ID, InsertPos);
if (T) if (T)
return QualType(T, 0); return QualType(T, 0);
@ -2011,17 +2011,17 @@ ASTContext::getTypenameType(NestedNameSpecifier *NNS,
= CanonType->getAs<TemplateSpecializationType>(); = CanonType->getAs<TemplateSpecializationType>();
assert(CanonTemplateId && assert(CanonTemplateId &&
"Canonical type must also be a template specialization type"); "Canonical type must also be a template specialization type");
Canon = getTypenameType(CanonNNS, CanonTemplateId); Canon = getDependentNameType(CanonNNS, CanonTemplateId);
} }
TypenameType *CheckT DependentNameType *CheckT
= TypenameTypes.FindNodeOrInsertPos(ID, InsertPos); = DependentNameTypes.FindNodeOrInsertPos(ID, InsertPos);
assert(!CheckT && "Typename canonical type is broken"); (void)CheckT; 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); Types.push_back(T);
TypenameTypes.InsertNode(T, InsertPos); DependentNameTypes.InsertNode(T, InsertPos);
return QualType(T, 0); return QualType(T, 0);
} }

View File

@ -73,7 +73,7 @@ namespace {
// FIXME: SubstTemplateTypeParmType // FIXME: SubstTemplateTypeParmType
// FIXME: TemplateSpecializationType // FIXME: TemplateSpecializationType
QualType VisitQualifiedNameType(QualifiedNameType *T); QualType VisitQualifiedNameType(QualifiedNameType *T);
// FIXME: TypenameType // FIXME: DependentNameType
QualType VisitObjCInterfaceType(ObjCInterfaceType *T); QualType VisitObjCInterfaceType(ObjCInterfaceType *T);
QualType VisitObjCObjectPointerType(ObjCObjectPointerType *T); QualType VisitObjCObjectPointerType(ObjCObjectPointerType *T);
@ -618,9 +618,9 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context,
break; break;
} }
case Type::Typename: { case Type::DependentName: {
const TypenameType *Typename1 = cast<TypenameType>(T1); const DependentNameType *Typename1 = cast<DependentNameType>(T1);
const TypenameType *Typename2 = cast<TypenameType>(T2); const DependentNameType *Typename2 = cast<DependentNameType>(T2);
if (!IsStructurallyEquivalent(Context, if (!IsStructurallyEquivalent(Context,
Typename1->getQualifier(), Typename1->getQualifier(),
Typename2->getQualifier())) Typename2->getQualifier()))

View File

@ -757,7 +757,7 @@ bool Type::isSpecifierType() const {
case SubstTemplateTypeParm: case SubstTemplateTypeParm:
case TemplateSpecialization: case TemplateSpecialization:
case QualifiedName: case QualifiedName:
case Typename: case DependentName:
case ObjCInterface: case ObjCInterface:
case ObjCObjectPointer: case ObjCObjectPointer:
case Elaborated: case Elaborated:

View File

@ -567,7 +567,7 @@ void TypePrinter::PrintQualifiedName(const QualifiedNameType *T,
S = MyString + ' ' + S; S = MyString + ' ' + S;
} }
void TypePrinter::PrintTypename(const TypenameType *T, std::string &S) { void TypePrinter::PrintDependentName(const DependentNameType *T, std::string &S) {
std::string MyString; std::string MyString;
{ {

View File

@ -1164,7 +1164,7 @@ void CXXNameMangler::mangleType(const TemplateSpecializationType *T) {
mangleName(TD, T->getArgs(), T->getNumArgs()); mangleName(TD, T->getArgs(), T->getNumArgs());
} }
void CXXNameMangler::mangleType(const TypenameType *T) { void CXXNameMangler::mangleType(const DependentNameType *T) {
// Typename types are always nested // Typename types are always nested
Out << 'N'; Out << 'N';
mangleUnresolvedScope(T->getQualifier()); 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 // 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? // nested-name-specifier; why not just represent it as a typename type?
if (!QTy && NNS->getAsIdentifier() && NNS->getPrefix()) { if (!QTy && NNS->getAsIdentifier() && NNS->getPrefix()) {
QTy = getASTContext().getTypenameType(NNS->getPrefix(), QTy = getASTContext().getDependentNameType(NNS->getPrefix(),
NNS->getAsIdentifier()) NNS->getAsIdentifier())
.getTypePtr(); .getTypePtr();
} }

View File

@ -2351,7 +2351,7 @@ void TypeLocReader::VisitQualifiedNameTypeLoc(QualifiedNameTypeLoc TL) {
void TypeLocReader::VisitInjectedClassNameTypeLoc(InjectedClassNameTypeLoc TL) { void TypeLocReader::VisitInjectedClassNameTypeLoc(InjectedClassNameTypeLoc TL) {
TL.setNameLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); TL.setNameLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
} }
void TypeLocReader::VisitTypenameTypeLoc(TypenameTypeLoc TL) { void TypeLocReader::VisitDependentNameTypeLoc(DependentNameTypeLoc TL) {
TL.setNameLoc(SourceLocation::getFromRawEncoding(Record[Idx++])); TL.setNameLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
} }
void TypeLocReader::VisitObjCInterfaceTypeLoc(ObjCInterfaceTypeLoc TL) { void TypeLocReader::VisitObjCInterfaceTypeLoc(ObjCInterfaceTypeLoc TL) {

View File

@ -406,7 +406,7 @@ void TypeLocWriter::VisitQualifiedNameTypeLoc(QualifiedNameTypeLoc TL) {
void TypeLocWriter::VisitInjectedClassNameTypeLoc(InjectedClassNameTypeLoc TL) { void TypeLocWriter::VisitInjectedClassNameTypeLoc(InjectedClassNameTypeLoc TL) {
Writer.AddSourceLocation(TL.getNameLoc(), Record); Writer.AddSourceLocation(TL.getNameLoc(), Record);
} }
void TypeLocWriter::VisitTypenameTypeLoc(TypenameTypeLoc TL) { void TypeLocWriter::VisitDependentNameTypeLoc(DependentNameTypeLoc TL) {
Writer.AddSourceLocation(TL.getNameLoc(), Record); Writer.AddSourceLocation(TL.getNameLoc(), Record);
} }
void TypeLocWriter::VisitObjCInterfaceTypeLoc(ObjCInterfaceTypeLoc TL) { void TypeLocWriter::VisitObjCInterfaceTypeLoc(ObjCInterfaceTypeLoc TL) {

View File

@ -88,8 +88,8 @@ Sema::TypeTy *Sema::getTypeName(IdentifierInfo &II, SourceLocation NameLoc,
return 0; return 0;
// We know from the grammar that this name refers to a type, so build a // We know from the grammar that this name refers to a type, so build a
// TypenameType node to describe the type. // DependentNameType node to describe the type.
// FIXME: Record somewhere that this TypenameType node has no "typename" // FIXME: Record somewhere that this DependentNameType node has no "typename"
// keyword associated with it. // keyword associated with it.
return CheckTypenameType((NestedNameSpecifier *)SS->getScopeRep(), return CheckTypenameType((NestedNameSpecifier *)SS->getScopeRep(),
II, SS->getRange()).getAsOpaquePtr(); II, SS->getRange()).getAsOpaquePtr();
@ -198,7 +198,7 @@ Sema::TypeTy *Sema::getTypeName(IdentifierInfo &II, SourceLocation NameLoc,
} else if (UnresolvedUsingTypenameDecl *UUDecl = } else if (UnresolvedUsingTypenameDecl *UUDecl =
dyn_cast<UnresolvedUsingTypenameDecl>(IIDecl)) { dyn_cast<UnresolvedUsingTypenameDecl>(IIDecl)) {
// FIXME: preserve source structure information. // FIXME: preserve source structure information.
T = Context.getTypenameType(UUDecl->getTargetNestedNameSpecifier(), &II); T = Context.getDependentNameType(UUDecl->getTargetNestedNameSpecifier(), &II);
} else { } else {
// If it's not plausibly a type, suppress diagnostics. // If it's not plausibly a type, suppress diagnostics.
Result.suppressDiagnostics(); Result.suppressDiagnostics();

View File

@ -4962,7 +4962,7 @@ Sema::ActOnTypenameType(SourceLocation TypenameLoc, const CXXScopeSpec &SS,
return Context.getQualifiedNameType(NNS, T).getAsOpaquePtr(); 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, /// \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 // If the nested-name-specifier does not refer to the current
// instantiation, then build a typename type. // instantiation, then build a typename type.
if (!CurrentInstantiation) if (!CurrentInstantiation)
return Context.getTypenameType(NNS, &II); return Context.getDependentNameType(NNS, &II);
// The nested-name-specifier refers to the current instantiation, so the // The nested-name-specifier refers to the current instantiation, so the
// "typename" keyword itself is superfluous. In C++03, the program is // "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: case LookupResult::NotFoundInCurrentInstantiation:
// Okay, it's a member of an unknown instantiation. // Okay, it's a member of an unknown instantiation.
return Context.getTypenameType(NNS, &II); return Context.getDependentNameType(NNS, &II);
case LookupResult::Found: case LookupResult::Found:
if (TypeDecl *Type = dyn_cast<TypeDecl>(Result.getFoundDecl())) { if (TypeDecl *Type = dyn_cast<TypeDecl>(Result.getFoundDecl())) {
@ -5098,16 +5098,16 @@ namespace {
/// \brief Transforms a typename type by determining whether the type now /// \brief Transforms a typename type by determining whether the type now
/// refers to a member of the current instantiation, and then /// refers to a member of the current instantiation, and then
/// type-checking and building a QualifiedNameType (when possible). /// type-checking and building a QualifiedNameType (when possible).
QualType TransformTypenameType(TypeLocBuilder &TLB, TypenameTypeLoc TL, QualType TransformDependentNameType(TypeLocBuilder &TLB, DependentNameTypeLoc TL,
QualType ObjectType); QualType ObjectType);
}; };
} }
QualType QualType
CurrentInstantiationRebuilder::TransformTypenameType(TypeLocBuilder &TLB, CurrentInstantiationRebuilder::TransformDependentNameType(TypeLocBuilder &TLB,
TypenameTypeLoc TL, DependentNameTypeLoc TL,
QualType ObjectType) { QualType ObjectType) {
TypenameType *T = TL.getTypePtr(); DependentNameType *T = TL.getTypePtr();
NestedNameSpecifier *NNS NestedNameSpecifier *NNS
= TransformNestedNameSpecifier(T->getQualifier(), = TransformNestedNameSpecifier(T->getQualifier(),
@ -5139,15 +5139,15 @@ CurrentInstantiationRebuilder::TransformTypenameType(TypeLocBuilder &TLB,
NewTemplateId == QualType(TemplateId, 0)) NewTemplateId == QualType(TemplateId, 0))
Result = QualType(T, 0); Result = QualType(T, 0);
else else
Result = getDerived().RebuildTypenameType(NNS, NewTemplateId); Result = getDerived().RebuildDependentNameType(NNS, NewTemplateId);
} else } else
Result = getDerived().RebuildTypenameType(NNS, T->getIdentifier(), Result = getDerived().RebuildDependentNameType(NNS, T->getIdentifier(),
SourceRange(TL.getNameLoc())); SourceRange(TL.getNameLoc()));
if (Result.isNull()) if (Result.isNull())
return QualType(); return QualType();
TypenameTypeLoc NewTL = TLB.push<TypenameTypeLoc>(Result); DependentNameTypeLoc NewTL = TLB.push<DependentNameTypeLoc>(Result);
NewTL.setNameLoc(TL.getNameLoc()); NewTL.setNameLoc(TL.getNameLoc());
return Result; return Result;
} }
@ -5172,7 +5172,7 @@ CurrentInstantiationRebuilder::TransformTypenameType(TypeLocBuilder &TLB,
/// typename X<T>::pointer X<T>::data() { ... } /// typename X<T>::pointer X<T>::data() { ... }
/// \endcode /// \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. /// 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" /// This function will rebuild the type, performing the lookup of "pointer"
/// in X<T> and returning a QualifiedNameType whose canonical type is the same /// in X<T> and returning a QualifiedNameType whose canonical type is the same

View File

@ -773,7 +773,7 @@ DeduceTemplateArguments(Sema &S,
case Type::TypeOfExpr: case Type::TypeOfExpr:
case Type::TypeOf: case Type::TypeOf:
case Type::Typename: case Type::DependentName:
// No template argument deduction for these types // No template argument deduction for these types
return Sema::TDK_Success; return Sema::TDK_Success;
@ -2555,10 +2555,10 @@ MarkUsedTemplateParameters(Sema &SemaRef, QualType T,
OnlyDeduced, Depth, Used); OnlyDeduced, Depth, Used);
break; break;
case Type::Typename: case Type::DependentName:
if (!OnlyDeduced) if (!OnlyDeduced)
MarkUsedTemplateParameters(SemaRef, MarkUsedTemplateParameters(SemaRef,
cast<TypenameType>(T)->getQualifier(), cast<DependentNameType>(T)->getQualifier(),
OnlyDeduced, Depth, Used); OnlyDeduced, Depth, Used);
break; break;

View File

@ -1262,7 +1262,7 @@ QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S,
NestedNameSpecifier *NNSPrefix = NNS->getPrefix(); NestedNameSpecifier *NNSPrefix = NNS->getPrefix();
switch (NNS->getKind()) { switch (NNS->getKind()) {
case NestedNameSpecifier::Identifier: case NestedNameSpecifier::Identifier:
ClsType = Context.getTypenameType(NNSPrefix, NNS->getAsIdentifier()); ClsType = Context.getDependentNameType(NNSPrefix, NNS->getAsIdentifier());
break; break;
case NestedNameSpecifier::Namespace: case NestedNameSpecifier::Namespace:

View File

@ -537,15 +537,15 @@ public:
/// \brief Build a new typename type that refers to a template-id. /// \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 /// and the given type. Subclasses may override this routine to provide
/// different behavior. /// different behavior.
QualType RebuildTypenameType(NestedNameSpecifier *NNS, QualType T) { QualType RebuildDependentNameType(NestedNameSpecifier *NNS, QualType T) {
if (NNS->isDependent()) { if (NNS->isDependent()) {
CXXScopeSpec SS; CXXScopeSpec SS;
SS.setScopeRep(NNS); SS.setScopeRep(NNS);
if (!SemaRef.computeDeclContext(SS)) if (!SemaRef.computeDeclContext(SS))
return SemaRef.Context.getTypenameType(NNS, return SemaRef.Context.getDependentNameType(NNS,
cast<TemplateSpecializationType>(T)); cast<TemplateSpecializationType>(T));
} }
@ -557,7 +557,7 @@ public:
/// By default, performs semantic analysis when building the typename type /// By default, performs semantic analysis when building the typename type
/// (or qualified name type). Subclasses may override this routine to provide /// (or qualified name type). Subclasses may override this routine to provide
/// different behavior. /// different behavior.
QualType RebuildTypenameType(NestedNameSpecifier *NNS, QualType RebuildDependentNameType(NestedNameSpecifier *NNS,
const IdentifierInfo *Id, const IdentifierInfo *Id,
SourceRange SR) { SourceRange SR) {
return SemaRef.CheckTypenameType(NNS, *Id, SR); return SemaRef.CheckTypenameType(NNS, *Id, SR);
@ -2996,10 +2996,10 @@ TreeTransform<Derived>::TransformQualifiedNameType(TypeLocBuilder &TLB,
} }
template<typename Derived> template<typename Derived>
QualType TreeTransform<Derived>::TransformTypenameType(TypeLocBuilder &TLB, QualType TreeTransform<Derived>::TransformDependentNameType(TypeLocBuilder &TLB,
TypenameTypeLoc TL, DependentNameTypeLoc TL,
QualType ObjectType) { QualType ObjectType) {
TypenameType *T = TL.getTypePtr(); DependentNameType *T = TL.getTypePtr();
/* FIXME: preserve source information better than this */ /* FIXME: preserve source information better than this */
SourceRange SR(TL.getNameLoc()); SourceRange SR(TL.getNameLoc());
@ -3023,14 +3023,14 @@ QualType TreeTransform<Derived>::TransformTypenameType(TypeLocBuilder &TLB,
NewTemplateId == QualType(TemplateId, 0)) NewTemplateId == QualType(TemplateId, 0))
return QualType(T, 0); return QualType(T, 0);
Result = getDerived().RebuildTypenameType(NNS, NewTemplateId); Result = getDerived().RebuildDependentNameType(NNS, NewTemplateId);
} else { } else {
Result = getDerived().RebuildTypenameType(NNS, T->getIdentifier(), SR); Result = getDerived().RebuildDependentNameType(NNS, T->getIdentifier(), SR);
} }
if (Result.isNull()) if (Result.isNull())
return QualType(); return QualType();
TypenameTypeLoc NewTL = TLB.push<TypenameTypeLoc>(Result); DependentNameTypeLoc NewTL = TLB.push<DependentNameTypeLoc>(Result);
NewTL.setNameLoc(TL.getNameLoc()); NewTL.setNameLoc(TL.getNameLoc());
return Result; return Result;