]> granicus.if.org Git - clang/commitdiff
assert if attempting to code gen. a property setter/getter
authorFariborz Jahanian <fjahanian@apple.com>
Sat, 10 Jan 2009 00:13:01 +0000 (00:13 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Sat, 10 Jan 2009 00:13:01 +0000 (00:13 +0000)
coming from a protocol.

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

lib/CodeGen/CGObjC.cpp

index fffd011fd6b84f17a4cb5be0046537be116fdb8f..3907c0c2c082a625d40aaf2780a59ce21b7908d4 100644 (file)
@@ -143,6 +143,8 @@ void CodeGenFunction::GenerateObjCGetter(ObjCImplementationDecl *IMP,
   const ObjCPropertyDecl *PD = PID->getPropertyDecl();
   ObjCMethodDecl *OMD = PD->getGetterMethodDecl();
   assert(OMD && "Invalid call to generate getter (empty method)");
+  assert (!dyn_cast<ObjCProtocolDecl>(OMD->getDeclContext()) && 
+          "GenerateObjCMethod - cannot synthesize protocol getter");
   // FIXME: This is rather murky, we create this here since they will
   // not have been created by Sema for us.
   OMD->createImplicitParams(getContext(), IMP->getClassInterface());
@@ -213,6 +215,8 @@ void CodeGenFunction::GenerateObjCSetter(ObjCImplementationDecl *IMP,
   const ObjCPropertyDecl *PD = PID->getPropertyDecl();
   ObjCMethodDecl *OMD = PD->getSetterMethodDecl();
   assert(OMD && "Invalid call to generate setter (empty method)");
+  assert (!dyn_cast<ObjCProtocolDecl>(OMD->getDeclContext()) && 
+          "GenerateObjCSetter - cannot synthesize protocol setter");
   // FIXME: This is rather murky, we create this here since they will
   // not have been created by Sema for us.  
   OMD->createImplicitParams(getContext(), IMP->getClassInterface());