summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Checker/CheckDeadStores.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Checker/CheckDeadStores.cpp b/clang/lib/Checker/CheckDeadStores.cpp
index 4a7ca705488..31f9390e622 100644
--- a/clang/lib/Checker/CheckDeadStores.cpp
+++ b/clang/lib/Checker/CheckDeadStores.cpp
@@ -142,7 +142,8 @@ public:
if (VarDecl *VD = dyn_cast<VarDecl>(DR->getDecl())) {
// Special case: check for assigning null to a pointer.
// This is a common form of defensive programming.
- if (VD->getType()->isPointerType()) {
+ QualType T = VD->getType();
+ if (T->isPointerType() || T->isObjCObjectPointerType()) {
if (B->getRHS()->isNullPointerConstant(Ctx,
Expr::NPC_ValueDependentIsNull))
return;
OpenPOWER on IntegriCloud