forked from OSchip/llvm-project
Implement parsing of casts, implementing Parser/statements.c:test6
llvm-svn: 38868
This commit is contained in:
parent
eddbcb2b12
commit
a092cd1f1b
|
@ -21,6 +21,10 @@ void Parser::ParseInitializer() {
|
||||||
// FIXME: STUB.
|
// FIXME: STUB.
|
||||||
if (Tok.getKind() == tok::l_brace) {
|
if (Tok.getKind() == tok::l_brace) {
|
||||||
ConsumeBrace();
|
ConsumeBrace();
|
||||||
|
|
||||||
|
if (Tok.getKind() == tok::numeric_constant)
|
||||||
|
ConsumeToken();
|
||||||
|
|
||||||
// FIXME: initializer-list
|
// FIXME: initializer-list
|
||||||
// Match the '}'.
|
// Match the '}'.
|
||||||
MatchRHSPunctuation(tok::r_brace, Tok.getLocation(), "{",
|
MatchRHSPunctuation(tok::r_brace, Tok.getLocation(), "{",
|
||||||
|
@ -53,7 +57,7 @@ void Parser::ParseCastExpression() {
|
||||||
if (Tok.getKind() != tok::l_paren)
|
if (Tok.getKind() != tok::l_paren)
|
||||||
return ParseUnaryExpression();
|
return ParseUnaryExpression();
|
||||||
|
|
||||||
ParenParseOption ParenExprType = CompoundLiteral;
|
ParenParseOption ParenExprType = CastExpr;
|
||||||
ParseParenExpression(ParenExprType);
|
ParseParenExpression(ParenExprType);
|
||||||
|
|
||||||
switch (ParenExprType) {
|
switch (ParenExprType) {
|
||||||
|
@ -62,7 +66,8 @@ void Parser::ParseCastExpression() {
|
||||||
case CompoundLiteral:
|
case CompoundLiteral:
|
||||||
// We parsed '(' type-name ')' '{' ... '}'. If any suffixes of
|
// We parsed '(' type-name ')' '{' ... '}'. If any suffixes of
|
||||||
// postfix-expression exist, parse them now.
|
// postfix-expression exist, parse them now.
|
||||||
assert(0 && "FIXME");
|
//Diag(Tok, diag::err_parse_error);
|
||||||
|
//assert(0 && "FIXME");
|
||||||
break;
|
break;
|
||||||
case CastExpr:
|
case CastExpr:
|
||||||
// We parsed '(' type-name ')' and the thing after it wasn't a '{'. Parse
|
// We parsed '(' type-name ')' and the thing after it wasn't a '{'. Parse
|
||||||
|
@ -70,8 +75,6 @@ void Parser::ParseCastExpression() {
|
||||||
ParseCastExpression();
|
ParseCastExpression();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// If ParenExprType could have a postfix expr after it, handle it now.
|
|
||||||
assert(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ParseUnaryExpression
|
/// ParseUnaryExpression
|
||||||
|
|
Loading…
Reference in New Issue