summaryrefslogtreecommitdiffstats
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
commit9a68bccd0cd5b4be2502b00ec3f755e06b7b7be8 (patch)
treea22cfe986afeba0eda7a760d5301ba2b791560bd
parentdffc384205eb02012ba6eee65f5f96e5c99a4f01 (diff)
downloadbcm5719-llvm-9a68bccd0cd5b4be2502b00ec3f755e06b7b7be8.tar.gz
bcm5719-llvm-9a68bccd0cd5b4be2502b00ec3f755e06b7b7be8.zip
Add missing null checks in PseudoConstantAnalysis
llvm-svn: 112100
-rw-r--r--clang/lib/Analysis/PseudoConstantAnalysis.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Analysis/PseudoConstantAnalysis.cpp b/clang/lib/Analysis/PseudoConstantAnalysis.cpp
index e8d056e77cd..ff43fc252aa 100644
--- a/clang/lib/Analysis/PseudoConstantAnalysis.cpp
+++ b/clang/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
OpenPOWER on IntegriCloud