[cfe-commits] r67997 - /cfe/trunk/lib/Parse/ParseDeclCXX.cpp

Chris Lattner sabre at nondot.org
Sun Mar 29 07:02:47 PDT 2009


Author: lattner
Date: Sun Mar 29 09:02:43 2009
New Revision: 67997

URL: http://llvm.org/viewvc/llvm-project?rev=67997&view=rev
Log:
reduce indentation with an early exit.

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

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

==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Sun Mar 29 09:02:43 2009
@@ -64,36 +64,34 @@
     // FIXME: Verify no attributes were present.
     return ParseNamespaceAlias(NamespaceLoc, IdentLoc, Ident);
   
-  if (Tok.is(tok::l_brace)) {
-    SourceLocation LBrace = ConsumeBrace();
+  if (Tok.isNot(tok::l_brace)) {
+    Diag(Tok, Ident ? diag::err_expected_lbrace : 
+         diag::err_expected_ident_lbrace);
+    return DeclPtrTy();
+  }
+  
+  SourceLocation LBrace = ConsumeBrace();
 
-    // Enter a scope for the namespace.
-    ParseScope NamespaceScope(this, Scope::DeclScope);
+  // Enter a scope for the namespace.
+  ParseScope NamespaceScope(this, Scope::DeclScope);
 
-    DeclPtrTy NamespcDecl =
-      Actions.ActOnStartNamespaceDef(CurScope, IdentLoc, Ident, LBrace);
+  DeclPtrTy NamespcDecl =
+    Actions.ActOnStartNamespaceDef(CurScope, IdentLoc, Ident, LBrace);
 
-    PrettyStackTraceActionsDecl CrashInfo(NamespcDecl, NamespaceLoc, Actions,
-                                          PP.getSourceManager(),
-                                          "parsing namespace");
-    
-    while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof))
-      ParseExternalDeclaration();
-    
-    // Leave the namespace scope.
-    NamespaceScope.Exit();
+  PrettyStackTraceActionsDecl CrashInfo(NamespcDecl, NamespaceLoc, Actions,
+                                        PP.getSourceManager(),
+                                        "parsing namespace");
+  
+  while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof))
+    ParseExternalDeclaration();
+  
+  // Leave the namespace scope.
+  NamespaceScope.Exit();
 
-    SourceLocation RBrace = MatchRHSPunctuation(tok::r_brace, LBrace);
-    Actions.ActOnFinishNamespaceDef(NamespcDecl, RBrace);
+  SourceLocation RBrace = MatchRHSPunctuation(tok::r_brace, LBrace);
+  Actions.ActOnFinishNamespaceDef(NamespcDecl, RBrace);
 
-    return NamespcDecl;
-    
-  } else {
-    Diag(Tok, Ident ? diag::err_expected_lbrace : 
-                      diag::err_expected_ident_lbrace);
-  }
-  
-  return DeclPtrTy();
+  return NamespcDecl;
 }
 
 /// ParseNamespaceAlias - Parse the part after the '=' in a namespace





More information about the cfe-commits mailing list