[cfe-commits] r116973 - in /cfe/trunk: include/clang/Checker/PathSensitive/GRAuditor.h include/clang/Checker/PathSensitive/GRCoreEngine.h include/clang/Checker/PathSensitive/GRExprEngine.h include/clang/Checker/PathSensitive/GRSimpleAPICheck.h lib/Checker/GRCoreEngine.cpp lib/Checker/GRExprEngine.cpp
Ted Kremenek
kremenek at apple.com
Wed Oct 20 16:48:34 PDT 2010
Author: kremenek
Date: Wed Oct 20 18:48:34 2010
New Revision: 116973
URL: http://llvm.org/viewvc/llvm-project?rev=116973&view=rev
Log:
Remove obsolete GRAuditor and GRSimpleAPICheck, which have been completely subsumed by the Checker interface.
Removed:
cfe/trunk/include/clang/Checker/PathSensitive/GRAuditor.h
cfe/trunk/include/clang/Checker/PathSensitive/GRSimpleAPICheck.h
Modified:
cfe/trunk/include/clang/Checker/PathSensitive/GRCoreEngine.h
cfe/trunk/include/clang/Checker/PathSensitive/GRExprEngine.h
cfe/trunk/lib/Checker/GRCoreEngine.cpp
cfe/trunk/lib/Checker/GRExprEngine.cpp
Removed: cfe/trunk/include/clang/Checker/PathSensitive/GRAuditor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Checker/PathSensitive/GRAuditor.h?rev=116972&view=auto
==============================================================================
--- cfe/trunk/include/clang/Checker/PathSensitive/GRAuditor.h (original)
+++ cfe/trunk/include/clang/Checker/PathSensitive/GRAuditor.h (removed)
@@ -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
Modified: cfe/trunk/include/clang/Checker/PathSensitive/GRCoreEngine.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Checker/PathSensitive/GRCoreEngine.h?rev=116973&r1=116972&r2=116973&view=diff
==============================================================================
--- cfe/trunk/include/clang/Checker/PathSensitive/GRCoreEngine.h (original)
+++ cfe/trunk/include/clang/Checker/PathSensitive/GRCoreEngine.h Wed Oct 20 18:48:34 2010
@@ -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 @@
const unsigned Idx;
ExplodedNode* Pred;
GRStateManager& Mgr;
- GRAuditor* Auditor;
public:
bool PurgingDeadSymbols;
@@ -273,8 +271,6 @@
unsigned getIndex() const { return Idx; }
- void setAuditor(GRAuditor* A) { Auditor = A; }
-
const GRState* GetState(ExplodedNode* Pred) const {
if (Pred == getBasePredecessor())
return CleanedState;
Modified: cfe/trunk/include/clang/Checker/PathSensitive/GRExprEngine.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Checker/PathSensitive/GRExprEngine.h?rev=116973&r1=116972&r2=116973&view=diff
==============================================================================
--- cfe/trunk/include/clang/Checker/PathSensitive/GRExprEngine.h (original)
+++ cfe/trunk/include/clang/Checker/PathSensitive/GRExprEngine.h Wed Oct 20 18:48:34 2010
@@ -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 @@
Selector* NSExceptionInstanceRaiseSelectors;
Selector RaiseSel;
- llvm::OwningPtr<GRSimpleAPICheck> BatchAuditor;
-
enum CallbackKind {
PreVisitStmtCallback,
PostVisitStmtCallback,
@@ -178,9 +175,6 @@
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);
Removed: cfe/trunk/include/clang/Checker/PathSensitive/GRSimpleAPICheck.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Checker/PathSensitive/GRSimpleAPICheck.h?rev=116972&view=auto
==============================================================================
--- cfe/trunk/include/clang/Checker/PathSensitive/GRSimpleAPICheck.h (original)
+++ cfe/trunk/include/clang/Checker/PathSensitive/GRSimpleAPICheck.h (removed)
@@ -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
Modified: cfe/trunk/lib/Checker/GRCoreEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/GRCoreEngine.cpp?rev=116973&r1=116972&r2=116973&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/GRCoreEngine.cpp (original)
+++ cfe/trunk/lib/Checker/GRCoreEngine.cpp Wed Oct 20 18:48:34 2010
@@ -417,7 +417,7 @@
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 @@
if (N) {
if (BuildSinks)
N->markAsSink();
- else {
- if (Auditor && Auditor->Audit(N, Mgr))
- N->markAsSink();
-
+ else
Dst.Add(N);
- }
}
return N;
Modified: cfe/trunk/lib/Checker/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/GRExprEngine.cpp?rev=116973&r1=116972&r2=116973&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/GRExprEngine.cpp (original)
+++ cfe/trunk/lib/Checker/GRExprEngine.cpp Wed Oct 20 18:48:34 2010
@@ -99,73 +99,6 @@
#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 @@
// 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 @@
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);
More information about the cfe-commits
mailing list