summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2008-01-02 19:17:38 +0000
committerFariborz Jahanian <fjahanian@apple.com>2008-01-02 19:17:38 +0000
commit0de2ae28c603322f05e2d9200c7d457c8b928983 (patch)
tree24ddbb2b03657619450109b4a962084e3a87e56c
parente8599e570ed55a9c170fed43e39a1e1d4c3f70a8 (diff)
downloadclang-0de2ae28c603322f05e2d9200c7d457c8b928983.tar.gz
Issue diagnostic when objective-c's @interface is preceeded by a type specifier.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45491 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--Parse/Parser.cpp3
-rw-r--r--test/Parser/check-syntax-1.m4
2 files changed, 7 insertions, 0 deletions
diff --git a/Parse/Parser.cpp b/Parse/Parser.cpp
index c5a21c72b6..04cfea6f07 100644
--- a/Parse/Parser.cpp
+++ b/Parse/Parser.cpp
@@ -379,6 +379,9 @@ Parser::DeclTy *Parser::ParseDeclarationOrFunctionDefinition() {
SkipUntil(tok::semi); // FIXME: better skip?
return 0;
}
+ const char *PrevSpec = 0;
+ if (DS.SetTypeSpecType(DeclSpec::TST_unspecified, AtLoc, PrevSpec))
+ Diag(AtLoc, diag::err_invalid_decl_spec_combination, PrevSpec);
return ParseObjCAtInterfaceDeclaration(AtLoc, DS.getAttributes());
}
diff --git a/test/Parser/check-syntax-1.m b/test/Parser/check-syntax-1.m
new file mode 100644
index 0000000000..9036c65dce
--- /dev/null
+++ b/test/Parser/check-syntax-1.m
@@ -0,0 +1,4 @@
+// RUN: clang -fsyntax-only -verify %s
+
+int @interface bla ; // expected-error {{cannot combine with previous 'int' declaration specifier}}
+@end