]> granicus.if.org Git - clang/commitdiff
Remove obsolete GRAuditor and GRSimpleAPICheck, which have been completely subsumed...
authorTed Kremenek <kremenek@apple.com>
Wed, 20 Oct 2010 23:48:34 +0000 (23:48 +0000)
committerTed Kremenek <kremenek@apple.com>
Wed, 20 Oct 2010 23:48:34 +0000 (23:48 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116973 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Checker/PathSensitive/GRAuditor.h [deleted file]
include/clang/Checker/PathSensitive/GRCoreEngine.h
include/clang/Checker/PathSensitive/GRExprEngine.h
include/clang/Checker/PathSensitive/GRSimpleAPICheck.h [deleted file]
lib/Checker/GRCoreEngine.cpp
lib/Checker/GRExprEngine.cpp

diff --git a/include/clang/Checker/PathSensitive/GRAuditor.h b/include/clang/Checker/PathSensitive/GRAuditor.h
deleted file mode 100644 (file)
index 015c82e..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-//==- GRAuditor.h - Observers of the creation of ExplodedNodes------*- C++ -*-//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-//  This file defines GRAuditor and its primary subclasses, an interface
-//  to audit the creation of ExplodedNodes.  This interface can be used
-//  to implement simple checkers that do not mutate analysis state but
-//  instead operate by perfoming simple logical checks at key monitoring
-//  locations (e.g., function calls).
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_ANALYSIS_GRAUDITOR
-#define LLVM_CLANG_ANALYSIS_GRAUDITOR
-
-namespace clang {
-
-class ExplodedNode;
-class GRStateManager;
-
-class GRAuditor {
-public:
-  virtual ~GRAuditor() {}
-  virtual bool Audit(ExplodedNode* N, GRStateManager& M) = 0;
-};
-
-
-} // end clang namespace
-
-#endif
index 5a5b7f22de20e75cf42d6456af6f7466b6dd10b9..a1062ac03eb38b3176e775bf1047c7b7ffdbb254 100644 (file)
@@ -19,7 +19,6 @@
 #include "clang/Checker/PathSensitive/ExplodedGraph.h"
 #include "clang/Checker/PathSensitive/GRWorkList.h"
 #include "clang/Checker/PathSensitive/GRBlockCounter.h"
-#include "clang/Checker/PathSensitive/GRAuditor.h"
 #include "clang/Checker/PathSensitive/GRSubEngine.h"
 #include "llvm/ADT/OwningPtr.h"
 
@@ -182,7 +181,6 @@ class GRStmtNodeBuilder {
   const unsigned Idx;
   ExplodedNode* Pred;
   GRStateManager& Mgr;
-  GRAuditor* Auditor;
 
 public:
   bool PurgingDeadSymbols;
@@ -273,8 +271,6 @@ public:
 
   unsigned getIndex() const { return Idx; }
 
-  void setAuditor(GRAuditor* A) { Auditor = A; }
-
   const GRState* GetState(ExplodedNode* Pred) const {
     if (Pred == getBasePredecessor())
       return CleanedState;
index 1d40e9775da3fd2dddf709a682e8d6f83cb37102..193d49baf5b5bbeb1db55f6b9bad63ae0b93f12b 100644 (file)
@@ -20,7 +20,6 @@
 #include "clang/Checker/PathSensitive/GRSubEngine.h"
 #include "clang/Checker/PathSensitive/GRCoreEngine.h"
 #include "clang/Checker/PathSensitive/GRState.h"
-#include "clang/Checker/PathSensitive/GRSimpleAPICheck.h"
 #include "clang/Checker/PathSensitive/GRTransferFuncs.h"
 #include "clang/Checker/BugReporter/BugReporter.h"
 #include "clang/AST/Type.h"
@@ -74,8 +73,6 @@ class GRExprEngine : public GRSubEngine {
   Selector* NSExceptionInstanceRaiseSelectors;
   Selector RaiseSel;
 
-  llvm::OwningPtr<GRSimpleAPICheck> BatchAuditor;
-
   enum CallbackKind {
     PreVisitStmtCallback,
     PostVisitStmtCallback,
@@ -178,9 +175,6 @@ public:
      return static_cast<CHECKER*>(lookupChecker(CHECKER::getTag()));
   }
 
-  void AddCheck(GRSimpleAPICheck* A, Stmt::StmtClass C);
-  void AddCheck(GRSimpleAPICheck* A);
-
   /// ProcessStmt - Called by GRCoreEngine. Used to generate new successor
   ///  nodes by processing the 'effects' of a block-level statement.
   void ProcessStmt(const CFGElement E, GRStmtNodeBuilder& builder);
diff --git a/include/clang/Checker/PathSensitive/GRSimpleAPICheck.h b/include/clang/Checker/PathSensitive/GRSimpleAPICheck.h
deleted file mode 100644 (file)
index 6d85e5f..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-// GRCheckAPI.h - Simple API checks based on GRAuditor ------------*- C++ -*--//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-//  This file defines the interface for building simple, path-sensitive checks
-//  that are stateless and only emit warnings at errors that occur at
-//  CallExpr or ObjCMessageExpr.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_ANALYSIS_GRAPICHECKS
-#define LLVM_CLANG_ANALYSIS_GRAPICHECKS
-
-#include "clang/Checker/PathSensitive/GRAuditor.h"
-
-namespace clang {
-
-class GRSimpleAPICheck : public GRAuditor {
-public:
-  GRSimpleAPICheck() {}
-  virtual ~GRSimpleAPICheck() {}
-};
-
-} // end namespace clang
-
-#endif
index 4ade15fe753793a03825db09341370edd33f3ecf..536c9b33ba48ac081100546aca1005b5968a3123 100644 (file)
@@ -417,7 +417,7 @@ void GRCoreEngine::GenerateNode(const ProgramPoint& Loc,
 GRStmtNodeBuilder::GRStmtNodeBuilder(const CFGBlock* b, unsigned idx,
                                      ExplodedNode* N, GRCoreEngine* e,
                                      GRStateManager &mgr)
-  : Eng(*e), B(*b), Idx(idx), Pred(N), Mgr(mgr), Auditor(0),
+  : Eng(*e), B(*b), Idx(idx), Pred(N), Mgr(mgr),
     PurgingDeadSymbols(false), BuildSinks(false), HasGeneratedNode(false),
     PointKind(ProgramPoint::PostStmtKind), Tag(0) {
   Deferred.insert(N);
@@ -468,12 +468,8 @@ ExplodedNode* GRStmtNodeBuilder::MakeNode(ExplodedNodeSet& Dst, const Stmt* S,
   if (N) {
     if (BuildSinks)
       N->markAsSink();
-    else {
-      if (Auditor && Auditor->Audit(N, Mgr))
-        N->markAsSink();
-      
+    else
       Dst.Add(N);
-    }
   }
   
   return N;
index babea205bea362384dd283d63c9424336341909c..d542c2c293f3c26857306f67827682c7e1b61626 100644 (file)
@@ -98,73 +98,6 @@ static bool CalleeReturnsReferenceOrRecord(const CallExpr *CE) {
 }
 #endif
 
-//===----------------------------------------------------------------------===//
-// Batch auditor.  DEPRECATED.
-//===----------------------------------------------------------------------===//
-
-namespace {
-
-class MappedBatchAuditor : public GRSimpleAPICheck {
-  typedef llvm::ImmutableList<GRSimpleAPICheck*> Checks;
-  typedef llvm::DenseMap<void*,Checks> MapTy;
-
-  MapTy M;
-  Checks::Factory F;
-  Checks AllStmts;
-
-public:
-  MappedBatchAuditor(llvm::BumpPtrAllocator& Alloc) :
-    F(Alloc), AllStmts(F.GetEmptyList()) {}
-
-  virtual ~MappedBatchAuditor() {
-    llvm::DenseSet<GRSimpleAPICheck*> AlreadyVisited;
-
-    for (MapTy::iterator MI = M.begin(), ME = M.end(); MI != ME; ++MI)
-      for (Checks::iterator I=MI->second.begin(), E=MI->second.end(); I!=E;++I){
-
-        GRSimpleAPICheck* check = *I;
-
-        if (AlreadyVisited.count(check))
-          continue;
-
-        AlreadyVisited.insert(check);
-        delete check;
-      }
-  }
-
-  void AddCheck(GRSimpleAPICheck *A, Stmt::StmtClass C) {
-    assert (A && "Check cannot be null.");
-    void* key = reinterpret_cast<void*>((uintptr_t) C);
-    MapTy::iterator I = M.find(key);
-    M[key] = F.Concat(A, I == M.end() ? F.GetEmptyList() : I->second);
-  }
-
-  void AddCheck(GRSimpleAPICheck *A) {
-    assert (A && "Check cannot be null.");
-    AllStmts = F.Concat(A, AllStmts);
-  }
-
-  virtual bool Audit(ExplodedNode* N, GRStateManager& VMgr) {
-    // First handle the auditors that accept all statements.
-    bool isSink = false;
-    for (Checks::iterator I = AllStmts.begin(), E = AllStmts.end(); I!=E; ++I)
-      isSink |= (*I)->Audit(N, VMgr);
-
-    // Next handle the auditors that accept only specific statements.
-    const Stmt* S = cast<PostStmt>(N->getLocation()).getStmt();
-    void* key = reinterpret_cast<void*>((uintptr_t) S->getStmtClass());
-    MapTy::iterator MI = M.find(key);
-    if (MI != M.end()) {
-      for (Checks::iterator I=MI->second.begin(), E=MI->second.end(); I!=E; ++I)
-        isSink |= (*I)->Audit(N, VMgr);
-    }
-
-    return isSink;
-  }
-};
-
-} // end anonymous namespace
-
 //===----------------------------------------------------------------------===//
 // Checker worklist routines.
 //===----------------------------------------------------------------------===//
@@ -423,20 +356,6 @@ GRExprEngine::~GRExprEngine() {
 // Utility methods.
 //===----------------------------------------------------------------------===//
 
-void GRExprEngine::AddCheck(GRSimpleAPICheck* A, Stmt::StmtClass C) {
-  if (!BatchAuditor)
-    BatchAuditor.reset(new MappedBatchAuditor(getGraph().getAllocator()));
-
-  ((MappedBatchAuditor*) BatchAuditor.get())->AddCheck(A, C);
-}
-
-void GRExprEngine::AddCheck(GRSimpleAPICheck *A) {
-  if (!BatchAuditor)
-    BatchAuditor.reset(new MappedBatchAuditor(getGraph().getAllocator()));
-
-  ((MappedBatchAuditor*) BatchAuditor.get())->AddCheck(A);
-}
-
 const GRState* GRExprEngine::getInitialState(const LocationContext *InitLoc) {
   const GRState *state = StateMgr.getInitialState(InitLoc);
 
@@ -642,10 +561,6 @@ void GRExprEngine::ProcessStmt(const CFGElement CE,GRStmtNodeBuilder& builder) {
   Builder = &builder;
   EntryNode = builder.getBasePredecessor();
 
-  // Set up our simple checks.
-  if (BatchAuditor)
-    Builder->setAuditor(BatchAuditor.get());
-
   // Create the cleaned state.
   const LocationContext *LC = EntryNode->getLocationContext();
   SymbolReaper SymReaper(LC, CurrentStmt, SymMgr);