aboutsummaryrefslogtreecommitdiff
path: root/Parse/ParseObjc.cpp
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2007-08-23 19:56:30 +0000
committerSteve Naroff <snaroff@apple.com>2007-08-23 19:56:30 +0000
commit527fe23f8cbc6a4da1737a547a2517bc92fa88c8 (patch)
tree38186c182b091c1fb0a213e8f4c5c9b895a5f87a /Parse/ParseObjc.cpp
parentb5c13b0f4e438391b31dacb87641be7a1b990b57 (diff)
- Cleanup "hack" comment and fix typos.
- Use getLang().ObjC2 when appropriate. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41333 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Parse/ParseObjc.cpp')
-rw-r--r--Parse/ParseObjc.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/Parse/ParseObjc.cpp b/Parse/ParseObjc.cpp
index 803d820b21..4b3c600794 100644
--- a/Parse/ParseObjc.cpp
+++ b/Parse/ParseObjc.cpp
@@ -122,15 +122,18 @@ Parser::DeclTy *Parser::ParseObjCAtInterfaceDeclaration(
IdentifierInfo *nameId = Tok.getIdentifierInfo();
SourceLocation nameLoc = ConsumeToken();
- if (Tok.getKind() == tok::l_paren) { // we have a category
+ if (Tok.getKind() == tok::l_paren) { // we have a category.
SourceLocation lparenLoc = ConsumeParen();
SourceLocation categoryLoc, rparenLoc;
IdentifierInfo *categoryId = 0;
- // OBJC2: The cateogry name is optional (not an error).
+ // For ObjC2, the category name is optional (not an error).
if (Tok.getKind() == tok::identifier) {
categoryId = Tok.getIdentifierInfo();
categoryLoc = ConsumeToken();
+ } else if (!getLang().ObjC2) {
+ Diag(Tok, diag::err_expected_ident); // missing category name.
+ return 0;
}
if (Tok.getKind() != tok::r_paren) {
Diag(Tok, diag::err_expected_rparen);
@@ -268,7 +271,7 @@ void Parser::ParseObjCMethodPrototype() {
ParseObjCMethodDecl(methodType, methodLoc);
// If attributes exist after the method, parse them.
- if (Tok.getKind() == tok::kw___attribute)
+ if (getLang().ObjC2 && Tok.getKind() == tok::kw___attribute)
ParseAttributes();
// Consume the ';'.
@@ -387,7 +390,7 @@ void Parser::ParseObjCMethodDecl(tok::TokenKind mType, SourceLocation mLoc) {
ParseObjCTypeName();
// If attributes exist before the argument name, parse them.
- if (Tok.getKind() == tok::kw___attribute)
+ if (getLang().ObjC2 && Tok.getKind() == tok::kw___attribute)
ParseAttributes();
if (Tok.getKind() != tok::identifier) {