]> granicus.if.org Git - clang/commitdiff
Allow properties within a protocol. The case below was asserting...now it works fine.
authorSteve Naroff <snaroff@apple.com>
Wed, 14 Nov 2007 14:15:31 +0000 (14:15 +0000)
committerSteve Naroff <snaroff@apple.com>
Wed, 14 Nov 2007 14:15:31 +0000 (14:15 +0000)
@protocol CAMediaTiming

@property int beginTime;

@end

Comments in the code tell the rest of the story...

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

Sema/SemaDecl.cpp

index 36813bafca0df3c55dfe69f0ab05b0408364979b..dc1a9935191aed96883a9f79ade3cec9cff65827 100644 (file)
@@ -1742,7 +1742,11 @@ Sema::DeclTy *Sema::ActOnField(Scope *S, DeclTy *TagDecl,
     NewFD = new FieldDecl(Loc, II, T, BitWidth);
   else if (isa<ObjcInterfaceDecl>(static_cast<Decl *>(TagDecl)) ||
            isa<ObjcImplementationDecl>(static_cast<Decl *>(TagDecl)) ||
-           isa<ObjcCategoryDecl>(static_cast<Decl *>(TagDecl)))
+           isa<ObjcCategoryDecl>(static_cast<Decl *>(TagDecl)) ||
+           // FIXME: ivars are currently used to model properties, and
+           // properties can appear within a protocol.
+           // See corresponding FIXME in DeclObjC.h:ObjcPropertyDecl.
+           isa<ObjcProtocolDecl>(static_cast<Decl *>(TagDecl)))
     NewFD = new ObjcIvarDecl(Loc, II, T);
   else
     assert(0 && "Sema::ActOnField(): Unknown TagDecl");