summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-01-06 07:27:21 +0000
committerChris Lattner <sabre@nondot.org>2009-01-06 07:27:21 +0000
commitce1da2cfca296d27e480557df9de1b99b0c6fb11 (patch)
tree5ddb14d88e5799518e1b977f2a422005636117b3
parent8dca2e9a4e39a7076fe8e9ce2eb724a537f6b08b (diff)
downloadbcm5719-llvm-ce1da2cfca296d27e480557df9de1b99b0c6fb11.tar.gz
bcm5719-llvm-ce1da2cfca296d27e480557df9de1b99b0c6fb11.zip
- Various comment typo fixes in Sema.h
- 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. llvm-svn: 61801
-rw-r--r--clang/lib/Parse/ParseDeclCXX.cpp30
-rw-r--r--clang/lib/Sema/Sema.h8
-rw-r--r--clang/test/Parser/cxx-using-directive.cpp3
3 files changed, 20 insertions, 21 deletions
diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp
index 09c5d52c349..81ea52ca690 100644
--- a/clang/lib/Parse/ParseDeclCXX.cpp
+++ b/clang/lib/Parse/ParseDeclCXX.cpp
@@ -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);
+ IdentLoc, NamespcName, AttrList);
}
/// ParseUsingDeclaration - Parse C++ using-declaration. Assumes that
diff --git a/clang/lib/Sema/Sema.h b/clang/lib/Sema/Sema.h
index ccc6b8c4cbd..3949695e590 100644
--- a/clang/lib/Sema/Sema.h
+++ b/clang/lib/Sema/Sema.h
@@ -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.
diff --git a/clang/test/Parser/cxx-using-directive.cpp b/clang/test/Parser/cxx-using-directive.cpp
index 026ef9034b3..73f1e002c2d 100644
--- a/clang/test/Parser/cxx-using-directive.cpp
+++ b/clang/test/Parser/cxx-using-directive.cpp
@@ -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}}
OpenPOWER on IntegriCloud