forked from OSchip/llvm-project
Added location for template keyword in TemplateSpecializationTypeLoc. In the process removed some naming ambiguities.
llvm-svn: 149870
This commit is contained in:
parent
7c3f09d416
commit
48c05be124
|
@ -1218,6 +1218,7 @@ struct TemplateNameLocInfo {
|
|||
};
|
||||
|
||||
struct TemplateSpecializationLocInfo : TemplateNameLocInfo {
|
||||
SourceLocation TemplateKWLoc;
|
||||
SourceLocation LAngleLoc;
|
||||
SourceLocation RAngleLoc;
|
||||
};
|
||||
|
@ -1228,6 +1229,13 @@ class TemplateSpecializationTypeLoc :
|
|||
TemplateSpecializationType,
|
||||
TemplateSpecializationLocInfo> {
|
||||
public:
|
||||
SourceLocation getTemplateKeywordLoc() const {
|
||||
return getLocalData()->TemplateKWLoc;
|
||||
}
|
||||
void setTemplateKeywordLoc(SourceLocation Loc) {
|
||||
getLocalData()->TemplateKWLoc = Loc;
|
||||
}
|
||||
|
||||
SourceLocation getLAngleLoc() const {
|
||||
return getLocalData()->LAngleLoc;
|
||||
}
|
||||
|
@ -1276,13 +1284,17 @@ public:
|
|||
}
|
||||
|
||||
SourceRange getLocalSourceRange() const {
|
||||
return SourceRange(getTemplateNameLoc(), getRAngleLoc());
|
||||
if (getTemplateKeywordLoc().isValid())
|
||||
return SourceRange(getTemplateKeywordLoc(), getRAngleLoc());
|
||||
else
|
||||
return SourceRange(getTemplateNameLoc(), getRAngleLoc());
|
||||
}
|
||||
|
||||
void initializeLocal(ASTContext &Context, SourceLocation Loc) {
|
||||
setTemplateKeywordLoc(Loc);
|
||||
setTemplateNameLoc(Loc);
|
||||
setLAngleLoc(Loc);
|
||||
setRAngleLoc(Loc);
|
||||
setTemplateNameLoc(Loc);
|
||||
initializeArgLocs(Context, getNumArgs(), getTypePtr()->getArgs(),
|
||||
getArgInfos(), Loc);
|
||||
}
|
||||
|
@ -1595,7 +1607,7 @@ public:
|
|||
};
|
||||
|
||||
struct DependentTemplateSpecializationLocInfo : DependentNameLocInfo {
|
||||
SourceLocation KeywordLoc;
|
||||
SourceLocation ElaboratedKWLoc;
|
||||
SourceLocation LAngleLoc;
|
||||
SourceLocation RAngleLoc;
|
||||
// followed by a TemplateArgumentLocInfo[]
|
||||
|
@ -1607,11 +1619,11 @@ class DependentTemplateSpecializationTypeLoc :
|
|||
DependentTemplateSpecializationType,
|
||||
DependentTemplateSpecializationLocInfo> {
|
||||
public:
|
||||
SourceLocation getKeywordLoc() const {
|
||||
return this->getLocalData()->KeywordLoc;
|
||||
SourceLocation getElaboratedKeywordLoc() const {
|
||||
return this->getLocalData()->ElaboratedKWLoc;
|
||||
}
|
||||
void setKeywordLoc(SourceLocation Loc) {
|
||||
this->getLocalData()->KeywordLoc = Loc;
|
||||
void setElaboratedKeywordLoc(SourceLocation Loc) {
|
||||
this->getLocalData()->ElaboratedKWLoc = Loc;
|
||||
}
|
||||
|
||||
NestedNameSpecifierLoc getQualifierLoc() const {
|
||||
|
@ -1638,10 +1650,10 @@ public:
|
|||
getLocalData()->QualifierData = QualifierLoc.getOpaqueData();
|
||||
}
|
||||
|
||||
SourceLocation getNameLoc() const {
|
||||
SourceLocation getTemplateNameLoc() const {
|
||||
return this->getLocalData()->NameLoc;
|
||||
}
|
||||
void setNameLoc(SourceLocation Loc) {
|
||||
void setTemplateNameLoc(SourceLocation Loc) {
|
||||
this->getLocalData()->NameLoc = Loc;
|
||||
}
|
||||
|
||||
|
@ -1675,12 +1687,12 @@ public:
|
|||
}
|
||||
|
||||
SourceRange getLocalSourceRange() const {
|
||||
if (getKeywordLoc().isValid())
|
||||
return SourceRange(getKeywordLoc(), getRAngleLoc());
|
||||
if (getElaboratedKeywordLoc().isValid())
|
||||
return SourceRange(getElaboratedKeywordLoc(), getRAngleLoc());
|
||||
else if (getQualifierLoc())
|
||||
return SourceRange(getQualifierLoc().getBeginLoc(), getRAngleLoc());
|
||||
else
|
||||
return SourceRange(getNameLoc(), getRAngleLoc());
|
||||
return SourceRange(getTemplateNameLoc(), getRAngleLoc());
|
||||
}
|
||||
|
||||
void copy(DependentTemplateSpecializationTypeLoc Loc) {
|
||||
|
|
|
@ -3974,7 +3974,7 @@ public:
|
|||
TemplateArgumentListInfo &TemplateArgs);
|
||||
|
||||
TypeResult
|
||||
ActOnTemplateIdType(CXXScopeSpec &SS,
|
||||
ActOnTemplateIdType(CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
|
||||
TemplateTy Template, SourceLocation TemplateLoc,
|
||||
SourceLocation LAngleLoc,
|
||||
ASTTemplateArgsPtr TemplateArgs,
|
||||
|
@ -3989,6 +3989,7 @@ public:
|
|||
TypeSpecifierType TagSpec,
|
||||
SourceLocation TagLoc,
|
||||
CXXScopeSpec &SS,
|
||||
SourceLocation TemplateKWLoc,
|
||||
TemplateTy TemplateD,
|
||||
SourceLocation TemplateLoc,
|
||||
SourceLocation LAngleLoc,
|
||||
|
|
|
@ -2431,6 +2431,7 @@ ASTContext::getTemplateSpecializationTypeInfo(TemplateName Name,
|
|||
TypeSourceInfo *DI = CreateTypeSourceInfo(TST);
|
||||
TemplateSpecializationTypeLoc TL
|
||||
= cast<TemplateSpecializationTypeLoc>(DI->getTypeLoc());
|
||||
TL.setTemplateKeywordLoc(SourceLocation());
|
||||
TL.setTemplateNameLoc(NameLoc);
|
||||
TL.setLAngleLoc(Args.getLAngleLoc());
|
||||
TL.setRAngleLoc(Args.getRAngleLoc());
|
||||
|
|
|
@ -272,7 +272,7 @@ void DependentNameTypeLoc::initializeLocal(ASTContext &Context,
|
|||
void
|
||||
DependentTemplateSpecializationTypeLoc::initializeLocal(ASTContext &Context,
|
||||
SourceLocation Loc) {
|
||||
setKeywordLoc(Loc);
|
||||
setElaboratedKeywordLoc(Loc);
|
||||
if (getTypePtr()->getQualifier()) {
|
||||
NestedNameSpecifierLocBuilder Builder;
|
||||
Builder.MakeTrivial(Context, getTypePtr()->getQualifier(), Loc);
|
||||
|
@ -281,7 +281,7 @@ DependentTemplateSpecializationTypeLoc::initializeLocal(ASTContext &Context,
|
|||
setQualifierLoc(NestedNameSpecifierLoc());
|
||||
}
|
||||
|
||||
setNameLoc(Loc);
|
||||
setTemplateNameLoc(Loc);
|
||||
setLAngleLoc(Loc);
|
||||
setRAngleLoc(Loc);
|
||||
TemplateSpecializationTypeLoc::initializeArgLocs(Context, getNumArgs(),
|
||||
|
|
|
@ -1182,14 +1182,14 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
|
|||
} else if (TUK == Sema::TUK_Reference ||
|
||||
(TUK == Sema::TUK_Friend &&
|
||||
TemplateInfo.Kind == ParsedTemplateInfo::NonTemplate)) {
|
||||
TypeResult = Actions.ActOnTagTemplateIdType(TUK, TagType,
|
||||
StartLoc,
|
||||
TypeResult = Actions.ActOnTagTemplateIdType(TUK, TagType, StartLoc,
|
||||
TemplateId->SS,
|
||||
TemplateId->TemplateKWLoc,
|
||||
TemplateId->Template,
|
||||
TemplateId->TemplateNameLoc,
|
||||
TemplateId->LAngleLoc,
|
||||
TemplateArgsPtr,
|
||||
TemplateId->RAngleLoc);
|
||||
TemplateId->RAngleLoc);
|
||||
} else {
|
||||
// This is an explicit specialization or a class template
|
||||
// partial specialization.
|
||||
|
|
|
@ -1654,7 +1654,8 @@ bool Parser::ParseUnqualifiedIdTemplateId(CXXScopeSpec &SS,
|
|||
|
||||
// Constructor and destructor names.
|
||||
TypeResult Type
|
||||
= Actions.ActOnTemplateIdType(SS, Template, NameLoc,
|
||||
= Actions.ActOnTemplateIdType(SS, TemplateKWLoc,
|
||||
Template, NameLoc,
|
||||
LAngleLoc, TemplateArgsPtr, RAngleLoc,
|
||||
/*IsCtorOrDtorName=*/true);
|
||||
if (Type.isInvalid())
|
||||
|
|
|
@ -798,10 +798,9 @@ bool Parser::AnnotateTemplateIdToken(TemplateTy Template, TemplateNameKind TNK,
|
|||
// Build the annotation token.
|
||||
if (TNK == TNK_Type_template && AllowTypeAnnotation) {
|
||||
TypeResult Type
|
||||
= Actions.ActOnTemplateIdType(SS,
|
||||
= Actions.ActOnTemplateIdType(SS, TemplateKWLoc,
|
||||
Template, TemplateNameLoc,
|
||||
LAngleLoc, TemplateArgsPtr,
|
||||
RAngleLoc);
|
||||
LAngleLoc, TemplateArgsPtr, RAngleLoc);
|
||||
if (Type.isInvalid()) {
|
||||
// If we failed to parse the template ID but skipped ahead to a >, we're not
|
||||
// going to be able to form a token annotation. Eat the '>' if present.
|
||||
|
@ -879,6 +878,7 @@ void Parser::AnnotateTemplateIdTokenAsType() {
|
|||
|
||||
TypeResult Type
|
||||
= Actions.ActOnTemplateIdType(TemplateId->SS,
|
||||
TemplateId->TemplateKWLoc,
|
||||
TemplateId->Template,
|
||||
TemplateId->TemplateNameLoc,
|
||||
TemplateId->LAngleLoc,
|
||||
|
|
|
@ -767,13 +767,13 @@ bool Sema::ActOnCXXNestedNameSpecifier(Scope *S,
|
|||
|
||||
// Create source-location information for this type.
|
||||
TypeLocBuilder Builder;
|
||||
DependentTemplateSpecializationTypeLoc SpecTL
|
||||
DependentTemplateSpecializationTypeLoc SpecTL
|
||||
= Builder.push<DependentTemplateSpecializationTypeLoc>(T);
|
||||
SpecTL.setElaboratedKeywordLoc(SourceLocation());
|
||||
SpecTL.setQualifierLoc(SS.getWithLocInContext(Context));
|
||||
SpecTL.setTemplateNameLoc(TemplateNameLoc);
|
||||
SpecTL.setLAngleLoc(LAngleLoc);
|
||||
SpecTL.setRAngleLoc(RAngleLoc);
|
||||
SpecTL.setKeywordLoc(SourceLocation());
|
||||
SpecTL.setNameLoc(TemplateNameLoc);
|
||||
SpecTL.setQualifierLoc(SS.getWithLocInContext(Context));
|
||||
for (unsigned I = 0, N = TemplateArgs.size(); I != N; ++I)
|
||||
SpecTL.setArgLocInfo(I, TemplateArgs[I].getLocInfo());
|
||||
|
||||
|
@ -810,15 +810,14 @@ bool Sema::ActOnCXXNestedNameSpecifier(Scope *S,
|
|||
return true;
|
||||
}
|
||||
|
||||
// Provide source-location information for the template specialization
|
||||
// type.
|
||||
// Provide source-location information for the template specialization type.
|
||||
TypeLocBuilder Builder;
|
||||
TemplateSpecializationTypeLoc SpecTL
|
||||
TemplateSpecializationTypeLoc SpecTL
|
||||
= Builder.push<TemplateSpecializationTypeLoc>(T);
|
||||
|
||||
SpecTL.setTemplateKeywordLoc(TemplateKWLoc);
|
||||
SpecTL.setTemplateNameLoc(TemplateNameLoc);
|
||||
SpecTL.setLAngleLoc(LAngleLoc);
|
||||
SpecTL.setRAngleLoc(RAngleLoc);
|
||||
SpecTL.setTemplateNameLoc(TemplateNameLoc);
|
||||
for (unsigned I = 0, N = TemplateArgs.size(); I != N; ++I)
|
||||
SpecTL.setArgLocInfo(I, TemplateArgs[I].getLocInfo());
|
||||
|
||||
|
|
|
@ -4597,6 +4597,7 @@ ExprResult Sema::ActOnPseudoDestructorExpr(Scope *S, Expr *Base,
|
|||
TemplateId->getTemplateArgs(),
|
||||
TemplateId->NumArgs);
|
||||
TypeResult T = ActOnTemplateIdType(TemplateId->SS,
|
||||
TemplateId->TemplateKWLoc,
|
||||
TemplateId->Template,
|
||||
TemplateId->TemplateNameLoc,
|
||||
TemplateId->LAngleLoc,
|
||||
|
@ -4646,6 +4647,7 @@ ExprResult Sema::ActOnPseudoDestructorExpr(Scope *S, Expr *Base,
|
|||
TemplateId->getTemplateArgs(),
|
||||
TemplateId->NumArgs);
|
||||
TypeResult T = ActOnTemplateIdType(TemplateId->SS,
|
||||
TemplateId->TemplateKWLoc,
|
||||
TemplateId->Template,
|
||||
TemplateId->TemplateNameLoc,
|
||||
TemplateId->LAngleLoc,
|
||||
|
|
|
@ -2045,7 +2045,7 @@ QualType Sema::CheckTemplateIdType(TemplateName Name,
|
|||
}
|
||||
|
||||
TypeResult
|
||||
Sema::ActOnTemplateIdType(CXXScopeSpec &SS,
|
||||
Sema::ActOnTemplateIdType(CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
|
||||
TemplateTy TemplateD, SourceLocation TemplateLoc,
|
||||
SourceLocation LAngleLoc,
|
||||
ASTTemplateArgsPtr TemplateArgsIn,
|
||||
|
@ -2070,11 +2070,11 @@ Sema::ActOnTemplateIdType(CXXScopeSpec &SS,
|
|||
TypeLocBuilder TLB;
|
||||
DependentTemplateSpecializationTypeLoc SpecTL
|
||||
= TLB.push<DependentTemplateSpecializationTypeLoc>(T);
|
||||
SpecTL.setKeywordLoc(SourceLocation());
|
||||
SpecTL.setNameLoc(TemplateLoc);
|
||||
SpecTL.setElaboratedKeywordLoc(SourceLocation());
|
||||
SpecTL.setQualifierLoc(SS.getWithLocInContext(Context));
|
||||
SpecTL.setTemplateNameLoc(TemplateLoc);
|
||||
SpecTL.setLAngleLoc(LAngleLoc);
|
||||
SpecTL.setRAngleLoc(RAngleLoc);
|
||||
SpecTL.setQualifierLoc(SS.getWithLocInContext(Context));
|
||||
for (unsigned I = 0, N = SpecTL.getNumArgs(); I != N; ++I)
|
||||
SpecTL.setArgLocInfo(I, TemplateArgs[I].getLocInfo());
|
||||
return CreateParsedType(T, TLB.getTypeSourceInfo(Context, T));
|
||||
|
@ -2087,9 +2087,10 @@ Sema::ActOnTemplateIdType(CXXScopeSpec &SS,
|
|||
return true;
|
||||
|
||||
// Build type-source information.
|
||||
TypeLocBuilder TLB;
|
||||
TypeLocBuilder TLB;
|
||||
TemplateSpecializationTypeLoc SpecTL
|
||||
= TLB.push<TemplateSpecializationTypeLoc>(Result);
|
||||
SpecTL.setTemplateKeywordLoc(TemplateKWLoc);
|
||||
SpecTL.setTemplateNameLoc(TemplateLoc);
|
||||
SpecTL.setLAngleLoc(LAngleLoc);
|
||||
SpecTL.setRAngleLoc(RAngleLoc);
|
||||
|
@ -2114,7 +2115,8 @@ TypeResult Sema::ActOnTagTemplateIdType(TagUseKind TUK,
|
|||
TypeSpecifierType TagSpec,
|
||||
SourceLocation TagLoc,
|
||||
CXXScopeSpec &SS,
|
||||
TemplateTy TemplateD,
|
||||
SourceLocation TemplateKWLoc,
|
||||
TemplateTy TemplateD,
|
||||
SourceLocation TemplateLoc,
|
||||
SourceLocation LAngleLoc,
|
||||
ASTTemplateArgsPtr TemplateArgsIn,
|
||||
|
@ -2139,12 +2141,12 @@ TypeResult Sema::ActOnTagTemplateIdType(TagUseKind TUK,
|
|||
// Build type-source information.
|
||||
TypeLocBuilder TLB;
|
||||
DependentTemplateSpecializationTypeLoc SpecTL
|
||||
= TLB.push<DependentTemplateSpecializationTypeLoc>(T);
|
||||
SpecTL.setKeywordLoc(TagLoc);
|
||||
SpecTL.setNameLoc(TemplateLoc);
|
||||
= TLB.push<DependentTemplateSpecializationTypeLoc>(T);
|
||||
SpecTL.setElaboratedKeywordLoc(TagLoc);
|
||||
SpecTL.setQualifierLoc(SS.getWithLocInContext(Context));
|
||||
SpecTL.setTemplateNameLoc(TemplateLoc);
|
||||
SpecTL.setLAngleLoc(LAngleLoc);
|
||||
SpecTL.setRAngleLoc(RAngleLoc);
|
||||
SpecTL.setQualifierLoc(SS.getWithLocInContext(Context));
|
||||
for (unsigned I = 0, N = SpecTL.getNumArgs(); I != N; ++I)
|
||||
SpecTL.setArgLocInfo(I, TemplateArgs[I].getLocInfo());
|
||||
return CreateParsedType(T, TLB.getTypeSourceInfo(Context, T));
|
||||
|
@ -2179,11 +2181,12 @@ TypeResult Sema::ActOnTagTemplateIdType(TagUseKind TUK,
|
|||
Diag(D->getLocation(), diag::note_previous_use);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Provide source-location information for the template specialization.
|
||||
TypeLocBuilder TLB;
|
||||
TemplateSpecializationTypeLoc SpecTL
|
||||
= TLB.push<TemplateSpecializationTypeLoc>(Result);
|
||||
SpecTL.setTemplateKeywordLoc(TemplateKWLoc);
|
||||
SpecTL.setTemplateNameLoc(TemplateLoc);
|
||||
SpecTL.setLAngleLoc(LAngleLoc);
|
||||
SpecTL.setRAngleLoc(RAngleLoc);
|
||||
|
@ -2191,7 +2194,7 @@ TypeResult Sema::ActOnTagTemplateIdType(TagUseKind TUK,
|
|||
SpecTL.setArgLocInfo(i, TemplateArgs[i].getLocInfo());
|
||||
|
||||
// Construct an elaborated type containing the nested-name-specifier (if any)
|
||||
// and keyword.
|
||||
// and tag keyword.
|
||||
Result = Context.getElaboratedType(Keyword, SS.getScopeRep(), Result);
|
||||
ElaboratedTypeLoc ElabTL = TLB.push<ElaboratedTypeLoc>(Result);
|
||||
ElabTL.setKeywordLoc(TagLoc);
|
||||
|
@ -6627,9 +6630,10 @@ Sema::ActOnTypenameType(Scope *S, SourceLocation TypenameLoc,
|
|||
}
|
||||
|
||||
TypeResult
|
||||
Sema::ActOnTypenameType(Scope *S, SourceLocation TypenameLoc,
|
||||
const CXXScopeSpec &SS,
|
||||
SourceLocation TemplateLoc,
|
||||
Sema::ActOnTypenameType(Scope *S,
|
||||
SourceLocation TypenameLoc,
|
||||
const CXXScopeSpec &SS,
|
||||
SourceLocation TemplateKWLoc,
|
||||
TemplateTy TemplateIn,
|
||||
SourceLocation TemplateNameLoc,
|
||||
SourceLocation LAngleLoc,
|
||||
|
@ -6661,11 +6665,11 @@ Sema::ActOnTypenameType(Scope *S, SourceLocation TypenameLoc,
|
|||
TypeLocBuilder Builder;
|
||||
DependentTemplateSpecializationTypeLoc SpecTL
|
||||
= Builder.push<DependentTemplateSpecializationTypeLoc>(T);
|
||||
SpecTL.setElaboratedKeywordLoc(TypenameLoc);
|
||||
SpecTL.setQualifierLoc(SS.getWithLocInContext(Context));
|
||||
SpecTL.setTemplateNameLoc(TemplateNameLoc);
|
||||
SpecTL.setLAngleLoc(LAngleLoc);
|
||||
SpecTL.setRAngleLoc(RAngleLoc);
|
||||
SpecTL.setKeywordLoc(TypenameLoc);
|
||||
SpecTL.setQualifierLoc(SS.getWithLocInContext(Context));
|
||||
SpecTL.setNameLoc(TemplateNameLoc);
|
||||
for (unsigned I = 0, N = TemplateArgs.size(); I != N; ++I)
|
||||
SpecTL.setArgLocInfo(I, TemplateArgs[I].getLocInfo());
|
||||
return CreateParsedType(T, Builder.getTypeSourceInfo(Context, T));
|
||||
|
@ -6675,16 +6679,14 @@ Sema::ActOnTypenameType(Scope *S, SourceLocation TypenameLoc,
|
|||
if (T.isNull())
|
||||
return true;
|
||||
|
||||
// Provide source-location information for the template specialization
|
||||
// type.
|
||||
// Provide source-location information for the template specialization type.
|
||||
TypeLocBuilder Builder;
|
||||
TemplateSpecializationTypeLoc SpecTL
|
||||
TemplateSpecializationTypeLoc SpecTL
|
||||
= Builder.push<TemplateSpecializationTypeLoc>(T);
|
||||
|
||||
// FIXME: No place to set the location of the 'template' keyword!
|
||||
SpecTL.setTemplateKeywordLoc(TemplateKWLoc);
|
||||
SpecTL.setTemplateNameLoc(TemplateNameLoc);
|
||||
SpecTL.setLAngleLoc(LAngleLoc);
|
||||
SpecTL.setRAngleLoc(RAngleLoc);
|
||||
SpecTL.setTemplateNameLoc(TemplateNameLoc);
|
||||
for (unsigned I = 0, N = TemplateArgs.size(); I != N; ++I)
|
||||
SpecTL.setArgLocInfo(I, TemplateArgs[I].getLocInfo());
|
||||
|
||||
|
|
|
@ -2960,12 +2960,12 @@ namespace {
|
|||
}
|
||||
}
|
||||
TL.initializeLocal(Context, SourceLocation());
|
||||
TL.setKeywordLoc(Keyword != ETK_None
|
||||
? DS.getTypeSpecTypeLoc()
|
||||
: SourceLocation());
|
||||
TL.setElaboratedKeywordLoc(Keyword != ETK_None
|
||||
? DS.getTypeSpecTypeLoc()
|
||||
: SourceLocation());
|
||||
const CXXScopeSpec& SS = DS.getTypeSpecScope();
|
||||
TL.setQualifierLoc(SS.getWithLocInContext(Context));
|
||||
TL.setNameLoc(DS.getTypeSpecTypeNameLoc());
|
||||
TL.setTemplateNameLoc(DS.getTypeSpecTypeNameLoc());
|
||||
}
|
||||
void VisitTagTypeLoc(TagTypeLoc TL) {
|
||||
TL.setNameLoc(DS.getTypeSpecTypeNameLoc());
|
||||
|
|
|
@ -3325,7 +3325,7 @@ TreeTransform<Derived>::TransformTypeInObjectScope(TypeLoc TL,
|
|||
TemplateName Template
|
||||
= getDerived().RebuildTemplateName(SS,
|
||||
*SpecTL.getTypePtr()->getIdentifier(),
|
||||
SpecTL.getNameLoc(),
|
||||
SpecTL.getTemplateNameLoc(),
|
||||
ObjectType, UnqualLookup);
|
||||
if (Template.isNull())
|
||||
return TypeLoc();
|
||||
|
@ -3382,7 +3382,7 @@ TreeTransform<Derived>::TransformTypeInObjectScope(TypeSourceInfo *TSInfo,
|
|||
TemplateName Template
|
||||
= getDerived().RebuildTemplateName(SS,
|
||||
*SpecTL.getTypePtr()->getIdentifier(),
|
||||
SpecTL.getNameLoc(),
|
||||
SpecTL.getTemplateNameLoc(),
|
||||
ObjectType, UnqualLookup);
|
||||
if (Template.isNull())
|
||||
return 0;
|
||||
|
@ -4590,9 +4590,9 @@ QualType TreeTransform<Derived>::TransformTemplateSpecializationType(
|
|||
if (isa<DependentTemplateSpecializationType>(Result)) {
|
||||
DependentTemplateSpecializationTypeLoc NewTL
|
||||
= TLB.push<DependentTemplateSpecializationTypeLoc>(Result);
|
||||
NewTL.setKeywordLoc(TL.getTemplateNameLoc());
|
||||
NewTL.setElaboratedKeywordLoc(SourceLocation());
|
||||
NewTL.setQualifierLoc(NestedNameSpecifierLoc());
|
||||
NewTL.setNameLoc(TL.getTemplateNameLoc());
|
||||
NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
|
||||
NewTL.setLAngleLoc(TL.getLAngleLoc());
|
||||
NewTL.setRAngleLoc(TL.getRAngleLoc());
|
||||
for (unsigned i = 0, e = NewTemplateArgs.size(); i != e; ++i)
|
||||
|
@ -4602,6 +4602,7 @@ QualType TreeTransform<Derived>::TransformTemplateSpecializationType(
|
|||
|
||||
TemplateSpecializationTypeLoc NewTL
|
||||
= TLB.push<TemplateSpecializationTypeLoc>(Result);
|
||||
NewTL.setTemplateKeywordLoc(TL.getTemplateKeywordLoc());
|
||||
NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
|
||||
NewTL.setLAngleLoc(TL.getLAngleLoc());
|
||||
NewTL.setRAngleLoc(TL.getRAngleLoc());
|
||||
|
@ -4640,10 +4641,9 @@ QualType TreeTransform<Derived>::TransformDependentTemplateSpecializationType(
|
|||
|
||||
DependentTemplateSpecializationTypeLoc NewTL
|
||||
= TLB.push<DependentTemplateSpecializationTypeLoc>(Result);
|
||||
NewTL.setKeywordLoc(TL.getKeywordLoc());
|
||||
|
||||
NewTL.setElaboratedKeywordLoc(TL.getElaboratedKeywordLoc());
|
||||
NewTL.setQualifierLoc(SS.getWithLocInContext(SemaRef.Context));
|
||||
NewTL.setNameLoc(TL.getNameLoc());
|
||||
NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
|
||||
NewTL.setLAngleLoc(TL.getLAngleLoc());
|
||||
NewTL.setRAngleLoc(TL.getRAngleLoc());
|
||||
for (unsigned i = 0, e = NewTemplateArgs.size(); i != e; ++i)
|
||||
|
@ -4653,14 +4653,15 @@ QualType TreeTransform<Derived>::TransformDependentTemplateSpecializationType(
|
|||
|
||||
QualType Result
|
||||
= getDerived().RebuildTemplateSpecializationType(Template,
|
||||
TL.getNameLoc(),
|
||||
TL.getTemplateNameLoc(),
|
||||
NewTemplateArgs);
|
||||
|
||||
if (!Result.isNull()) {
|
||||
/// FIXME: Wrap this in an elaborated-type-specifier?
|
||||
TemplateSpecializationTypeLoc NewTL
|
||||
= TLB.push<TemplateSpecializationTypeLoc>(Result);
|
||||
NewTL.setTemplateNameLoc(TL.getNameLoc());
|
||||
NewTL.setTemplateKeywordLoc(SourceLocation()); // FIXME.
|
||||
NewTL.setTemplateNameLoc(TL.getTemplateNameLoc());
|
||||
NewTL.setLAngleLoc(TL.getLAngleLoc());
|
||||
NewTL.setRAngleLoc(TL.getRAngleLoc());
|
||||
for (unsigned i = 0, e = NewTemplateArgs.size(); i != e; ++i)
|
||||
|
@ -4855,7 +4856,7 @@ TransformDependentTemplateSpecializationType(TypeLocBuilder &TLB,
|
|||
= getDerived().RebuildDependentTemplateSpecializationType(T->getKeyword(),
|
||||
QualifierLoc,
|
||||
T->getIdentifier(),
|
||||
TL.getNameLoc(),
|
||||
TL.getTemplateNameLoc(),
|
||||
NewTemplateArgs);
|
||||
if (Result.isNull())
|
||||
return QualType();
|
||||
|
@ -4866,7 +4867,8 @@ TransformDependentTemplateSpecializationType(TypeLocBuilder &TLB,
|
|||
// Copy information relevant to the template specialization.
|
||||
TemplateSpecializationTypeLoc NamedTL
|
||||
= TLB.push<TemplateSpecializationTypeLoc>(NamedT);
|
||||
NamedTL.setTemplateNameLoc(TL.getNameLoc());
|
||||
NamedTL.setTemplateKeywordLoc(SourceLocation()); // FIXME.
|
||||
NamedTL.setTemplateNameLoc(TL.getTemplateNameLoc());
|
||||
NamedTL.setLAngleLoc(TL.getLAngleLoc());
|
||||
NamedTL.setRAngleLoc(TL.getRAngleLoc());
|
||||
for (unsigned I = 0, E = NewTemplateArgs.size(); I != E; ++I)
|
||||
|
@ -4874,14 +4876,14 @@ TransformDependentTemplateSpecializationType(TypeLocBuilder &TLB,
|
|||
|
||||
// Copy information relevant to the elaborated type.
|
||||
ElaboratedTypeLoc NewTL = TLB.push<ElaboratedTypeLoc>(Result);
|
||||
NewTL.setKeywordLoc(TL.getKeywordLoc());
|
||||
NewTL.setKeywordLoc(TL.getElaboratedKeywordLoc());
|
||||
NewTL.setQualifierLoc(QualifierLoc);
|
||||
} else if (isa<DependentTemplateSpecializationType>(Result)) {
|
||||
DependentTemplateSpecializationTypeLoc SpecTL
|
||||
= TLB.push<DependentTemplateSpecializationTypeLoc>(Result);
|
||||
SpecTL.setKeywordLoc(TL.getKeywordLoc());
|
||||
SpecTL.setElaboratedKeywordLoc(TL.getElaboratedKeywordLoc());
|
||||
SpecTL.setQualifierLoc(QualifierLoc);
|
||||
SpecTL.setNameLoc(TL.getNameLoc());
|
||||
SpecTL.setTemplateNameLoc(TL.getTemplateNameLoc());
|
||||
SpecTL.setLAngleLoc(TL.getLAngleLoc());
|
||||
SpecTL.setRAngleLoc(TL.getRAngleLoc());
|
||||
for (unsigned I = 0, E = NewTemplateArgs.size(); I != E; ++I)
|
||||
|
@ -4889,7 +4891,8 @@ TransformDependentTemplateSpecializationType(TypeLocBuilder &TLB,
|
|||
} else {
|
||||
TemplateSpecializationTypeLoc SpecTL
|
||||
= TLB.push<TemplateSpecializationTypeLoc>(Result);
|
||||
SpecTL.setTemplateNameLoc(TL.getNameLoc());
|
||||
SpecTL.setTemplateKeywordLoc(SourceLocation()); // FIXME.
|
||||
SpecTL.setTemplateNameLoc(TL.getTemplateNameLoc());
|
||||
SpecTL.setLAngleLoc(TL.getLAngleLoc());
|
||||
SpecTL.setRAngleLoc(TL.getRAngleLoc());
|
||||
for (unsigned I = 0, E = NewTemplateArgs.size(); I != E; ++I)
|
||||
|
|
|
@ -4315,6 +4315,7 @@ void TypeLocReader::VisitSubstTemplateTypeParmPackTypeLoc(
|
|||
}
|
||||
void TypeLocReader::VisitTemplateSpecializationTypeLoc(
|
||||
TemplateSpecializationTypeLoc TL) {
|
||||
TL.setTemplateKeywordLoc(ReadSourceLocation(Record, Idx));
|
||||
TL.setTemplateNameLoc(ReadSourceLocation(Record, Idx));
|
||||
TL.setLAngleLoc(ReadSourceLocation(Record, Idx));
|
||||
TL.setRAngleLoc(ReadSourceLocation(Record, Idx));
|
||||
|
@ -4342,9 +4343,9 @@ void TypeLocReader::VisitDependentNameTypeLoc(DependentNameTypeLoc TL) {
|
|||
}
|
||||
void TypeLocReader::VisitDependentTemplateSpecializationTypeLoc(
|
||||
DependentTemplateSpecializationTypeLoc TL) {
|
||||
TL.setKeywordLoc(ReadSourceLocation(Record, Idx));
|
||||
TL.setElaboratedKeywordLoc(ReadSourceLocation(Record, Idx));
|
||||
TL.setQualifierLoc(Reader.ReadNestedNameSpecifierLoc(F, Record, Idx));
|
||||
TL.setNameLoc(ReadSourceLocation(Record, Idx));
|
||||
TL.setTemplateNameLoc(ReadSourceLocation(Record, Idx));
|
||||
TL.setLAngleLoc(ReadSourceLocation(Record, Idx));
|
||||
TL.setRAngleLoc(ReadSourceLocation(Record, Idx));
|
||||
for (unsigned I = 0, E = TL.getNumArgs(); I != E; ++I)
|
||||
|
|
|
@ -553,6 +553,7 @@ void TypeLocWriter::VisitSubstTemplateTypeParmPackTypeLoc(
|
|||
}
|
||||
void TypeLocWriter::VisitTemplateSpecializationTypeLoc(
|
||||
TemplateSpecializationTypeLoc TL) {
|
||||
Writer.AddSourceLocation(TL.getTemplateKeywordLoc(), Record);
|
||||
Writer.AddSourceLocation(TL.getTemplateNameLoc(), Record);
|
||||
Writer.AddSourceLocation(TL.getLAngleLoc(), Record);
|
||||
Writer.AddSourceLocation(TL.getRAngleLoc(), Record);
|
||||
|
@ -578,9 +579,9 @@ void TypeLocWriter::VisitDependentNameTypeLoc(DependentNameTypeLoc TL) {
|
|||
}
|
||||
void TypeLocWriter::VisitDependentTemplateSpecializationTypeLoc(
|
||||
DependentTemplateSpecializationTypeLoc TL) {
|
||||
Writer.AddSourceLocation(TL.getKeywordLoc(), Record);
|
||||
Writer.AddSourceLocation(TL.getElaboratedKeywordLoc(), Record);
|
||||
Writer.AddNestedNameSpecifierLoc(TL.getQualifierLoc(), Record);
|
||||
Writer.AddSourceLocation(TL.getNameLoc(), Record);
|
||||
Writer.AddSourceLocation(TL.getTemplateNameLoc(), Record);
|
||||
Writer.AddSourceLocation(TL.getLAngleLoc(), Record);
|
||||
Writer.AddSourceLocation(TL.getRAngleLoc(), Record);
|
||||
for (unsigned I = 0, E = TL.getNumArgs(); I != E; ++I)
|
||||
|
|
|
@ -183,7 +183,7 @@ SourceLocation IndexingContext::CXXBasesListInfo::getBaseLoc(
|
|||
return DL->getNameLoc();
|
||||
if (const DependentTemplateSpecializationTypeLoc *
|
||||
DTL = dyn_cast<DependentTemplateSpecializationTypeLoc>(&TL))
|
||||
return DTL->getNameLoc();
|
||||
return DTL->getTemplateNameLoc();
|
||||
|
||||
return Loc;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue