[cfe-commits] r90712 - /cfe/trunk/lib/Parse/Parser.cpp

Chris Lattner sabre at nondot.org
Sun Dec 6 10:34:27 PST 2009


Author: lattner
Date: Sun Dec  6 12:34:27 2009
New Revision: 90712

URL: http://llvm.org/viewvc/llvm-project?rev=90712&view=rev
Log:
simplify logic.

Modified:
    cfe/trunk/lib/Parse/Parser.cpp

Modified: cfe/trunk/lib/Parse/Parser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/Parser.cpp?rev=90712&r1=90711&r2=90712&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/Parser.cpp (original)
+++ cfe/trunk/lib/Parse/Parser.cpp Sun Dec  6 12:34:27 2009
@@ -507,12 +507,13 @@
 /// \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





More information about the cfe-commits mailing list