diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-01-05 01:10:06 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-01-05 01:10:06 +0000 |
commit | e6bf90aec0044342ffccd13201b8a3a31a985a4b (patch) | |
tree | e8fb1c1ff9b7756918248e4503d8ffc4bc96e3d4 /lib/Parse/ParseObjc.cpp | |
parent | 2fdc5e8199e1e239620f2faae88997153703e16f (diff) |
Use Parser::ExpectAndConsume() uniformly to eat semicolons after
Objective-C declarations and statements. Fixes
<rdar://problem/8814576> (wrong source line for diagnostics about
missing ';'), and now we actually consume the ';' at the end of a
@compatibility_alias directive!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122855 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseObjc.cpp')
-rw-r--r-- | lib/Parse/ParseObjc.cpp | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index e1c36e8eaa..2d293c5aeb 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/lib/Parse/ParseObjc.cpp @@ -1398,10 +1398,8 @@ Decl *Parser::ParseObjCAtAliasDeclaration(SourceLocation atLoc) { } IdentifierInfo *classId = Tok.getIdentifierInfo(); SourceLocation classLoc = ConsumeToken(); // consume class-name; - if (Tok.isNot(tok::semi)) { - Diag(Tok, diag::err_expected_semi_after) << "@compatibility_alias"; - return 0; - } + ExpectAndConsume(tok::semi, diag::err_expected_semi_after, + "@compatibility_alias"); return Actions.ActOnCompatiblityAlias(atLoc, aliasId, aliasLoc, classId, classLoc); } @@ -1461,12 +1459,7 @@ Decl *Parser::ParseObjCPropertySynthesize(SourceLocation atLoc) { break; ConsumeToken(); // consume ',' } - if (Tok.isNot(tok::semi)) { - Diag(Tok, diag::err_expected_semi_after) << "@synthesize"; - SkipUntil(tok::semi); - } - else - ConsumeToken(); // consume ';' + ExpectAndConsume(tok::semi, diag::err_expected_semi_after, "@synthesize"); return 0; } @@ -1502,12 +1495,7 @@ Decl *Parser::ParseObjCPropertyDynamic(SourceLocation atLoc) { break; ConsumeToken(); // consume ',' } - if (Tok.isNot(tok::semi)) { - Diag(Tok, diag::err_expected_semi_after) << "@dynamic"; - SkipUntil(tok::semi); - } - else - ConsumeToken(); // consume ';' + ExpectAndConsume(tok::semi, diag::err_expected_semi_after, "@dynamic"); return 0; } |