@@ -60,11 +60,11 @@ Parser::DeclTy *Parser::ParseNamespace(unsigned Context) {
60
60
// FIXME: save these somewhere.
61
61
AttrList = ParseAttributes ();
62
62
63
- if (Tok.is (tok::equal)) {
63
+ if (Tok.is (tok::equal))
64
64
// FIXME: Verify no attributes were present.
65
- // FIXME: parse this.
66
- } else if (Tok. is (tok::l_brace)) {
67
-
65
+ return ParseNamespaceAlias (IdentLoc, Ident);
66
+
67
+ if (Tok. is (tok::l_brace)) {
68
68
SourceLocation LBrace = ConsumeBrace ();
69
69
70
70
// Enter a scope for the namespace.
@@ -96,6 +96,37 @@ Parser::DeclTy *Parser::ParseNamespace(unsigned Context) {
96
96
return 0 ;
97
97
}
98
98
99
+ // / ParseNamespaceAlias - Parse the part after the '=' in a namespace
100
+ // / alias definition.
101
+ // /
102
+ Parser::DeclTy *Parser::ParseNamespaceAlias (SourceLocation AliasLoc,
103
+ IdentifierInfo *Alias) {
104
+ assert (Tok.is (tok::equal) && " Not equal token" );
105
+
106
+ ConsumeToken (); // eat the '='.
107
+
108
+ CXXScopeSpec SS;
109
+ // Parse (optional) nested-name-specifier.
110
+ ParseOptionalCXXScopeSpecifier (SS);
111
+
112
+ if (SS.isInvalid () || Tok.isNot (tok::identifier)) {
113
+ Diag (Tok, diag::err_expected_namespace_name);
114
+ // Skip to end of the definition and eat the ';'.
115
+ SkipUntil (tok::semi);
116
+ return 0 ;
117
+ }
118
+
119
+ // Parse identifier.
120
+ IdentifierInfo *NamespaceName = Tok.getIdentifierInfo ();
121
+ SourceLocation NamespaceLoc = ConsumeToken ();
122
+
123
+ // Eat the ';'.
124
+ ExpectAndConsume (tok::semi, diag::err_expected_semi_after,
125
+ " namespace name" , tok::semi);
126
+
127
+ return 0 ;
128
+ }
129
+
99
130
// / ParseLinkage - We know that the current token is a string_literal
100
131
// / and just before that, that extern was seen.
101
132
// /
0 commit comments