aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseObjc.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2008-04-14 23:36:35 +0000
committerFariborz Jahanian <fjahanian@apple.com>2008-04-14 23:36:35 +0000
commit1de1e74541c25c1a7b721f1c3991ea34c8403420 (patch)
tree4f180b647d1dedd5a8eec7ed6d66706e37be5eab /lib/Parse/ParseObjc.cpp
parent0d4e963074ad5c217a9348e9d65119ea689e545c (diff)
New AST representation for each objc2's property declaration.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49699 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseObjc.cpp')
-rw-r--r--lib/Parse/ParseObjc.cpp60
1 files changed, 26 insertions, 34 deletions
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp
index cc57bdc700..ec40e36479 100644
--- a/lib/Parse/ParseObjc.cpp
+++ b/lib/Parse/ParseObjc.cpp
@@ -248,7 +248,32 @@ void Parser::ParseObjCInterfaceDeclList(DeclTy *interfaceDecl,
if (contextKey != tok::objc_protocol)
Diag(AtLoc, diag::err_objc_protocol_optional);
} else if (ocKind == tok::objc_property) {
- allProperties.push_back(ParseObjCPropertyDecl(interfaceDecl, AtLoc));
+ ObjCDeclSpec OCDS;
+ ConsumeToken(); // the "property" identifier
+ // Parse property attribute list, if any.
+ if (Tok.is(tok::l_paren)) {
+ // property has attribute list.
+ ParseObjCPropertyAttribute(OCDS);
+ }
+ // Parse all the comma separated declarators.
+ DeclSpec DS;
+ llvm::SmallVector<FieldDeclarator, 8> FieldDeclarators;
+ ParseStructDeclaration(DS, FieldDeclarators);
+
+ if (Tok.is(tok::semi))
+ ConsumeToken();
+ else {
+ Diag(Tok, diag::err_expected_semi_decl_list);
+ SkipUntil(tok::r_brace, true, true);
+ }
+ // Convert them all to property declarations.
+ for (unsigned i = 0, e = FieldDeclarators.size(); i != e; ++i) {
+ FieldDeclarator &FD = FieldDeclarators[i];
+ // Install the property declarator into interfaceDecl.
+ DeclTy *Property = Actions.ActOnProperty(CurScope,
+ DS.getSourceRange().getBegin(), FD, OCDS);
+ allProperties.push_back(Property);
+ }
continue;
} else {
Diag(Tok, diag::err_objc_illegal_interface_qual);
@@ -370,39 +395,6 @@ void Parser::ParseObjCPropertyAttribute (ObjCDeclSpec &DS) {
}
}
-/// Main routine to parse property declaration.
-///
-/// @property property-attr-decl[opt] property-component-decl ';'
-///
-Parser::DeclTy *Parser::ParseObjCPropertyDecl(DeclTy *interfaceDecl,
- SourceLocation AtLoc) {
- assert(Tok.isObjCAtKeyword(tok::objc_property) &&
- "ParseObjCPropertyDecl(): Expected @property");
- ObjCDeclSpec OCDS;
- ConsumeToken(); // the "property" identifier
- // Parse property attribute list, if any.
- if (Tok.is(tok::l_paren)) {
- // property has attribute list.
- ParseObjCPropertyAttribute(OCDS);
- }
- // Parse declaration portion of @property.
- llvm::SmallVector<DeclTy*, 8> PropertyDecls;
-
- // Parse all the comma separated declarators.
- DeclSpec DS;
- llvm::SmallVector<FieldDeclarator, 8> FieldDeclarators;
- ParseStructDeclaration(DS, FieldDeclarators);
-
- if (Tok.is(tok::semi))
- ConsumeToken();
- else {
- Diag(Tok, diag::err_expected_semi_decl_list);
- SkipUntil(tok::r_brace, true, true);
- }
- return Actions.ActOnAddObjCProperties(CurScope, AtLoc, &FieldDeclarators[0],
- FieldDeclarators.size(), OCDS);
-}
-
/// objc-method-proto:
/// objc-instance-method objc-method-decl objc-method-attributes[opt]
/// objc-class-method objc-method-decl objc-method-attributes[opt]