Add missing null checks in PseudoConstantAnalysis

llvm-svn: 112100
This commit is contained in:
Tom Care 2010-08-25 22:46:03 +00:00
parent dffc384205
commit 9a68bccd0c
1 changed files with 4 additions and 1 deletions

View File

@ -92,7 +92,6 @@ void PseudoConstantAnalysis::RunAnalysis() {
const BinaryOperator *BO = cast<BinaryOperator>(Head); const BinaryOperator *BO = cast<BinaryOperator>(Head);
// Look for a Decl on the LHS // Look for a Decl on the LHS
const Decl *LHSDecl = getDecl(BO->getLHS()->IgnoreParenCasts()); const Decl *LHSDecl = getDecl(BO->getLHS()->IgnoreParenCasts());
if (!LHSDecl) if (!LHSDecl)
break; break;
@ -139,6 +138,8 @@ void PseudoConstantAnalysis::RunAnalysis() {
// Look for a DeclRef in the subexpression // Look for a DeclRef in the subexpression
const Decl *D = getDecl(UO->getSubExpr()->IgnoreParenCasts()); const Decl *D = getDecl(UO->getSubExpr()->IgnoreParenCasts());
if (!D)
break;
// We found a unary operator with a DeclRef as a subexpression. We now // We found a unary operator with a DeclRef as a subexpression. We now
// check for any of the increment/decrement operators, as well as // check for any of the increment/decrement operators, as well as
@ -181,6 +182,8 @@ void PseudoConstantAnalysis::RunAnalysis() {
// Try to find a Decl in the initializer // Try to find a Decl in the initializer
const Decl *D = getDecl(VD->getInit()->IgnoreParenCasts()); const Decl *D = getDecl(VD->getInit()->IgnoreParenCasts());
if (!D)
break;
// If the reference is to another var, add the var to the non-constant // If the reference is to another var, add the var to the non-constant
// list // list