simplify logic.

llvm-svn: 90712
This commit is contained in:
Chris Lattner 2009-12-06 18:34:27 +00:00
parent 3efc6e6f46
commit 8c56c49fe0
1 changed files with 7 additions and 6 deletions

View File

@ -507,12 +507,13 @@ bool Parser::isDeclarationAfterDeclarator() {
/// \brief Determine whether the current token, if it occurs after a
/// declarator, indicates the start of a function definition.
bool Parser::isStartOfFunctionDefinition() {
return Tok.is(tok::l_brace) || // int X() {}
(!getLang().CPlusPlus &&
isDeclarationSpecifier()) || // int X(f) int f; {}
(getLang().CPlusPlus &&
(Tok.is(tok::colon) || // X() : Base() {} (used for ctors)
Tok.is(tok::kw_try))); // X() try { ... }
if (Tok.is(tok::l_brace)) // int X() {}
return true;
if (!getLang().CPlusPlus)
return isDeclarationSpecifier(); // int X(f) int f; {}
return Tok.is(tok::colon) || // X() : Base() {} (used for ctors)
Tok.is(tok::kw_try); // X() try { ... }
}
/// ParseDeclarationOrFunctionDefinition - Parse either a function-definition or