summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaObjCProperty.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-04-05 22:39:42 +0000
committerTed Kremenek <kremenek@apple.com>2010-04-05 22:39:42 +0000
commitb535782fc44fa2e4e31476b7d0ff7e8e64092176 (patch)
treee49470389842d181eb74ad6f824d4b7b90dc4f71 /clang/lib/Sema/SemaObjCProperty.cpp
parentb7a20ee5b59f42e74728a73026e359db2de9438e (diff)
downloadbcm5719-llvm-b535782fc44fa2e4e31476b7d0ff7e8e64092176.tar.gz
bcm5719-llvm-b535782fc44fa2e4e31476b7d0ff7e8e64092176.zip
Fix possible null dereference by bailing out of CheckObjCPropertyAttributes() early if the Decl* is null.
llvm-svn: 100483
Diffstat (limited to 'clang/lib/Sema/SemaObjCProperty.cpp')
-rw-r--r--clang/lib/Sema/SemaObjCProperty.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaObjCProperty.cpp b/clang/lib/Sema/SemaObjCProperty.cpp
index 52b9bcf86c8..605750408ce 100644
--- a/clang/lib/Sema/SemaObjCProperty.cpp
+++ b/clang/lib/Sema/SemaObjCProperty.cpp
@@ -984,7 +984,10 @@ void Sema::CheckObjCPropertyAttributes(DeclPtrTy PropertyPtrTy,
unsigned &Attributes) {
// FIXME: Improve the reported location.
Decl *PDecl = PropertyPtrTy.getAs<Decl>();
- ObjCPropertyDecl *PropertyDecl = dyn_cast_or_null<ObjCPropertyDecl>(PDecl);
+ if (!PDecl)
+ return;
+
+ ObjCPropertyDecl *PropertyDecl = cast<ObjCPropertyDecl>(PDecl);
QualType PropertyTy = PropertyDecl->getType();
// readonly and readwrite/assign/retain/copy conflict.
OpenPOWER on IntegriCloud