[cfe-commits] r100496 - /cfe/trunk/lib/Sema/SemaObjCProperty.cpp
Fariborz Jahanian
fjahanian at apple.com
Tue Apr 6 08:47:27 PDT 2010
On Apr 5, 2010, at 4:45 PM, Ted Kremenek wrote:
> 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>());
Is this right? Here we assume that ProtocolPtrTy.getAs<Decl>() is
never null (which may be the case).
- Fariborz
>
> }
> 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);
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list