Push nested-name-specifier source-location information into dependent
template specialization types. This also required some parser tweaks,
since we were losing track of the nested-name-specifier's source
location information in several places in the parser. Other notable
changes this required:
- Sema::ActOnTagTemplateIdType now type-checks and forms the
appropriate type nodes (+ source-location information) for an
elaborated-type-specifier ending in a template-id. Previously, we
used a combination of ActOnTemplateIdType and
ActOnTagTemplateIdType that resulted in an ElaboratedType wrapped
around a DependentTemplateSpecializationType, which duplicated the
keyword ("class", "struct", etc.) and nested-name-specifier
storage.
- Sema::ActOnTemplateIdType now gets a nested-name-specifier, which
it places into the returned type-source location information.
- Sema::ActOnDependentTag now creates types with source-location
information.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126808 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp
index 0e23e43..eef2f5e 100644
--- a/lib/Parse/ParseExprCXX.cpp
+++ b/lib/Parse/ParseExprCXX.cpp
@@ -173,7 +173,7 @@
ObjectType,
EnteringContext,
Template)) {
- if (AnnotateTemplateIdToken(Template, TNK, &SS, TemplateName,
+ if (AnnotateTemplateIdToken(Template, TNK, SS, TemplateName,
TemplateKWLoc, false))
return true;
} else
@@ -312,7 +312,7 @@
// specializations) still want to see the original template-id
// token.
ConsumeToken();
- if (AnnotateTemplateIdToken(Template, TNK, &SS, TemplateName,
+ if (AnnotateTemplateIdToken(Template, TNK, SS, TemplateName,
SourceLocation(), false))
return true;
continue;
@@ -335,7 +335,7 @@
EnteringContext, Template)) {
// Consume the identifier.
ConsumeToken();
- if (AnnotateTemplateIdToken(Template, TNK, &SS, TemplateName,
+ if (AnnotateTemplateIdToken(Template, TNK, SS, TemplateName,
SourceLocation(), false))
return true;
}
@@ -1164,7 +1164,7 @@
TemplateArgList TemplateArgs;
if (Tok.is(tok::less) &&
ParseTemplateIdAfterTemplateName(Template, Id.StartLocation,
- &SS, true, LAngleLoc,
+ SS, true, LAngleLoc,
TemplateArgs,
RAngleLoc))
return true;
@@ -1187,6 +1187,7 @@
TemplateId->TemplateNameLoc = Id.StartLocation;
}
+ TemplateId->SS = SS;
TemplateId->Template = Template;
TemplateId->Kind = TNK;
TemplateId->LAngleLoc = LAngleLoc;
@@ -1206,7 +1207,7 @@
// Constructor and destructor names.
TypeResult Type
- = Actions.ActOnTemplateIdType(Template, NameLoc,
+ = Actions.ActOnTemplateIdType(SS, Template, NameLoc,
LAngleLoc, TemplateArgsPtr,
RAngleLoc);
if (Type.isInvalid())