]> granicus.if.org Git - clang/commitdiff
Bug fix in liveness: Only compute liveness information for VarDecls.
authorTed Kremenek <kremenek@apple.com>
Fri, 22 Feb 2008 00:34:10 +0000 (00:34 +0000)
committerTed Kremenek <kremenek@apple.com>
Fri, 22 Feb 2008 00:34:10 +0000 (00:34 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47464 91177308-0d34-0410-b5e6-96231b3b80d8

Analysis/LiveVariables.cpp

index eb1b56f37a891358c33562bc298e7e3c1460b34b..59039fb14af2c6d8ff0e2d8d4f565c02bbd83687 100644 (file)
@@ -119,12 +119,13 @@ void TransferFuncs::VisitUnaryOperator(UnaryOperator* U) {
     // Walk through the subexpressions, blasting through ParenExprs
     // until we either find a DeclRefExpr or some non-DeclRefExpr
     // expression.
-    if (DeclRefExpr* DR = dyn_cast<DeclRefExpr>(E->IgnoreParens())) {
-      // Treat the --/++/& operator as a kill.
-      LiveState(DR->getDecl(),AD) = Dead;
-      if (AD.Observer) { AD.Observer->ObserverKill(DR); }
-      return VisitDeclRefExpr(DR);
-    }
+    if (DeclRefExpr* DR = dyn_cast<DeclRefExpr>(E->IgnoreParens())) 
+      if (VarDecl* VD = dyn_cast<VarDecl>(DR->getDecl())) {        
+        // Treat the --/++/& operator as a kill.
+        LiveState(VD, AD) = Dead;
+        if (AD.Observer) { AD.Observer->ObserverKill(DR); }
+        return VisitDeclRefExpr(DR);
+      }
 
     // Fall-through.