summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseObjc.cpp
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2013-04-04 00:15:10 +0000
committerNico Weber <nicolasweber@gmx.de>2013-04-04 00:15:10 +0000
commit69a7914fec813ab597d4e0d77c510fc0b0db8105 (patch)
tree56128568b6bdbe4fb07dc9fd8c141379007d275c /clang/lib/Parse/ParseObjc.cpp
parent9ff5aae5b0e6c037a87746e0fd7ae2d7f8a4024b (diff)
downloadbcm5719-llvm-69a7914fec813ab597d4e0d77c510fc0b0db8105.tar.gz
bcm5719-llvm-69a7914fec813ab597d4e0d77c510fc0b0db8105.zip
Make the ObjC attributes diagnostics a bit more informative.
llvm-svn: 178720
Diffstat (limited to 'clang/lib/Parse/ParseObjc.cpp')
-rw-r--r--clang/lib/Parse/ParseObjc.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp
index 844a3d12e93..ad95dd5821c 100644
--- a/clang/lib/Parse/ParseObjc.cpp
+++ b/clang/lib/Parse/ParseObjc.cpp
@@ -23,10 +23,14 @@
using namespace clang;
/// Skips attributes after an Objective-C @ directive. Emits a diagnostic.
-void Parser::MaybeSkipAttributes() {
+void Parser::MaybeSkipAttributes(tok::ObjCKeywordKind Kind) {
ParsedAttributes attrs(AttrFactory);
if (Tok.is(tok::kw___attribute)) {
- Diag(Tok, diag::err_objc_postfix_attribute);
+ if (Kind == tok::objc_interface || Kind == tok::objc_protocol)
+ Diag(Tok, diag::err_objc_postfix_attribute_hint)
+ << (Kind == tok::objc_protocol);
+ else
+ Diag(Tok, diag::err_objc_postfix_attribute);
ParseGNUAttributes(attrs);
}
}
@@ -101,7 +105,7 @@ Parser::ParseObjCAtClassDeclaration(SourceLocation atLoc) {
while (1) {
- MaybeSkipAttributes();
+ MaybeSkipAttributes(tok::objc_class);
if (Tok.isNot(tok::identifier)) {
Diag(Tok, diag::err_expected_ident);
SkipUntil(tok::semi);
@@ -188,7 +192,7 @@ Decl *Parser::ParseObjCAtInterfaceDeclaration(SourceLocation AtLoc,
return 0;
}
- MaybeSkipAttributes();
+ MaybeSkipAttributes(tok::objc_interface);
if (Tok.isNot(tok::identifier)) {
Diag(Tok, diag::err_expected_ident); // missing class or category name.
@@ -1408,7 +1412,7 @@ Parser::ParseObjCAtProtocolDeclaration(SourceLocation AtLoc,
return DeclGroupPtrTy();
}
- MaybeSkipAttributes();
+ MaybeSkipAttributes(tok::objc_protocol);
if (Tok.isNot(tok::identifier)) {
Diag(Tok, diag::err_expected_ident); // missing protocol name.
@@ -1501,7 +1505,7 @@ Parser::ParseObjCAtImplementationDeclaration(SourceLocation AtLoc) {
return DeclGroupPtrTy();
}
- MaybeSkipAttributes();
+ MaybeSkipAttributes(tok::objc_implementation);
if (Tok.isNot(tok::identifier)) {
Diag(Tok, diag::err_expected_ident); // missing class or category name.
OpenPOWER on IntegriCloud