Changeset View
Changeset View
Standalone View
Standalone View
cfe/trunk/lib/Parse/ParseExprCXX.cpp
Show First 20 Lines • Show All 3,507 Lines • ▼ Show 20 Lines | Parser::ParseCXXAmbiguousParenExpression(ParenParseOption &ExprType, | ||||
} | } | ||||
Tracker.consumeClose(); | Tracker.consumeClose(); | ||||
// Consume EOF marker for Toks buffer. | // Consume EOF marker for Toks buffer. | ||||
assert(Tok.is(tok::eof) && Tok.getEofData() == AttrEnd.getEofData()); | assert(Tok.is(tok::eof) && Tok.getEofData() == AttrEnd.getEofData()); | ||||
ConsumeAnyToken(); | ConsumeAnyToken(); | ||||
return Result; | return Result; | ||||
} | } | ||||
/// Parse a __builtin_bit_cast(T, E). | |||||
ExprResult Parser::ParseBuiltinBitCast() { | |||||
SourceLocation KWLoc = ConsumeToken(); | |||||
BalancedDelimiterTracker T(*this, tok::l_paren); | |||||
if (T.expectAndConsume(diag::err_expected_lparen_after, "__builtin_bit_cast")) | |||||
return ExprError(); | |||||
// Parse the common declaration-specifiers piece. | |||||
DeclSpec DS(AttrFactory); | |||||
ParseSpecifierQualifierList(DS); | |||||
// Parse the abstract-declarator, if present. | |||||
Declarator DeclaratorInfo(DS, DeclaratorContext::TypeNameContext); | |||||
ParseDeclarator(DeclaratorInfo); | |||||
if (ExpectAndConsume(tok::comma)) { | |||||
Diag(Tok.getLocation(), diag::err_expected) << tok::comma; | |||||
SkipUntil(tok::r_paren, StopAtSemi); | |||||
return ExprError(); | |||||
} | |||||
ExprResult Operand = ParseExpression(); | |||||
if (T.consumeClose()) | |||||
return ExprError(); | |||||
if (Operand.isInvalid() || DeclaratorInfo.isInvalidType()) | |||||
return ExprError(); | |||||
return Actions.ActOnBuiltinBitCastExpr(KWLoc, DeclaratorInfo, Operand, | |||||
T.getCloseLocation()); | |||||
} |