[cfe-commits] r112100 - /cfe/trunk/lib/Analysis/PseudoConstantAnalysis.cpp

Tom Care tcare at apple.com
Wed Aug 25 15:46:03 PDT 2010


Author: tcare
Date: Wed Aug 25 17:46:03 2010
New Revision: 112100

URL: http://llvm.org/viewvc/llvm-project?rev=112100&view=rev
Log:
Add missing null checks in PseudoConstantAnalysis

Modified:
    cfe/trunk/lib/Analysis/PseudoConstantAnalysis.cpp

Modified: cfe/trunk/lib/Analysis/PseudoConstantAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/PseudoConstantAnalysis.cpp?rev=112100&r1=112099&r2=112100&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/PseudoConstantAnalysis.cpp (original)
+++ cfe/trunk/lib/Analysis/PseudoConstantAnalysis.cpp Wed Aug 25 17:46:03 2010
@@ -92,7 +92,6 @@
       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 @@
 
       // 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 @@
 
         // 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





More information about the cfe-commits mailing list