]> granicus.if.org Git - clang/commitdiff
Diagnose a coherant message when @interface
authorFariborz Jahanian <fjahanian@apple.com>
Tue, 2 Nov 2010 00:44:43 +0000 (00:44 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Tue, 2 Nov 2010 00:44:43 +0000 (00:44 +0000)
does not terminate with @end.
// rdar: //7824372

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

lib/Parse/ParseObjc.cpp
test/Parser/missing-end-2.m [new file with mode: 0644]

index f54c3eef07982aa0a9f785c4fdd926228265d90b..a8f5e222dc8eaa5159862e442ce77cf8eb2d36c8 100644 (file)
@@ -402,7 +402,12 @@ void Parser::ParseObjCInterfaceDeclList(Decl *interfaceDecl,
       // Skip until we see an '@' or '}' or ';'.
       SkipUntil(tok::r_brace, tok::at);
       break;
-
+        
+    case tok::objc_implementation:
+      Diag(Tok, diag::err_objc_missing_end);
+      ConsumeToken();
+      break;
+        
     case tok::objc_required:
     case tok::objc_optional:
       // This is only valid on protocols.
diff --git a/test/Parser/missing-end-2.m b/test/Parser/missing-end-2.m
new file mode 100644 (file)
index 0000000..63dc965
--- /dev/null
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar: //7824372
+
+@interface A
+-(void) im0;
+
+@implementation A // expected-error {{missing @end}}
+@end
+
+@interface B {
+}
+
+@implementation B // expected-error {{missing @end}}
+@end
+
+@interface C
+@property int P;
+
+@implementation C // expected-error 2 {{missing @end}}