]> granicus.if.org Git - clang/commitdiff
- Various comment typo fixes in Sema.h
authorChris Lattner <sabre@nondot.org>
Tue, 6 Jan 2009 07:27:21 +0000 (07:27 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 6 Jan 2009 07:27:21 +0000 (07:27 +0000)
- Simplify ParseDeclCXX to use early exit on error instead of nesting.
- Change ParseDeclCXX to using the 'skip on error' form of ExpectAndConsume.
- If we don't see the ; in a using directive, still call the action, for
  hopefully better error recovery.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61801 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseDeclCXX.cpp
lib/Sema/Sema.h
test/Parser/cxx-using-directive.cpp

index 09c5d52c349b7f31eeb2a7d95859c5c5f5328df0..81ea52ca690ef1d04069e263b45b564ebf2de344 100644 (file)
@@ -174,30 +174,28 @@ Parser::DeclTy *Parser::ParseUsingDirective(unsigned Context,
   SourceLocation IdentLoc = SourceLocation();
 
   // Parse namespace-name.
-  if (!SS.isInvalid() && Tok.is(tok::identifier)) {
-    // Parse identifier.
-    NamespcName = Tok.getIdentifierInfo();
-    IdentLoc = ConsumeToken();
-    // Parse (optional) attributes (most likely GNU strong-using extension)
-    if (Tok.is(tok::kw___attribute)) {
-      AttrList = ParseAttributes();
-    }
-    // Eat ';'.
-    if (ExpectAndConsume(tok::semi, diag::err_expected_semi_after,
-                     AttrList? "attributes list" : "namespace name")) {
-        SkipUntil(tok::semi);
-        return 0;
-    }
-  } else {
+  if (SS.isInvalid() || Tok.isNot(tok::identifier)) {
     Diag(Tok, diag::err_expected_namespace_name);
     // If there was invalid namespace name, skip to end of decl, and eat ';'.
     SkipUntil(tok::semi);
     // FIXME: Are there cases, when we would like to call ActOnUsingDirective?
     return 0;
   }
+  
+  // Parse identifier.
+  NamespcName = Tok.getIdentifierInfo();
+  IdentLoc = ConsumeToken();
+  
+  // Parse (optional) attributes (most likely GNU strong-using extension).
+  if (Tok.is(tok::kw___attribute))
+    AttrList = ParseAttributes();
+  
+  // Eat ';'.
+  ExpectAndConsume(tok::semi, diag::err_expected_semi_after,
+                   AttrList ? "attributes list" : "namespace name", tok::semi);
 
   return Actions.ActOnUsingDirective(CurScope, UsingLoc, NamespcLoc, SS,
-                                      IdentLoc ,NamespcName, AttrList);
+                                      IdentLocNamespcName, AttrList);
 }
 
 /// ParseUsingDeclaration - Parse C++ using-declaration. Assumes that
index ccc6b8c4cbd0a14bb5f35716b3d00036a3b0547c..3949695e590af3cb0fea8b28e73e76fe9c377cb8 100644 (file)
@@ -482,16 +482,16 @@ public:
                                       SourceLocation MemberLoc,
                                       IdentifierInfo &Member);
                                            
-  /// Helpers for dealing with function parameters
+  /// Helpers for dealing with function parameters.
   bool CheckParmsForFunctionDef(FunctionDecl *FD);
   void CheckCXXDefaultArguments(FunctionDecl *FD);
   void CheckExtraCXXDefaultArguments(Declarator &D);
 
   // FIXME: NamespaceNameOnly parameter is added temporarily
   // we will need a better way to specify lookup criteria for things
-  // like template specializations, explicit template instatatiation etc.
+  // like template specializations, explicit template instantiations, etc.
 
-  /// More parsing and symbol table subroutines...
+  /// More parsing and symbol table subroutines.
   Decl *LookupDecl(DeclarationName Name, unsigned NSI, Scope *S,
                    const DeclContext *LookupCtx = 0,
                    bool enableLazyBuiltinCreation = true,
@@ -522,7 +522,7 @@ public:
 
   NamespaceDecl *GetStdNamespace();
                            
-  /// CheckProtocolMethodDefs - This routine checks unimpletented
+  /// CheckProtocolMethodDefs - This routine checks unimplemented
   /// methods declared in protocol, and those referenced by it.
   /// \param IDecl - Used for checking for methods which may have been
   /// inherited.
index 026ef9034b3823890cf461016de835a84afe2a4c..73f1e002c2dcba9dbb71da60ee8b9c484ba7098f 100644 (file)
@@ -28,5 +28,6 @@ namespace D {
 
 using namespace ! ; // expected-error{{expected namespace name}}
 using namespace A ; // expected-error{{expected namespace name}}
-using namespace ::A B ; // expected-error{{expected ';' after namespace name}}
+using namespace ::A // expected-error{{expected namespace name}}
+                    B ; // expected-error{{expected ';' after namespace name}}