aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Parse/Parser.cpp
diff options
context:
space:
mode:
authorErik Pilkington <erik.pilkington@gmail.com>2019-04-11 17:55:30 +0000
committerErik Pilkington <erik.pilkington@gmail.com>2019-04-11 17:55:30 +0000
commitc5a0583400b71f81faf9dedfaab094720c2ef823 (patch)
tree5cecf0481ac9204698f89067c5c2d680e2341c39 /clang/lib/Parse/Parser.cpp
parent7822b4618853a41aaa5ee3a7f14e0e32b1d29a64 (diff)
downloadllvm-c5a0583400b71f81faf9dedfaab094720c2ef823.zip
llvm-c5a0583400b71f81faf9dedfaab094720c2ef823.tar.gz
llvm-c5a0583400b71f81faf9dedfaab094720c2ef823.tar.bz2
Add support for attributes on @implementations in Objective-C
We want to make objc_nonlazy_class apply to implementations, but ran into this. There doesn't seem to be any reason that this isn't supported. Differential revision: https://reviews.llvm.org/D60542 llvm-svn: 358200
Diffstat (limited to 'clang/lib/Parse/Parser.cpp')
-rw-r--r--clang/lib/Parse/Parser.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp
index 9c8faae..b477e1f 100644
--- a/clang/lib/Parse/Parser.cpp
+++ b/clang/lib/Parse/Parser.cpp
@@ -980,9 +980,10 @@ Parser::ParseDeclOrFunctionDefInternal(ParsedAttributesWithRange &attrs,
if (getLangOpts().ObjC && Tok.is(tok::at)) {
SourceLocation AtLoc = ConsumeToken(); // the "@"
if (!Tok.isObjCAtKeyword(tok::objc_interface) &&
- !Tok.isObjCAtKeyword(tok::objc_protocol)) {
+ !Tok.isObjCAtKeyword(tok::objc_protocol) &&
+ !Tok.isObjCAtKeyword(tok::objc_implementation)) {
Diag(Tok, diag::err_objc_unexpected_attr);
- SkipUntil(tok::semi); // FIXME: better skip?
+ SkipUntil(tok::semi);
return nullptr;
}
@@ -997,6 +998,9 @@ Parser::ParseDeclOrFunctionDefInternal(ParsedAttributesWithRange &attrs,
if (Tok.isObjCAtKeyword(tok::objc_protocol))
return ParseObjCAtProtocolDeclaration(AtLoc, DS.getAttributes());
+ if (Tok.isObjCAtKeyword(tok::objc_implementation))
+ return ParseObjCAtImplementationDeclaration(AtLoc, DS.getAttributes());
+
return Actions.ConvertDeclToDeclGroup(
ParseObjCAtInterfaceDeclaration(AtLoc, DS.getAttributes()));
}