//===--------------------------------------------------------------------===//
// C++ 10: Derived classes [class.derived]
- TypeResult ParseBaseTypeSpecifier(SourceLocation &EndLocation,
- CXXScopeSpec &SS);
+ TypeResult ParseBaseTypeSpecifier(SourceLocation &BaseLoc,
+ SourceLocation &EndLocation);
void ParseBaseClause(Decl *ClassDecl);
BaseResult ParseBaseSpecifier(Decl *ClassDecl);
AccessSpecifier getAccessSpecifierIfPresent() const;
/// identifier
/// simple-template-id
///
-Parser::TypeResult Parser::ParseBaseTypeSpecifier(SourceLocation &EndLocation,
- CXXScopeSpec &SS) {
+Parser::TypeResult Parser::ParseBaseTypeSpecifier(SourceLocation &BaseLoc,
+ SourceLocation &EndLocation) {
+ // Parse decltype-specifier
+ if (Tok.is(tok::kw_decltype)) {
+ // Fake up a Declarator to use with ActOnTypeName.
+ DeclSpec DS(AttrFactory);
+
+ ParseDecltypeSpecifier(DS);
+ EndLocation = DS.getSourceRange().getEnd();
+
+ Declarator DeclaratorInfo(DS, Declarator::TypeNameContext);
+ return Actions.ActOnTypeName(getCurScope(), DeclaratorInfo);
+ }
+
+ // Parse optional nested-name-specifier
+ CXXScopeSpec SS;
+ ParseOptionalCXXScopeSpecifier(SS, ParsedType(), /*EnteringContext=*/false);
+
+ BaseLoc = Tok.getLocation();
+
// Check whether we have a template-id that names a type.
if (Tok.is(tok::annot_template_id)) {
TemplateIdAnnotation *TemplateId = takeTemplateIdAnnotation(Tok);
// Fall through to produce an error below.
}
- if (Tok.is(tok::kw_decltype)) {
- // Fake up a Declarator to use with ActOnTypeName.
- DeclSpec DS(AttrFactory);
-
- ParseDecltypeSpecifier(DS);
- EndLocation = DS.getSourceRange().getEnd();
-
- Declarator DeclaratorInfo(DS, Declarator::TypeNameContext);
- return Actions.ActOnTypeName(getCurScope(), DeclaratorInfo);
- }
-
if (Tok.isNot(tok::identifier)) {
Diag(Tok, diag::err_expected_class_name);
return true;
IsVirtual = true;
}
- // Parse optional '::' and optional nested-name-specifier.
- CXXScopeSpec SS;
- ParseOptionalCXXScopeSpecifier(SS, ParsedType(), /*EnteringContext=*/false);
-
- // The location of the base class itself.
- SourceLocation BaseLoc = Tok.getLocation();
-
// Parse the class-name.
SourceLocation EndLocation;
- TypeResult BaseType = ParseBaseTypeSpecifier(EndLocation, SS);
+ SourceLocation BaseLoc;
+ TypeResult BaseType = ParseBaseTypeSpecifier(BaseLoc, EndLocation);
if (BaseType.isInvalid())
return true;