]> granicus.if.org Git - clang/commitdiff
Fixed a parsing bug whereby @optional/@required keyword is not followed by
authorFariborz Jahanian <fjahanian@apple.com>
Tue, 11 Dec 2007 18:34:51 +0000 (18:34 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Tue, 11 Dec 2007 18:34:51 +0000 (18:34 +0000)
a method declaration.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44870 91177308-0d34-0410-b5e6-96231b3b80d8

Parse/ParseObjc.cpp
test/Parser/enhanced-proto-1.m [new file with mode: 0644]

index 88be2dc5fb7cccfdb1517136c17c09f0d2eb97cc..05cbabd67c5afd3a81eb2543526ab54aa6af463a 100644 (file)
@@ -264,6 +264,9 @@ void Parser::ParseObjCInterfaceDeclList(DeclTy *interfaceDecl,
       ExpectAndConsume(tok::semi, diag::err_expected_semi_after,"method proto");
       continue;
     }
+    else if (Tok.is(tok::at))
+      continue;
+    
     if (Tok.is(tok::semi))
       ConsumeToken();
     else if (Tok.is(tok::eof))
diff --git a/test/Parser/enhanced-proto-1.m b/test/Parser/enhanced-proto-1.m
new file mode 100644 (file)
index 0000000..354502e
--- /dev/null
@@ -0,0 +1,17 @@
+// RUN: clang -fsyntax-only -verify %s
+
+@protocol MyProto1 
+@optional
+- (void) FOO;
+@optional
+- (void) FOO;
+@required 
+- (void) REQ;
+@optional
+@end
+
+@protocol  MyProto2 <MyProto1>
+- (void) FOO2;
+@optional
+- (void) FOO3;
+@end