aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseDeclCXX.cpp
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
commit823c44e6d73141f642e207980b4021ddcf09897b (patch)
treee9aa917cfc4ad959b1898a0e6f1c28192c9b53e0 /lib/Parse/ParseDeclCXX.cpp
parentead013e4a89d8a51acacebe541b922b309867642 (diff)
- 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61801 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseDeclCXX.cpp')
-rw-r--r--lib/Parse/ParseDeclCXX.cpp30
1 files changed, 14 insertions, 16 deletions
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp
index 09c5d52c34..81ea52ca69 100644
--- a/lib/Parse/ParseDeclCXX.cpp
+++ b/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