aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/PseudoConstantAnalysis.cpp
diff options
context:
space:
mode:
authorTom Care <tom.care@uqconnect.edu.au>2010-08-25 22:46:03 +0000
committerTom Care <tom.care@uqconnect.edu.au>2010-08-25 22:46:03 +0000
commit916d0541fa1723e3055d78f65dede844007989c3 (patch)
tree101a8efb08db455834de9a8ce2614b870572dfe6 /lib/Analysis/PseudoConstantAnalysis.cpp
parent967fea6cd9ae60ea31d27d440967990d2c705729 (diff)
Add missing null checks in PseudoConstantAnalysis
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112100 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/PseudoConstantAnalysis.cpp')
-rw-r--r--lib/Analysis/PseudoConstantAnalysis.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Analysis/PseudoConstantAnalysis.cpp b/lib/Analysis/PseudoConstantAnalysis.cpp
index e8d056e77c..ff43fc252a 100644
--- a/lib/Analysis/PseudoConstantAnalysis.cpp
+++ b/lib/Analysis/PseudoConstantAnalysis.cpp
@@ -92,7 +92,6 @@ void PseudoConstantAnalysis::RunAnalysis() {
const BinaryOperator *BO = cast<BinaryOperator>(Head);
// Look for a Decl on the LHS
const Decl *LHSDecl = getDecl(BO->getLHS()->IgnoreParenCasts());
-
if (!LHSDecl)
break;
@@ -139,6 +138,8 @@ void PseudoConstantAnalysis::RunAnalysis() {
// Look for a DeclRef in the subexpression
const Decl *D = getDecl(UO->getSubExpr()->IgnoreParenCasts());
+ if (!D)
+ break;
// We found a unary operator with a DeclRef as a subexpression. We now
// 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
const Decl *D = getDecl(VD->getInit()->IgnoreParenCasts());
+ if (!D)
+ break;
// If the reference is to another var, add the var to the non-constant
// list