llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-static-analyzer-1

Author: Balazs Benics (steakhal)

<details>
<summary>Changes</summary>

This API was never used in the clang code base.
There might be downstream users, but I highly doubt that. I think the best is 
to get rid of this unused API.

---
Full diff: https://github.com/llvm/llvm-project/pull/157661.diff


2 Files Affected:

- (modified) clang/include/clang/Analysis/Analyses/LiveVariables.h (+2-7) 
- (modified) clang/lib/Analysis/LiveVariables.cpp (-33) 


``````````diff
diff --git a/clang/include/clang/Analysis/Analyses/LiveVariables.h 
b/clang/include/clang/Analysis/Analyses/LiveVariables.h
index 480a63cbb8b32..90a0f0f7dc86d 100644
--- a/clang/include/clang/Analysis/Analyses/LiveVariables.h
+++ b/clang/include/clang/Analysis/Analyses/LiveVariables.h
@@ -58,13 +58,8 @@ class LiveVariables : public ManagedAnalysis {
 
     /// A callback invoked right before invoking the
     ///  liveness transfer function on the given statement.
-    virtual void observeStmt(const Stmt *S,
-                             const CFGBlock *currentBlock,
-                             const LivenessValues& V) {}
-
-    /// Called when the live variables analysis registers
-    /// that a variable is killed.
-    virtual void observerKill(const DeclRefExpr *DR) {}
+    virtual void observeStmt(const Stmt *S, const CFGBlock *currentBlock,
+                             const LivenessValues &V) {}
   };
 
   ~LiveVariables() override;
diff --git a/clang/lib/Analysis/LiveVariables.cpp 
b/clang/lib/Analysis/LiveVariables.cpp
index dee7fb275c8f3..891e766407722 100644
--- a/clang/lib/Analysis/LiveVariables.cpp
+++ b/clang/lib/Analysis/LiveVariables.cpp
@@ -175,7 +175,6 @@ class TransferFunctions : public 
StmtVisitor<TransferFunctions> {
   void VisitDeclStmt(DeclStmt *DS);
   void VisitObjCForCollectionStmt(ObjCForCollectionStmt *OS);
   void VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *UE);
-  void VisitUnaryOperator(UnaryOperator *UO);
   void Visit(Stmt *S);
 };
 } // namespace
@@ -397,11 +396,7 @@ void TransferFunctions::VisitBinaryOperator(BinaryOperator 
*B) {
         Killed = writeShouldKill(VD);
         if (Killed)
           val.liveDecls = LV.DSetFact.remove(val.liveDecls, VD);
-
       }
-
-      if (Killed && observer)
-        observer->observerKill(DR);
     }
   }
 }
@@ -466,8 +461,6 @@ void 
TransferFunctions::VisitObjCForCollectionStmt(ObjCForCollectionStmt *OS) {
 
   if (VD) {
     val.liveDecls = LV.DSetFact.remove(val.liveDecls, VD);
-    if (observer && DR)
-      observer->observerKill(DR);
   }
 }
 
@@ -487,32 +480,6 @@ VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *UE)
   }
 }
 
-void TransferFunctions::VisitUnaryOperator(UnaryOperator *UO) {
-  // Treat ++/-- as a kill.
-  // Note we don't actually have to do anything if we don't have an observer,
-  // since a ++/-- acts as both a kill and a "use".
-  if (!observer)
-    return;
-
-  switch (UO->getOpcode()) {
-  default:
-    return;
-  case UO_PostInc:
-  case UO_PostDec:
-  case UO_PreInc:
-  case UO_PreDec:
-    break;
-  }
-
-  if (auto *DR = dyn_cast<DeclRefExpr>(UO->getSubExpr()->IgnoreParens())) {
-    const Decl *D = DR->getDecl();
-    if (isa<VarDecl>(D) || isa<BindingDecl>(D)) {
-      // Treat ++/-- as a kill.
-      observer->observerKill(DR);
-    }
-  }
-}
-
 LiveVariables::LivenessValues
 LiveVariablesImpl::runOnBlock(const CFGBlock *block,
                               LiveVariables::LivenessValues val,

``````````

</details>


https://github.com/llvm/llvm-project/pull/157661
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to