summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-01-05 01:10:06 +0000
committerDouglas Gregor <dgregor@apple.com>2011-01-05 01:10:06 +0000
commit78edf99f46c6e07631a03527610bb3d4a7551d91 (patch)
tree87989f5731e81f203da7b9344eaa5d6862708789 /clang/lib
parentd7fe9d665c66c107394e7661951c9b0186bced40 (diff)
downloadbcm5719-llvm-78edf99f46c6e07631a03527610bb3d4a7551d91.tar.gz
bcm5719-llvm-78edf99f46c6e07631a03527610bb3d4a7551d91.zip
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! llvm-svn: 122855
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Parse/ParseObjc.cpp20
1 files changed, 4 insertions, 16 deletions
diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp
index e1c36e8eaac..2d293c5aeba 100644
--- a/clang/lib/Parse/ParseObjc.cpp
+++ b/clang/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;
}
OpenPOWER on IntegriCloud