[cfe-commits] r100496 - /cfe/trunk/lib/Sema/SemaObjCProperty.cpp

Ted Kremenek kremenek at apple.com
Mon Apr 5 16:45:09 PDT 2010


Author: kremenek
Date: Mon Apr  5 18:45:09 2010
New Revision: 100496

URL: http://llvm.org/viewvc/llvm-project?rev=100496&view=rev
Log:
Use cast<> + OpaquePtr.getAs<Decl> to add extra checking of our assumptions.

Modified:
    cfe/trunk/lib/Sema/SemaObjCProperty.cpp

Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=100496&r1=100495&r2=100496&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Mon Apr  5 18:45:09 2010
@@ -160,7 +160,7 @@
                       PIDecl->getSetterName(),
                       DeclPtrTy::make(CCPrimary), isOverridingProperty,
                       MethodImplKind);
-      PIDecl = ProtocolPtrTy.getAs<ObjCPropertyDecl>();
+      PIDecl = cast<ObjCPropertyDecl>(ProtocolPtrTy.getAs<Decl>());
     }
     PIDecl->makeitReadWriteAttribute();
     if (Attributes & ObjCDeclSpec::DQ_PR_retain)
@@ -281,7 +281,8 @@
                                             DeclPtrTy ClassCatImpDecl,
                                             IdentifierInfo *PropertyId,
                                             IdentifierInfo *PropertyIvar) {
-  ObjCContainerDecl *ClassImpDecl = ClassCatImpDecl.getAs<ObjCContainerDecl>();
+  ObjCContainerDecl *ClassImpDecl =
+    cast_or_null<ObjCContainerDecl>(ClassCatImpDecl.getAs<Decl>());
   // Make sure we have a context for the property implementation declaration.
   if (!ClassImpDecl) {
     Diag(AtLoc, diag::error_missing_property_context);





More information about the cfe-commits mailing list