r342765 - [analyzer] [NFC] Dead code removal

George Karpenkov via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 21 13:35:39 PDT 2018


Author: george.karpenkov
Date: Fri Sep 21 13:35:39 2018
New Revision: 342765

URL: http://llvm.org/viewvc/llvm-project?rev=342765&view=rev
Log:
[analyzer] [NFC] Dead code removal

Differential Revision: https://reviews.llvm.org/D52269

Modified:
    cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h
    cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
    cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
    cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
    cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h?rev=342765&r1=342764&r2=342765&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h Fri Sep 21 13:35:39 2018
@@ -65,8 +65,6 @@ public:
   ///  by a sink node.
   bool isSuppressOnSink() const { return SuppressOnSink; }
   void setSuppressOnSink(bool x) { SuppressOnSink = x; }
-
-  virtual void FlushReports(BugReporter& BR);
 };
 
 class BuiltinBug : public BugType {

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h?rev=342765&r1=342764&r2=342765&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h Fri Sep 21 13:35:39 2018
@@ -162,10 +162,6 @@ public:
     return getSValBuilder().getSymbolManager();
   }
 
-  bool isObjCGCEnabled() const {
-    return Eng.isObjCGCEnabled();
-  }
-
   ProgramStateManager &getStateManager() {
     return Eng.getStateManager();
   }

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h?rev=342765&r1=342764&r2=342765&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h Fri Sep 21 13:35:39 2018
@@ -141,9 +141,6 @@ private:
   /// implicitly never returns.
   ObjCNoReturn ObjCNoRet;
 
-  /// Whether or not GC is enabled in this analysis.
-  bool ObjCGCEnabled;
-
   /// The BugReporter associated with this engine.  It is important that
   ///  this object be placed at the very end of member variables so that its
   ///  destructor is called before the rest of the ExprEngine is destroyed.
@@ -201,8 +198,6 @@ public:
     return *currBldrCtx;
   }
 
-  bool isObjCGCEnabled() { return ObjCGCEnabled; }
-
   const Stmt *getStmt() const;
 
   void GenerateAutoTransition(ExplodedNode *N);

Modified: cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp?rev=342765&r1=342764&r2=342765&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp Fri Sep 21 13:35:39 2018
@@ -2023,8 +2023,6 @@ static std::unique_ptr<PathDiagnostic> g
 
 void BugType::anchor() {}
 
-void BugType::FlushReports(BugReporter &BR) {}
-
 void BuiltinBug::anchor() {}
 
 //===----------------------------------------------------------------------===//
@@ -2253,14 +2251,6 @@ void BugReporter::FlushReports() {
   if (BugTypes.isEmpty())
     return;
 
-  // First flush the warnings for each BugType.  This may end up creating new
-  // warnings and new BugTypes.
-  // FIXME: Only NSErrorChecker needs BugType's FlushReports.
-  // Turn NSErrorChecker into a proper checker and remove this.
-  SmallVector<const BugType *, 16> bugTypes(BugTypes.begin(), BugTypes.end());
-  for (const auto I : bugTypes)
-    const_cast<BugType*>(I)->FlushReports(*this);
-
   // We need to flush reports in deterministic order to ensure the order
   // of the reports is consistent between runs.
   for (const auto EQ : EQClassesVector)

Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp?rev=342765&r1=342764&r2=342765&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp Fri Sep 21 13:35:39 2018
@@ -189,7 +189,7 @@ ExprEngine::ExprEngine(cross_tu::CrossTr
                this),
       SymMgr(StateMgr.getSymbolManager()),
       svalBuilder(StateMgr.getSValBuilder()), ObjCNoRet(mgr.getASTContext()),
-      ObjCGCEnabled(gcEnabled), BR(mgr, *this),
+      BR(mgr, *this),
       VisitedCallees(VisitedCalleesIn), HowToInline(HowToInlineIn) {
   unsigned TrimInterval = mgr.options.getGraphTrimInterval();
   if (TrimInterval != 0) {
@@ -3184,11 +3184,6 @@ void ExprEngine::ViewGraph(bool trim) {
   if (trim) {
     std::vector<const ExplodedNode *> Src;
 
-    // Flush any outstanding reports to make sure we cover all the nodes.
-    // This does not cause them to get displayed.
-    for (const auto I : BR)
-      const_cast<BugType *>(I)->FlushReports(BR);
-
     // Iterate through the reports and get their nodes.
     for (BugReporter::EQClasses_iterator
            EI = BR.EQClasses_begin(), EE = BR.EQClasses_end(); EI != EE; ++EI) {




More information about the cfe-commits mailing list