return ParseCXXDeleteExpression(true, ColonColonTok.getLocation());
// Turn the qualified name into a annot_qualtypename or annot_cxxscope if
// it would be valid.
- if (TryAnnotateTypeOrScopeToken(&ColonColonTok)) {
+ if ((Tok.is(tok::identifier) || Tok.is(tok::coloncolon)) &&
+ TryAnnotateTypeOrScopeToken(&ColonColonTok)) {
// If so, retry (tail recurse).
return ParseCastExpression(isUnaryExpression);
}
bool Parser::MaybeParseCXXScopeSpecifier(CXXScopeSpec &SS,
const Token *GlobalQualifier) {
assert(getLang().CPlusPlus &&
- "Call sites of this function should be guarded by checking for C++.");
+ "Call sites of this function should be guarded by checking for C++");
if (Tok.is(tok::annot_cxxscope)) {
assert(GlobalQualifier == 0 &&
case tok::kw_operator: {
SourceLocation OperatorLoc = Tok.getLocation();
- if (OverloadedOperatorKind Op = TryParseOperatorFunctionId()) {
+ if (OverloadedOperatorKind Op = TryParseOperatorFunctionId())
return Owned(Actions.ActOnCXXOperatorFunctionIdExpr(
CurScope, OperatorLoc, Op, Tok.is(tok::l_paren), SS));
- } else if (TypeTy *Type = ParseConversionFunctionId()) {
- return Owned(Actions.ActOnCXXConversionFunctionExpr(
- CurScope, OperatorLoc, Type, Tok.is(tok::l_paren),SS));
- }
+ if (TypeTy *Type = ParseConversionFunctionId())
+ return Owned(Actions.ActOnCXXConversionFunctionExpr(CurScope, OperatorLoc,
+ Type,
+ Tok.is(tok::l_paren), SS));
// We already complained about a bad conversion-function-id,
// above.
// Parse this as a typename.
Declarator ParamDecl(DS, Declarator::TemplateParamContext);
ParseDeclarator(ParamDecl);
- if(DS.getTypeSpecType() == DeclSpec::TST_unspecified && !DS.getTypeRep()) {
+ if (DS.getTypeSpecType() == DeclSpec::TST_unspecified && !DS.getTypeRep()) {
// This probably shouldn't happen - and it's more of a Sema thing, but
// basically we didn't parse the type name because we couldn't associate
// it with an AST node. we should just skip to the comma or greater.
// Is there a default value? Parsing this can be fairly annoying because
// we have to stop on the first non-nested (paren'd) '>' as the closure
// for the template parameter list. Or a ','.
- if(Tok.is(tok::equal)) {
+ if (Tok.is(tok::equal)) {
// TODO: Implement default non-type values.
SkipUntil(tok::comma, tok::greater, true, true);
}
/// Note that this routine emits an error if you call it with ::new or ::delete
/// as the current tokens, so only call it in contexts where these are invalid.
bool Parser::TryAnnotateTypeOrScopeToken(const Token *GlobalQualifier) {
- // FIXME: what about template-ids?
- if (Tok.is(tok::annot_qualtypename) || Tok.is(tok::annot_cxxscope))
- return false;
-
+ assert((Tok.is(tok::identifier) || Tok.is(tok::coloncolon)) &&
+ "Cannot be a type or scope token!");
+
+ // FIXME: Implement template-ids
CXXScopeSpec SS;
if (getLang().CPlusPlus)
MaybeParseCXXScopeSpecifier(SS, GlobalQualifier);
bool Parser::TryAnnotateCXXScopeToken() {
assert(getLang().CPlusPlus &&
"Call sites of this function should be guarded by checking for C++");
-
- if (Tok.is(tok::annot_cxxscope))
- return false;
+ assert((Tok.is(tok::identifier) || Tok.is(tok::coloncolon)) &&
+ "Cannot be a type or scope token!");
CXXScopeSpec SS;
if (!MaybeParseCXXScopeSpecifier(SS))