aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/CheckObjCDealloc.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-09-25 04:25:58 +0000
committerDouglas Gregor <dgregor@apple.com>2009-09-25 04:25:58 +0000
commitce94049b69f75b44c18584fe79cd238978b6b0d5 (patch)
treee7075c52e30004d24fb813d4847b32e6a1d9f76d /lib/Analysis/CheckObjCDealloc.cpp
parentd52025366666647e3f876e3615200dcf8c80279c (diff)
Fix checking for a null pointer constant when the expression itself is
value-dependent. Audit (and fixed) all calls to Expr::isNullPointerConstant() to provide the correct behavior with value-dependent expressions. Fixes PR5041 and a crash in libstdc++ <locale>. In the same vein, properly compute value- and type-dependence for ChooseExpr. Fixes PR4996. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82748 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CheckObjCDealloc.cpp')
-rw-r--r--lib/Analysis/CheckObjCDealloc.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Analysis/CheckObjCDealloc.cpp b/lib/Analysis/CheckObjCDealloc.cpp
index d89edff2de..92e3e112d9 100644
--- a/lib/Analysis/CheckObjCDealloc.cpp
+++ b/lib/Analysis/CheckObjCDealloc.cpp
@@ -64,7 +64,8 @@ static bool scan_ivar_release(Stmt* S, ObjCIvarDecl* ID,
if (E->getDecl()->getIdentifier() == SelfII)
if (ME->getMethodDecl() == PD->getSetterMethodDecl() &&
ME->getNumArgs() == 1 &&
- ME->getArg(0)->isNullPointerConstant(Ctx))
+ ME->getArg(0)->isNullPointerConstant(Ctx,
+ Expr::NPC_ValueDependentIsNull))
return true;
// self.myIvar = nil;
@@ -73,7 +74,8 @@ static bool scan_ivar_release(Stmt* S, ObjCIvarDecl* ID,
if (ObjCPropertyRefExpr* PRE =
dyn_cast<ObjCPropertyRefExpr>(BO->getLHS()->IgnoreParenCasts()))
if (PRE->getProperty() == PD)
- if (BO->getRHS()->isNullPointerConstant(Ctx)) {
+ if (BO->getRHS()->isNullPointerConstant(Ctx,
+ Expr::NPC_ValueDependentIsNull)) {
// This is only a 'release' if the property kind is not
// 'assign'.
return PD->getSetterKind() != ObjCPropertyDecl::Assign;;