#include "clang/Basic/FileManager.h"
#include "clang/Basic/SourceManager.h"
#include "clang/GR/PathSensitive/AnalysisManager.h"
-#include "clang/GR/PathSensitive/GRExprEngine.h"
-#include "clang/GR/PathSensitive/GRTransferFuncs.h"
+#include "clang/GR/PathSensitive/ExprEngine.h"
+#include "clang/GR/PathSensitive/TransferFuncs.h"
#include "clang/GR/Checkers/LocalCheckers.h"
#include "clang/Frontend/ASTUnit.h"
#include "clang/Frontend/CompilerInstance.h"
/* TrimGraph */ false, /* InlineCall */ true,
/* UseUnoptimizedCFG */ false);
- GRTransferFuncs* TF = MakeCFRefCountTF(AMgr.getASTContext(), /*GC*/false,
+ TransferFuncs* TF = MakeCFRefCountTF(AMgr.getASTContext(), /*GC*/false,
AMgr.getLangOptions());
- GRExprEngine Eng(AMgr, TF);
+ ExprEngine Eng(AMgr, TF);
Eng.ExecuteWorkList(AMgr.getStackFrame(FD, TU), AMgr.getMaxNodes());
class ExplodedGraph;
class BugReporter;
class BugReporterContext;
-class GRExprEngine;
+class ExprEngine;
class GRState;
class BugType;
// FIXME: Get rid of GRBugReporter. It's the wrong abstraction.
class GRBugReporter : public BugReporter {
- GRExprEngine& Eng;
+ ExprEngine& Eng;
llvm::SmallSet<SymbolRef, 10> NotableSymbols;
public:
- GRBugReporter(BugReporterData& d, GRExprEngine& eng)
+ GRBugReporter(BugReporterData& d, ExprEngine& eng)
: BugReporter(d, GRBugReporterKind), Eng(eng) {}
virtual ~GRBugReporter();
/// getEngine - Return the analysis engine used to analyze a given
/// function or method.
- GRExprEngine &getEngine() { return Eng; }
+ ExprEngine &getEngine() { return Eng; }
/// getGraph - Get the exploded graph created by the analysis engine
/// for the analyzed method or function.
namespace GR {
class ExplodedNode;
-class GRExprEngine;
+class ExprEngine;
class BugType {
private:
//===----------------------------------------------------------------------===//
//
// This defines NullDerefChecker and UndefDerefChecker, two builtin checks
-// in GRExprEngine that check for null and undefined pointers at loads
+// in ExprEngine that check for null and undefined pointers at loads
// and stores.
//
//===----------------------------------------------------------------------===//
namespace GR {
-class GRExprEngine;
+class ExprEngine;
class ExplodedNode;
std::pair<ExplodedNode * const *, ExplodedNode * const *>
-GetImplicitNullDereferences(GRExprEngine &Eng);
+GetImplicitNullDereferences(ExprEngine &Eng);
} // end GR namespace
namespace GR {
class PathDiagnosticClient;
-class GRTransferFuncs;
+class TransferFuncs;
class BugType;
class BugReporter;
-class GRExprEngine;
+class ExprEngine;
void CheckDeadStores(CFG &cfg, LiveVariables &L, ParentMap &map,
BugReporter& BR);
-GRTransferFuncs* MakeCFRefCountTF(ASTContext& Ctx, bool GCEnabled,
+TransferFuncs* MakeCFRefCountTF(ASTContext& Ctx, bool GCEnabled,
const LangOptions& lopts);
void CheckObjCDealloc(const ObjCImplementationDecl* D, const LangOptions& L,
void CheckObjCUnusedIvar(const ObjCImplementationDecl *D, BugReporter& BR);
-void RegisterAppleChecks(GRExprEngine& Eng, const Decl &D);
-void RegisterExperimentalChecks(GRExprEngine &Eng);
-void RegisterExperimentalInternalChecks(GRExprEngine &Eng);
+void RegisterAppleChecks(ExprEngine& Eng, const Decl &D);
+void RegisterExperimentalChecks(ExprEngine &Eng);
+void RegisterExperimentalInternalChecks(ExprEngine &Eng);
void CheckLLVMConventions(TranslationUnitDecl &TU, BugReporter &BR);
void CheckSecuritySyntaxOnly(const Decl *D, BugReporter &BR);
void CheckSizeofPointer(const Decl *D, BugReporter &BR);
-void RegisterCallInliner(GRExprEngine &Eng);
+void RegisterCallInliner(ExprEngine &Eng);
} // end GR namespace
//===----------------------------------------------------------------------===//
//
// This file defines BasicValueFactory, a class that manages the lifetime
-// of APSInt objects and symbolic constraints used by GRExprEngine
+// of APSInt objects and symbolic constraints used by ExprEngine
// and related classes.
//
//===----------------------------------------------------------------------===//
-//==- GRBlockCounter.h - ADT for counting block visits -------------*- C++ -*-//
+//==- BlockCounter.h - ADT for counting block visits ---------------*- C++ -*-//
//
// The LLVM Compiler Infrastructure
//
//
//===----------------------------------------------------------------------===//
//
-// This file defines GRBlockCounter, an abstract data type used to count
+// This file defines BlockCounter, an abstract data type used to count
// the number of times a given block has been visited along a path
-// analyzed by GRCoreEngine.
+// analyzed by CoreEngine.
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_CLANG_GR_GRBLOCKCOUNTER
-#define LLVM_CLANG_GR_GRBLOCKCOUNTER
+#ifndef LLVM_CLANG_GR_BLOCKCOUNTER
+#define LLVM_CLANG_GR_BLOCKCOUNTER
namespace llvm {
class BumpPtrAllocator;
namespace GR {
-class GRBlockCounter {
+class BlockCounter {
void* Data;
- GRBlockCounter(void* D) : Data(D) {}
+ BlockCounter(void* D) : Data(D) {}
public:
- GRBlockCounter() : Data(0) {}
+ BlockCounter() : Data(0) {}
unsigned getNumVisited(const StackFrameContext *CallSite,
unsigned BlockID) const;
Factory(llvm::BumpPtrAllocator& Alloc);
~Factory();
- GRBlockCounter GetEmptyCounter();
- GRBlockCounter IncrementCount(GRBlockCounter BC,
+ BlockCounter GetEmptyCounter();
+ BlockCounter IncrementCount(BlockCounter BC,
const StackFrameContext *CallSite,
unsigned BlockID);
};
#define LLVM_CLANG_GR_CHECKER
#include "clang/Analysis/Support/SaveAndRestore.h"
-#include "clang/GR/PathSensitive/GRExprEngine.h"
+#include "clang/GR/PathSensitive/ExprEngine.h"
//===----------------------------------------------------------------------===//
// Checker interface.
class CheckerContext {
ExplodedNodeSet &Dst;
- GRStmtNodeBuilder &B;
- GRExprEngine &Eng;
+ StmtNodeBuilder &B;
+ ExprEngine &Eng;
ExplodedNode *Pred;
SaveAndRestore<bool> OldSink;
SaveAndRestore<const void*> OldTag;
public:
bool *respondsToCallback;
public:
- CheckerContext(ExplodedNodeSet &dst, GRStmtNodeBuilder &builder,
- GRExprEngine &eng, ExplodedNode *pred,
+ CheckerContext(ExplodedNodeSet &dst, StmtNodeBuilder &builder,
+ ExprEngine &eng, ExplodedNode *pred,
const void *tag, ProgramPoint::Kind K,
bool *respondsToCB = 0,
const Stmt *stmt = 0, const GRState *st = 0)
~CheckerContext();
- GRExprEngine &getEngine() {
+ ExprEngine &getEngine() {
return Eng;
}
}
ExplodedNodeSet &getNodeSet() { return Dst; }
- GRStmtNodeBuilder &getNodeBuilder() { return B; }
+ StmtNodeBuilder &getNodeBuilder() { return B; }
ExplodedNode *&getPredecessor() { return Pred; }
const GRState *getState() { return ST ? ST : B.GetState(Pred); }
}
// Generate a node with a new program point different from the one that will
- // be created by the GRStmtNodeBuilder.
+ // be created by the StmtNodeBuilder.
void addTransition(const GRState *state, ProgramPoint Loc) {
ExplodedNode *N = B.generateNode(Loc, state, Pred);
if (N)
class Checker {
private:
- friend class GRExprEngine;
+ friend class ExprEngine;
// FIXME: Remove the 'tag' option.
void GR_Visit(ExplodedNodeSet &Dst,
- GRStmtNodeBuilder &Builder,
- GRExprEngine &Eng,
+ StmtNodeBuilder &Builder,
+ ExprEngine &Eng,
const Stmt *S,
ExplodedNode *Pred, void *tag, bool isPrevisit,
bool& respondsToCallback) {
_PostVisit(C, S);
}
- bool GR_evalNilReceiver(ExplodedNodeSet &Dst, GRStmtNodeBuilder &Builder,
- GRExprEngine &Eng, const ObjCMessageExpr *ME,
+ bool GR_evalNilReceiver(ExplodedNodeSet &Dst, StmtNodeBuilder &Builder,
+ ExprEngine &Eng, const ObjCMessageExpr *ME,
ExplodedNode *Pred, const GRState *state, void *tag) {
CheckerContext C(Dst, Builder, Eng, Pred, tag, ProgramPoint::PostStmtKind,
0, ME, state);
return evalNilReceiver(C, ME);
}
- bool GR_evalCallExpr(ExplodedNodeSet &Dst, GRStmtNodeBuilder &Builder,
- GRExprEngine &Eng, const CallExpr *CE,
+ bool GR_evalCallExpr(ExplodedNodeSet &Dst, StmtNodeBuilder &Builder,
+ ExprEngine &Eng, const CallExpr *CE,
ExplodedNode *Pred, void *tag) {
CheckerContext C(Dst, Builder, Eng, Pred, tag, ProgramPoint::PostStmtKind,
0, CE);
// FIXME: Remove the 'tag' option.
void GR_VisitBind(ExplodedNodeSet &Dst,
- GRStmtNodeBuilder &Builder, GRExprEngine &Eng,
+ StmtNodeBuilder &Builder, ExprEngine &Eng,
const Stmt *StoreE, ExplodedNode *Pred, void *tag,
SVal location, SVal val,
bool isPrevisit) {
// FIXME: Remove the 'tag' option.
void GR_visitLocation(ExplodedNodeSet &Dst,
- GRStmtNodeBuilder &Builder,
- GRExprEngine &Eng,
+ StmtNodeBuilder &Builder,
+ ExprEngine &Eng,
const Stmt *S,
ExplodedNode *Pred, const GRState *state,
SVal location,
visitLocation(C, S, location);
}
- void GR_evalDeadSymbols(ExplodedNodeSet &Dst, GRStmtNodeBuilder &Builder,
- GRExprEngine &Eng, const Stmt *S, ExplodedNode *Pred,
+ void GR_evalDeadSymbols(ExplodedNodeSet &Dst, StmtNodeBuilder &Builder,
+ ExprEngine &Eng, const Stmt *S, ExplodedNode *Pred,
SymbolReaper &SymReaper, void *tag) {
CheckerContext C(Dst, Builder, Eng, Pred, tag,
ProgramPoint::PostPurgeDeadSymbolsKind, 0, S);
virtual void PreVisitBind(CheckerContext &C, const Stmt *StoreE,
SVal location, SVal val) {}
virtual void evalDeadSymbols(CheckerContext &C, SymbolReaper &SymReaper) {}
- virtual void evalEndPath(GREndPathNodeBuilder &B, void *tag,
- GRExprEngine &Eng) {}
+ virtual void evalEndPath(EndPathNodeBuilder &B, void *tag,
+ ExprEngine &Eng) {}
virtual void MarkLiveSymbols(const GRState *state, SymbolReaper &SymReaper) {}
- virtual void VisitBranchCondition(GRBranchNodeBuilder &Builder,
- GRExprEngine &Eng,
+ virtual void VisitBranchCondition(BranchNodeBuilder &Builder,
+ ExprEngine &Eng,
const Stmt *Condition, void *tag) {}
virtual bool evalNilReceiver(CheckerContext &C, const ObjCMessageExpr *ME) {
}
virtual void VisitEndAnalysis(ExplodedGraph &G, BugReporter &B,
- GRExprEngine &Eng) {}
+ ExprEngine &Eng) {}
};
} // end GR namespace
class GRState;
class GRStateManager;
-class GRSubEngine;
+class SubEngine;
class SVal;
class ConstraintManager {
/// canReasonAbout - Not all ConstraintManagers can accurately reason about
/// all SVal values. This method returns true if the ConstraintManager can
/// reasonably handle a given SVal value. This is typically queried by
- /// GRExprEngine to determine if the value should be replaced with a
+ /// ExprEngine to determine if the value should be replaced with a
/// conjured symbolic value in order to recover some precision.
virtual bool canReasonAbout(SVal X) const = 0;
};
ConstraintManager* CreateBasicConstraintManager(GRStateManager& statemgr,
- GRSubEngine &subengine);
+ SubEngine &subengine);
ConstraintManager* CreateRangeConstraintManager(GRStateManager& statemgr,
- GRSubEngine &subengine);
+ SubEngine &subengine);
} // end GR namespace
-//==- GRCoreEngine.h - Path-Sensitive Dataflow Engine --------------*- C++ -*-//
+//==- CoreEngine.h - Path-Sensitive Dataflow Engine ----------------*- C++ -*-//
//
// The LLVM Compiler Infrastructure
//
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_CLANG_GR_GRENGINE
-#define LLVM_CLANG_GR_GRENGINE
+#ifndef LLVM_CLANG_GR_COREENGINE
+#define LLVM_CLANG_GR_COREENGINE
#include "clang/AST/Expr.h"
#include "clang/GR/PathSensitive/ExplodedGraph.h"
-#include "clang/GR/PathSensitive/GRWorkList.h"
-#include "clang/GR/PathSensitive/GRBlockCounter.h"
-#include "clang/GR/PathSensitive/GRSubEngine.h"
+#include "clang/GR/PathSensitive/WorkList.h"
+#include "clang/GR/PathSensitive/BlockCounter.h"
+#include "clang/GR/PathSensitive/SubEngine.h"
#include "llvm/ADT/OwningPtr.h"
namespace clang {
namespace GR {
//===----------------------------------------------------------------------===//
-/// GRCoreEngine - Implements the core logic of the graph-reachability
+/// CoreEngine - Implements the core logic of the graph-reachability
/// analysis. It traverses the CFG and generates the ExplodedGraph.
/// Program "states" are treated as opaque void pointers.
-/// The template class GRCoreEngine (which subclasses GRCoreEngine)
+/// The template class CoreEngine (which subclasses CoreEngine)
/// provides the matching component to the engine that knows the actual types
/// for states. Note that this engine only dispatches to transfer functions
/// at the statement and block-level. The analyses themselves must implement
/// any transfer function logic and the sub-expression level (if any).
-class GRCoreEngine {
- friend class GRStmtNodeBuilder;
- friend class GRBranchNodeBuilder;
- friend class GRIndirectGotoNodeBuilder;
- friend class GRSwitchNodeBuilder;
- friend class GREndPathNodeBuilder;
- friend class GRCallEnterNodeBuilder;
- friend class GRCallExitNodeBuilder;
+class CoreEngine {
+ friend class StmtNodeBuilder;
+ friend class BranchNodeBuilder;
+ friend class IndirectGotoNodeBuilder;
+ friend class SwitchNodeBuilder;
+ friend class EndPathNodeBuilder;
+ friend class CallEnterNodeBuilder;
+ friend class CallExitNodeBuilder;
public:
typedef std::vector<std::pair<BlockEdge, const ExplodedNode*> >
BlocksAborted;
private:
- GRSubEngine& SubEngine;
+ SubEngine& SubEng;
/// G - The simulation graph. Each node is a (location,state) pair.
llvm::OwningPtr<ExplodedGraph> G;
/// WList - A set of queued nodes that need to be processed by the
/// worklist algorithm. It is up to the implementation of WList to decide
/// the order that nodes are processed.
- GRWorkList* WList;
+ WorkList* WList;
- /// BCounterFactory - A factory object for created GRBlockCounter objects.
+ /// BCounterFactory - A factory object for created BlockCounter objects.
/// These are used to record for key nodes in the ExplodedGraph the
/// number of times different CFGBlocks have been visited along a path.
- GRBlockCounter::Factory BCounterFactory;
+ BlockCounter::Factory BCounterFactory;
/// The locations where we stopped doing work because we visited a location
/// too many times.
/// Get the initial state from the subengine.
const GRState* getInitialState(const LocationContext *InitLoc) {
- return SubEngine.getInitialState(InitLoc);
+ return SubEng.getInitialState(InitLoc);
}
- void ProcessEndPath(GREndPathNodeBuilder& Builder) {
- SubEngine.ProcessEndPath(Builder);
+ void ProcessEndPath(EndPathNodeBuilder& Builder) {
+ SubEng.ProcessEndPath(Builder);
}
- void ProcessElement(const CFGElement E, GRStmtNodeBuilder& Builder) {
- SubEngine.ProcessElement(E, Builder);
+ void ProcessElement(const CFGElement E, StmtNodeBuilder& Builder) {
+ SubEng.ProcessElement(E, Builder);
}
bool ProcessBlockEntrance(const CFGBlock* Blk, const ExplodedNode *Pred,
- GRBlockCounter BC) {
- return SubEngine.ProcessBlockEntrance(Blk, Pred, BC);
+ BlockCounter BC) {
+ return SubEng.ProcessBlockEntrance(Blk, Pred, BC);
}
void ProcessBranch(const Stmt* Condition, const Stmt* Terminator,
- GRBranchNodeBuilder& Builder) {
- SubEngine.ProcessBranch(Condition, Terminator, Builder);
+ BranchNodeBuilder& Builder) {
+ SubEng.ProcessBranch(Condition, Terminator, Builder);
}
- void ProcessIndirectGoto(GRIndirectGotoNodeBuilder& Builder) {
- SubEngine.ProcessIndirectGoto(Builder);
+ void ProcessIndirectGoto(IndirectGotoNodeBuilder& Builder) {
+ SubEng.ProcessIndirectGoto(Builder);
}
- void ProcessSwitch(GRSwitchNodeBuilder& Builder) {
- SubEngine.ProcessSwitch(Builder);
+ void ProcessSwitch(SwitchNodeBuilder& Builder) {
+ SubEng.ProcessSwitch(Builder);
}
- void ProcessCallEnter(GRCallEnterNodeBuilder &Builder) {
- SubEngine.ProcessCallEnter(Builder);
+ void ProcessCallEnter(CallEnterNodeBuilder &Builder) {
+ SubEng.ProcessCallEnter(Builder);
}
- void ProcessCallExit(GRCallExitNodeBuilder &Builder) {
- SubEngine.ProcessCallExit(Builder);
+ void ProcessCallExit(CallExitNodeBuilder &Builder) {
+ SubEng.ProcessCallExit(Builder);
}
private:
- GRCoreEngine(const GRCoreEngine&); // Do not implement.
- GRCoreEngine& operator=(const GRCoreEngine&);
+ CoreEngine(const CoreEngine&); // Do not implement.
+ CoreEngine& operator=(const CoreEngine&);
public:
- /// Construct a GRCoreEngine object to analyze the provided CFG using
+ /// Construct a CoreEngine object to analyze the provided CFG using
/// a DFS exploration of the exploded graph.
- GRCoreEngine(GRSubEngine& subengine)
- : SubEngine(subengine), G(new ExplodedGraph()),
- WList(GRWorkList::MakeBFS()),
+ CoreEngine(SubEngine& subengine)
+ : SubEng(subengine), G(new ExplodedGraph()),
+ WList(WorkList::MakeBFS()),
BCounterFactory(G->getAllocator()) {}
- /// Construct a GRCoreEngine object to analyze the provided CFG and to
+ /// Construct a CoreEngine object to analyze the provided CFG and to
/// use the provided worklist object to execute the worklist algorithm.
- /// The GRCoreEngine object assumes ownership of 'wlist'.
- GRCoreEngine(GRWorkList* wlist, GRSubEngine& subengine)
- : SubEngine(subengine), G(new ExplodedGraph()), WList(wlist),
+ /// The CoreEngine object assumes ownership of 'wlist'.
+ CoreEngine(WorkList* wlist, SubEngine& subengine)
+ : SubEng(subengine), G(new ExplodedGraph()), WList(wlist),
BCounterFactory(G->getAllocator()) {}
- ~GRCoreEngine() {
+ ~CoreEngine() {
delete WList;
}
bool wasBlockAborted() const { return !blocksAborted.empty(); }
bool hasWorkRemaining() const { return wasBlockAborted() || WList->hasWork(); }
- GRWorkList *getWorkList() const { return WList; }
+ WorkList *getWorkList() const { return WList; }
BlocksAborted::const_iterator blocks_aborted_begin() const {
return blocksAborted.begin();
}
};
-class GRStmtNodeBuilder {
- GRCoreEngine& Eng;
+class StmtNodeBuilder {
+ CoreEngine& Eng;
const CFGBlock& B;
const unsigned Idx;
ExplodedNode* Pred;
void GenerateAutoTransition(ExplodedNode* N);
public:
- GRStmtNodeBuilder(const CFGBlock* b, unsigned idx, ExplodedNode* N,
- GRCoreEngine* e, GRStateManager &mgr);
+ StmtNodeBuilder(const CFGBlock* b, unsigned idx, ExplodedNode* N,
+ CoreEngine* e, GRStateManager &mgr);
- ~GRStmtNodeBuilder();
+ ~StmtNodeBuilder();
ExplodedNode* getBasePredecessor() const { return Pred; }
// FIXME: This should not be exposed.
- GRWorkList *getWorkList() { return Eng.WList; }
+ WorkList *getWorkList() { return Eng.WList; }
void SetCleanedState(const GRState* St) {
CleanedState = St;
}
- GRBlockCounter getBlockCounter() const { return Eng.WList->getBlockCounter();}
+ BlockCounter getBlockCounter() const { return Eng.WList->getBlockCounter();}
unsigned getCurrentBlockCount() const {
return getBlockCounter().getNumVisited(
}
};
-class GRBranchNodeBuilder {
- GRCoreEngine& Eng;
+class BranchNodeBuilder {
+ CoreEngine& Eng;
const CFGBlock* Src;
const CFGBlock* DstT;
const CFGBlock* DstF;
bool InFeasibleFalse;
public:
- GRBranchNodeBuilder(const CFGBlock* src, const CFGBlock* dstT,
- const CFGBlock* dstF, ExplodedNode* pred, GRCoreEngine* e)
+ BranchNodeBuilder(const CFGBlock* src, const CFGBlock* dstT,
+ const CFGBlock* dstF, ExplodedNode* pred, CoreEngine* e)
: Eng(*e), Src(src), DstT(dstT), DstF(dstF), Pred(pred),
GeneratedTrue(false), GeneratedFalse(false),
InFeasibleTrue(!DstT), InFeasibleFalse(!DstF) {}
- ~GRBranchNodeBuilder();
+ ~BranchNodeBuilder();
ExplodedNode* getPredecessor() const { return Pred; }
const ExplodedGraph& getGraph() const { return *Eng.G; }
- GRBlockCounter getBlockCounter() const { return Eng.WList->getBlockCounter();}
+ BlockCounter getBlockCounter() const { return Eng.WList->getBlockCounter();}
ExplodedNode* generateNode(const GRState* State, bool branch);
}
};
-class GRIndirectGotoNodeBuilder {
- GRCoreEngine& Eng;
+class IndirectGotoNodeBuilder {
+ CoreEngine& Eng;
const CFGBlock* Src;
const CFGBlock& DispatchBlock;
const Expr* E;
ExplodedNode* Pred;
public:
- GRIndirectGotoNodeBuilder(ExplodedNode* pred, const CFGBlock* src,
- const Expr* e, const CFGBlock* dispatch, GRCoreEngine* eng)
+ IndirectGotoNodeBuilder(ExplodedNode* pred, const CFGBlock* src,
+ const Expr* e, const CFGBlock* dispatch, CoreEngine* eng)
: Eng(*eng), Src(src), DispatchBlock(*dispatch), E(e), Pred(pred) {}
class iterator {
CFGBlock::const_succ_iterator I;
- friend class GRIndirectGotoNodeBuilder;
+ friend class IndirectGotoNodeBuilder;
iterator(CFGBlock::const_succ_iterator i) : I(i) {}
public:
const GRState* getState() const { return Pred->State; }
};
-class GRSwitchNodeBuilder {
- GRCoreEngine& Eng;
+class SwitchNodeBuilder {
+ CoreEngine& Eng;
const CFGBlock* Src;
const Expr* Condition;
ExplodedNode* Pred;
public:
- GRSwitchNodeBuilder(ExplodedNode* pred, const CFGBlock* src,
- const Expr* condition, GRCoreEngine* eng)
+ SwitchNodeBuilder(ExplodedNode* pred, const CFGBlock* src,
+ const Expr* condition, CoreEngine* eng)
: Eng(*eng), Src(src), Condition(condition), Pred(pred) {}
class iterator {
CFGBlock::const_succ_reverse_iterator I;
- friend class GRSwitchNodeBuilder;
+ friend class SwitchNodeBuilder;
iterator(CFGBlock::const_succ_reverse_iterator i) : I(i) {}
public:
const GRState* getState() const { return Pred->State; }
};
-class GREndPathNodeBuilder {
- GRCoreEngine &Eng;
+class EndPathNodeBuilder {
+ CoreEngine &Eng;
const CFGBlock& B;
ExplodedNode* Pred;
bool HasGeneratedNode;
public:
- GREndPathNodeBuilder(const CFGBlock* b, ExplodedNode* N, GRCoreEngine* e)
+ EndPathNodeBuilder(const CFGBlock* b, ExplodedNode* N, CoreEngine* e)
: Eng(*e), B(*b), Pred(N), HasGeneratedNode(false) {}
- ~GREndPathNodeBuilder();
+ ~EndPathNodeBuilder();
- GRWorkList &getWorkList() { return *Eng.WList; }
+ WorkList &getWorkList() { return *Eng.WList; }
ExplodedNode* getPredecessor() const { return Pred; }
- GRBlockCounter getBlockCounter() const {
+ BlockCounter getBlockCounter() const {
return Eng.WList->getBlockCounter();
}
}
};
-class GRCallEnterNodeBuilder {
- GRCoreEngine &Eng;
+class CallEnterNodeBuilder {
+ CoreEngine &Eng;
const ExplodedNode *Pred;
unsigned Index;
public:
- GRCallEnterNodeBuilder(GRCoreEngine &eng, const ExplodedNode *pred,
+ CallEnterNodeBuilder(CoreEngine &eng, const ExplodedNode *pred,
const Stmt *s, const StackFrameContext *callee,
const CFGBlock *blk, unsigned idx)
: Eng(eng), Pred(pred), CE(s), CalleeCtx(callee), Block(blk), Index(idx) {}
void generateNode(const GRState *state);
};
-class GRCallExitNodeBuilder {
- GRCoreEngine &Eng;
+class CallExitNodeBuilder {
+ CoreEngine &Eng;
const ExplodedNode *Pred;
public:
- GRCallExitNodeBuilder(GRCoreEngine &eng, const ExplodedNode *pred)
+ CallExitNodeBuilder(CoreEngine &eng, const ExplodedNode *pred)
: Eng(eng), Pred(pred) {}
const ExplodedNode *getPredecessor() const { return Pred; }
class ExplodedNode : public llvm::FoldingSetNode {
friend class ExplodedGraph;
- friend class GRCoreEngine;
- friend class GRStmtNodeBuilder;
- friend class GRBranchNodeBuilder;
- friend class GRIndirectGotoNodeBuilder;
- friend class GRSwitchNodeBuilder;
- friend class GREndPathNodeBuilder;
+ friend class CoreEngine;
+ friend class StmtNodeBuilder;
+ friend class BranchNodeBuilder;
+ friend class IndirectGotoNodeBuilder;
+ friend class SwitchNodeBuilder;
+ friend class EndPathNodeBuilder;
class NodeGroup {
enum { Size1 = 0x0, SizeOther = 0x1, AuxFlag = 0x2, Mask = 0x3 };
class ExplodedGraph {
protected:
- friend class GRCoreEngine;
+ friend class CoreEngine;
// Type definitions.
typedef llvm::SmallVector<ExplodedNode*,2> RootsTy;
-//===-- GRExprEngine.h - Path-Sensitive Expression-Level Dataflow ---*- C++ -*-=
+//===-- ExprEngine.h - Path-Sensitive Expression-Level Dataflow ---*- C++ -*-=//
//
// The LLVM Compiler Infrastructure
//
//===----------------------------------------------------------------------===//
//
// This file defines a meta-engine for path-sensitive dataflow analysis that
-// is built on GRCoreEngine, but provides the boilerplate to execute transfer
+// is built on CoreEngine, but provides the boilerplate to execute transfer
// functions and build the ExplodedGraph at the expression level.
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_CLANG_GR_GREXPRENGINE
-#define LLVM_CLANG_GR_GREXPRENGINE
+#ifndef LLVM_CLANG_GR_EXPRENGINE
+#define LLVM_CLANG_GR_EXPRENGINE
#include "clang/GR/PathSensitive/AnalysisManager.h"
-#include "clang/GR/PathSensitive/GRSubEngine.h"
-#include "clang/GR/PathSensitive/GRCoreEngine.h"
+#include "clang/GR/PathSensitive/SubEngine.h"
+#include "clang/GR/PathSensitive/CoreEngine.h"
#include "clang/GR/PathSensitive/GRState.h"
-#include "clang/GR/PathSensitive/GRTransferFuncs.h"
+#include "clang/GR/PathSensitive/TransferFuncs.h"
#include "clang/GR/BugReporter/BugReporter.h"
#include "clang/AST/Type.h"
#include "clang/AST/ExprObjC.h"
class AnalysisManager;
class Checker;
-class GRExprEngine : public GRSubEngine {
+class ExprEngine : public SubEngine {
AnalysisManager &AMgr;
- GRCoreEngine CoreEngine;
+ CoreEngine Engine;
/// G - the simulation graph.
ExplodedGraph& G;
- /// Builder - The current GRStmtNodeBuilder which is used when building the
+ /// Builder - The current StmtNodeBuilder which is used when building the
/// nodes for a given statement.
- GRStmtNodeBuilder* Builder;
+ StmtNodeBuilder* Builder;
/// StateMgr - Object that manages the data for all created states.
GRStateManager StateMgr;
/// 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 GRExprEngine is destroyed.
+ /// destructor is called before the rest of the ExprEngine is destroyed.
GRBugReporter BR;
- llvm::OwningPtr<GRTransferFuncs> TF;
+ llvm::OwningPtr<TransferFuncs> TF;
public:
- GRExprEngine(AnalysisManager &mgr, GRTransferFuncs *tf);
+ ExprEngine(AnalysisManager &mgr, TransferFuncs *tf);
- ~GRExprEngine();
+ ~ExprEngine();
void ExecuteWorkList(const LocationContext *L, unsigned Steps = 150000) {
- CoreEngine.ExecuteWorkList(L, Steps, 0);
+ Engine.ExecuteWorkList(L, Steps, 0);
}
/// Execute the work list with an initial state. Nodes that reaches the exit
void ExecuteWorkListWithInitialState(const LocationContext *L, unsigned Steps,
const GRState *InitState,
ExplodedNodeSet &Dst) {
- CoreEngine.ExecuteWorkListWithInitialState(L, Steps, InitState, Dst);
+ Engine.ExecuteWorkListWithInitialState(L, Steps, InitState, Dst);
}
/// getContext - Return the ASTContext associated with this analysis.
SValBuilder &getSValBuilder() { return svalBuilder; }
- GRTransferFuncs& getTF() { return *TF; }
+ TransferFuncs& getTF() { return *TF; }
BugReporter& getBugReporter() { return BR; }
- GRStmtNodeBuilder &getBuilder() { assert(Builder); return *Builder; }
+ StmtNodeBuilder &getBuilder() { assert(Builder); return *Builder; }
- // FIXME: Remove once GRTransferFuncs is no longer referenced.
- void setTransferFunction(GRTransferFuncs* tf);
+ // FIXME: Remove once TransferFuncs is no longer referenced.
+ void setTransferFunction(TransferFuncs* tf);
/// ViewGraph - Visualize the ExplodedGraph created by executing the
/// simulation.
return static_cast<CHECKER*>(lookupChecker(CHECKER::getTag()));
}
- /// ProcessElement - Called by GRCoreEngine. Used to generate new successor
+ /// ProcessElement - Called by CoreEngine. Used to generate new successor
/// nodes by processing the 'effects' of a CFG element.
- void ProcessElement(const CFGElement E, GRStmtNodeBuilder& builder);
+ void ProcessElement(const CFGElement E, StmtNodeBuilder& builder);
- void ProcessStmt(const CFGStmt S, GRStmtNodeBuilder &builder);
+ void ProcessStmt(const CFGStmt S, StmtNodeBuilder &builder);
- void ProcessInitializer(const CFGInitializer I, GRStmtNodeBuilder &builder);
+ void ProcessInitializer(const CFGInitializer I, StmtNodeBuilder &builder);
- void ProcessImplicitDtor(const CFGImplicitDtor D, GRStmtNodeBuilder &builder);
+ void ProcessImplicitDtor(const CFGImplicitDtor D, StmtNodeBuilder &builder);
void ProcessAutomaticObjDtor(const CFGAutomaticObjDtor D,
- GRStmtNodeBuilder &builder);
- void ProcessBaseDtor(const CFGBaseDtor D, GRStmtNodeBuilder &builder);
- void ProcessMemberDtor(const CFGMemberDtor D, GRStmtNodeBuilder &builder);
+ StmtNodeBuilder &builder);
+ void ProcessBaseDtor(const CFGBaseDtor D, StmtNodeBuilder &builder);
+ void ProcessMemberDtor(const CFGMemberDtor D, StmtNodeBuilder &builder);
void ProcessTemporaryDtor(const CFGTemporaryDtor D,
- GRStmtNodeBuilder &builder);
+ StmtNodeBuilder &builder);
- /// ProcessBlockEntrance - Called by GRCoreEngine when start processing
+ /// ProcessBlockEntrance - Called by CoreEngine when start processing
/// a CFGBlock. This method returns true if the analysis should continue
/// exploring the given path, and false otherwise.
bool ProcessBlockEntrance(const CFGBlock* B, const ExplodedNode *Pred,
- GRBlockCounter BC);
+ BlockCounter BC);
- /// ProcessBranch - Called by GRCoreEngine. Used to generate successor
+ /// ProcessBranch - Called by CoreEngine. Used to generate successor
/// nodes by processing the 'effects' of a branch condition.
void ProcessBranch(const Stmt* Condition, const Stmt* Term,
- GRBranchNodeBuilder& builder);
+ BranchNodeBuilder& builder);
- /// ProcessIndirectGoto - Called by GRCoreEngine. Used to generate successor
+ /// ProcessIndirectGoto - Called by CoreEngine. Used to generate successor
/// nodes by processing the 'effects' of a computed goto jump.
- void ProcessIndirectGoto(GRIndirectGotoNodeBuilder& builder);
+ void ProcessIndirectGoto(IndirectGotoNodeBuilder& builder);
- /// ProcessSwitch - Called by GRCoreEngine. Used to generate successor
+ /// ProcessSwitch - Called by CoreEngine. Used to generate successor
/// nodes by processing the 'effects' of a switch statement.
- void ProcessSwitch(GRSwitchNodeBuilder& builder);
+ void ProcessSwitch(SwitchNodeBuilder& builder);
- /// ProcessEndPath - Called by GRCoreEngine. Used to generate end-of-path
+ /// ProcessEndPath - Called by CoreEngine. Used to generate end-of-path
/// nodes when the control reaches the end of a function.
- void ProcessEndPath(GREndPathNodeBuilder& builder);
+ void ProcessEndPath(EndPathNodeBuilder& builder);
/// Generate the entry node of the callee.
- void ProcessCallEnter(GRCallEnterNodeBuilder &builder);
+ void ProcessCallEnter(CallEnterNodeBuilder &builder);
/// Generate the first post callsite node.
- void ProcessCallExit(GRCallExitNodeBuilder &builder);
+ void ProcessCallExit(CallExitNodeBuilder &builder);
- /// Called by GRCoreEngine when the analysis worklist has terminated.
+ /// Called by CoreEngine when the analysis worklist has terminated.
void ProcessEndWorklist(bool hasWorkRemaining);
/// evalAssume - Callback function invoked by the ConstraintManager when
const SymbolManager& getSymbolManager() const { return SymMgr; }
// Functions for external checking of whether we have unfinished work
- bool wasBlockAborted() const { return CoreEngine.wasBlockAborted(); }
- bool hasEmptyWorkList() const { return !CoreEngine.getWorkList()->hasWork(); }
+ bool wasBlockAborted() const { return Engine.wasBlockAborted(); }
+ bool hasEmptyWorkList() const { return !Engine.getWorkList()->hasWork(); }
bool hasWorkRemaining() const {
- return wasBlockAborted() || CoreEngine.getWorkList()->hasWork();
+ return wasBlockAborted() || Engine.getWorkList()->hasWork();
}
- const GRCoreEngine &getCoreEngine() const { return CoreEngine; }
+ const CoreEngine &getCoreEngine() const { return Engine; }
protected:
const GRState* GetState(ExplodedNode* N) {
protected:
void evalObjCMessageExpr(ExplodedNodeSet& Dst, const ObjCMessageExpr* ME,
ExplodedNode* Pred, const GRState *state) {
- assert (Builder && "GRStmtNodeBuilder must be defined.");
+ assert (Builder && "StmtNodeBuilder must be defined.");
getTF().evalObjCMessageExpr(Dst, *this, *Builder, ME, Pred, state);
}
-//===-- GRExprEngineBuilders.h - "Builder" classes for GRExprEngine -*- C++ -*-=
+//===-- ExprEngineBuilders.h - "Builder" classes for ExprEngine ---*- C++ -*-=//
//
// The LLVM Compiler Infrastructure
//
//===----------------------------------------------------------------------===//
//
// This file defines smart builder "references" which are used to marshal
-// builders between GRExprEngine objects and their related components.
+// builders between ExprEngine objects and their related components.
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_CLANG_GR_GREXPRENGINE_BUILDERS
-#define LLVM_CLANG_GR_GREXPRENGINE_BUILDERS
-#include "clang/GR/PathSensitive/GRExprEngine.h"
+#ifndef LLVM_CLANG_GR_EXPRENGINE_BUILDERS
+#define LLVM_CLANG_GR_EXPRENGINE_BUILDERS
+#include "clang/GR/PathSensitive/ExprEngine.h"
#include "clang/Analysis/Support/SaveAndRestore.h"
namespace clang {
namespace GR {
-class GRStmtNodeBuilderRef {
+class StmtNodeBuilderRef {
ExplodedNodeSet &Dst;
- GRStmtNodeBuilder &B;
- GRExprEngine& Eng;
+ StmtNodeBuilder &B;
+ ExprEngine& Eng;
ExplodedNode* Pred;
const GRState* state;
const Stmt* stmt;
SaveOr OldHasGen;
private:
- friend class GRExprEngine;
+ friend class ExprEngine;
- GRStmtNodeBuilderRef(); // do not implement
- void operator=(const GRStmtNodeBuilderRef&); // do not implement
+ StmtNodeBuilderRef(); // do not implement
+ void operator=(const StmtNodeBuilderRef&); // do not implement
- GRStmtNodeBuilderRef(ExplodedNodeSet &dst,
- GRStmtNodeBuilder &builder,
- GRExprEngine& eng,
+ StmtNodeBuilderRef(ExplodedNodeSet &dst,
+ StmtNodeBuilder &builder,
+ ExprEngine& eng,
ExplodedNode* pred,
const GRState *st,
const Stmt* s, bool auto_create_node)
public:
- ~GRStmtNodeBuilderRef() {
+ ~StmtNodeBuilderRef() {
// Handle the case where no nodes where generated. Auto-generate that
// contains the updated state if we aren't generating sinks.
if (!B.BuildSinks && Dst.size() == OldSize && !B.HasGeneratedNode) {
class Checker;
typedef ConstraintManager* (*ConstraintManagerCreator)(GRStateManager&,
- GRSubEngine&);
+ SubEngine&);
typedef StoreManager* (*StoreManagerCreator)(GRStateManager&);
//===----------------------------------------------------------------------===//
// As constraints gradually accrue on symbolic values, added constraints
// may conflict and indicate that a state is infeasible (as no real values
// could satisfy all the constraints). This is the principal mechanism
- // for modeling path-sensitivity in GRExprEngine/GRState.
+ // for modeling path-sensitivity in ExprEngine/GRState.
//
// Various "assume" methods form the interface for adding constraints to
// symbolic values. A call to 'assume' indicates an assumption being placed
class GRStateManager {
friend class GRState;
- friend class GRExprEngine; // FIXME: Remove.
+ friend class ExprEngine; // FIXME: Remove.
private:
- /// Eng - The GRSubEngine that owns this state manager.
- GRSubEngine &Eng;
+ /// Eng - The SubEngine that owns this state manager.
+ SubEngine &Eng;
EnvironmentManager EnvMgr;
llvm::OwningPtr<StoreManager> StoreMgr;
StoreManagerCreator CreateStoreManager,
ConstraintManagerCreator CreateConstraintManager,
llvm::BumpPtrAllocator& alloc,
- GRSubEngine &subeng)
+ SubEngine &subeng)
: Eng(subeng),
EnvMgr(alloc),
GDMFactory(alloc),
StoreManager& getStoreManager() { return *StoreMgr; }
ConstraintManager& getConstraintManager() { return *ConstraintMgr; }
- GRSubEngine& getOwningEngine() { return Eng; }
+ SubEngine& getOwningEngine() { return Eng; }
const GRState* RemoveDeadBindings(const GRState* St,
const StackFrameContext *LCtx,
return UnknownVal();
}
- /// ArrayToPointer - Used by GRExprEngine::VistCast to handle implicit
+ /// ArrayToPointer - Used by ExprEngine::VistCast to handle implicit
/// conversions between arrays and pointers.
virtual SVal ArrayToPointer(Loc Array) = 0;
const ElementRegion *GetElementZeroRegion(const MemRegion *R, QualType T);
- /// CastRegion - Used by GRExprEngine::VisitCast to handle casts from
+ /// CastRegion - Used by ExprEngine::VisitCast to handle casts from
/// a MemRegion* to a specific location type. 'R' is the region being
/// casted and 'CastToTy' the result type of the cast.
const MemRegion *CastRegion(const MemRegion *region, QualType CastToTy);
-//== GRSubEngine.h - Interface of the subengine of GRCoreEngine ----*- C++ -*-//
+//== SubEngine.h - Interface of the subengine of CoreEngine --------*- C++ -*-//
//
// The LLVM Compiler Infrastructure
//
//
//===----------------------------------------------------------------------===//
//
-// This file defines the interface of a subengine of the GRCoreEngine.
+// This file defines the interface of a subengine of the CoreEngine.
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_CLANG_GR_GRSUBENGINE_H
-#define LLVM_CLANG_GR_GRSUBENGINE_H
+#ifndef LLVM_CLANG_GR_SUBENGINE_H
+#define LLVM_CLANG_GR_SUBENGINE_H
#include "clang/GR/PathSensitive/SVals.h"
class ExplodedNode;
class GRState;
class GRStateManager;
-class GRBlockCounter;
-class GRStmtNodeBuilder;
-class GRBranchNodeBuilder;
-class GRIndirectGotoNodeBuilder;
-class GRSwitchNodeBuilder;
-class GREndPathNodeBuilder;
-class GRCallEnterNodeBuilder;
-class GRCallExitNodeBuilder;
+class BlockCounter;
+class StmtNodeBuilder;
+class BranchNodeBuilder;
+class IndirectGotoNodeBuilder;
+class SwitchNodeBuilder;
+class EndPathNodeBuilder;
+class CallEnterNodeBuilder;
+class CallExitNodeBuilder;
class MemRegion;
-class GRSubEngine {
+class SubEngine {
public:
- virtual ~GRSubEngine() {}
+ virtual ~SubEngine() {}
virtual const GRState* getInitialState(const LocationContext *InitLoc) = 0;
virtual GRStateManager &getStateManager() = 0;
- /// Called by GRCoreEngine. Used to generate new successor
+ /// Called by CoreEngine. Used to generate new successor
/// nodes by processing the 'effects' of a block-level statement.
- virtual void ProcessElement(const CFGElement E, GRStmtNodeBuilder& builder)=0;
+ virtual void ProcessElement(const CFGElement E, StmtNodeBuilder& builder)=0;
- /// Called by GRCoreEngine when start processing
+ /// Called by CoreEngine when start processing
/// a CFGBlock. This method returns true if the analysis should continue
/// exploring the given path, and false otherwise.
virtual bool ProcessBlockEntrance(const CFGBlock* B, const ExplodedNode *Pred,
- GRBlockCounter BC) = 0;
+ BlockCounter BC) = 0;
- /// Called by GRCoreEngine. Used to generate successor
+ /// Called by CoreEngine. Used to generate successor
/// nodes by processing the 'effects' of a branch condition.
virtual void ProcessBranch(const Stmt* Condition, const Stmt* Term,
- GRBranchNodeBuilder& builder) = 0;
+ BranchNodeBuilder& builder) = 0;
- /// Called by GRCoreEngine. Used to generate successor
+ /// Called by CoreEngine. Used to generate successor
/// nodes by processing the 'effects' of a computed goto jump.
- virtual void ProcessIndirectGoto(GRIndirectGotoNodeBuilder& builder) = 0;
+ virtual void ProcessIndirectGoto(IndirectGotoNodeBuilder& builder) = 0;
- /// Called by GRCoreEngine. Used to generate successor
+ /// Called by CoreEngine. Used to generate successor
/// nodes by processing the 'effects' of a switch statement.
- virtual void ProcessSwitch(GRSwitchNodeBuilder& builder) = 0;
+ virtual void ProcessSwitch(SwitchNodeBuilder& builder) = 0;
- /// ProcessEndPath - Called by GRCoreEngine. Used to generate end-of-path
+ /// ProcessEndPath - Called by CoreEngine. Used to generate end-of-path
/// nodes when the control reaches the end of a function.
- virtual void ProcessEndPath(GREndPathNodeBuilder& builder) = 0;
+ virtual void ProcessEndPath(EndPathNodeBuilder& builder) = 0;
// Generate the entry node of the callee.
- virtual void ProcessCallEnter(GRCallEnterNodeBuilder &builder) = 0;
+ virtual void ProcessCallEnter(CallEnterNodeBuilder &builder) = 0;
// Generate the first post callsite node.
- virtual void ProcessCallExit(GRCallExitNodeBuilder &builder) = 0;
+ virtual void ProcessCallExit(CallExitNodeBuilder &builder) = 0;
/// Called by ConstraintManager. Used to call checker-specific
/// logic for handling assumptions on symbolic values.
return ProcessRegionChanges(state, &MR, &MR+1);
}
- /// Called by GRCoreEngine when the analysis worklist is either empty or the
+ /// Called by CoreEngine when the analysis worklist is either empty or the
// maximum number of analysis steps have been reached.
virtual void ProcessEndWorklist(bool hasWorkRemaining) = 0;
};
//===----------------------------------------------------------------------===//
//
// This file defines SymbolManager, a class that manages symbolic values
-// created for use by GRExprEngine and related classes.
+// created for use by ExprEngine and related classes.
//
//===----------------------------------------------------------------------===//
-//== GRTransferFuncs.h - Path-Sens. Transfer Functions Interface -*- C++ -*--=//
+//== TransferFuncs.h - Path-Sens. Transfer Functions Interface ---*- C++ -*--=//
//
// The LLVM Compiler Infrastructure
//
//
//===----------------------------------------------------------------------===//
//
-// This file defines GRTransferFuncs, which provides a base-class that
-// defines an interface for transfer functions used by GRExprEngine.
+// This file defines TransferFuncs, which provides a base-class that
+// defines an interface for transfer functions used by ExprEngine.
//
//===----------------------------------------------------------------------===//
namespace GR {
class ExplodedNode;
class ExplodedNodeSet;
-class GREndPathNodeBuilder;
-class GRExprEngine;
-class GRStmtNodeBuilder;
-class GRStmtNodeBuilderRef;
+class EndPathNodeBuilder;
+class ExprEngine;
+class StmtNodeBuilder;
+class StmtNodeBuilderRef;
-class GRTransferFuncs {
+class TransferFuncs {
public:
- GRTransferFuncs() {}
- virtual ~GRTransferFuncs() {}
+ TransferFuncs() {}
+ virtual ~TransferFuncs() {}
virtual void RegisterPrinters(std::vector<GRState::Printer*>& Printers) {}
- virtual void RegisterChecks(GRExprEngine& Eng) {}
+ virtual void RegisterChecks(ExprEngine& Eng) {}
// Calls.
virtual void evalCall(ExplodedNodeSet& Dst,
- GRExprEngine& Engine,
- GRStmtNodeBuilder& Builder,
+ ExprEngine& Engine,
+ StmtNodeBuilder& Builder,
const CallExpr* CE, SVal L,
ExplodedNode* Pred) {}
virtual void evalObjCMessageExpr(ExplodedNodeSet& Dst,
- GRExprEngine& Engine,
- GRStmtNodeBuilder& Builder,
+ ExprEngine& Engine,
+ StmtNodeBuilder& Builder,
const ObjCMessageExpr* ME,
ExplodedNode* Pred,
const GRState *state) {}
// Stores.
- virtual void evalBind(GRStmtNodeBuilderRef& B, SVal location, SVal val) {}
+ virtual void evalBind(StmtNodeBuilderRef& B, SVal location, SVal val) {}
// End-of-path and dead symbol notification.
- virtual void evalEndPath(GRExprEngine& Engine,
- GREndPathNodeBuilder& Builder) {}
+ virtual void evalEndPath(ExprEngine& Engine,
+ EndPathNodeBuilder& Builder) {}
virtual void evalDeadSymbols(ExplodedNodeSet& Dst,
- GRExprEngine& Engine,
- GRStmtNodeBuilder& Builder,
+ ExprEngine& Engine,
+ StmtNodeBuilder& Builder,
ExplodedNode* Pred,
const GRState* state,
SymbolReaper& SymReaper) {}
// Return statements.
virtual void evalReturn(ExplodedNodeSet& Dst,
- GRExprEngine& Engine,
- GRStmtNodeBuilder& Builder,
+ ExprEngine& Engine,
+ StmtNodeBuilder& Builder,
const ReturnStmt* S,
ExplodedNode* Pred) {}
-//==- GRWorkList.h - Worklist class used by GRCoreEngine -----------*- C++ -*-//
+//==- WorkList.h - Worklist class used by CoreEngine ---------------*- C++ -*-//
//
// The LLVM Compiler Infrastructure
//
//
//===----------------------------------------------------------------------===//
//
-// This file defines GRWorkList, a pure virtual class that represents an opaque
-// worklist used by GRCoreEngine to explore the reachability state space.
+// This file defines WorkList, a pure virtual class that represents an opaque
+// worklist used by CoreEngine to explore the reachability state space.
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_CLANG_GR_GRWORKLIST
-#define LLVM_CLANG_GR_GRWORKLIST
+#ifndef LLVM_CLANG_GR_WORKLIST
+#define LLVM_CLANG_GR_WORKLIST
-#include "clang/GR/PathSensitive/GRBlockCounter.h"
+#include "clang/GR/PathSensitive/BlockCounter.h"
#include <cstddef>
namespace clang {
class ExplodedNode;
class ExplodedNodeImpl;
-class GRWorkListUnit {
+class WorkListUnit {
ExplodedNode* Node;
- GRBlockCounter Counter;
+ BlockCounter Counter;
const CFGBlock* Block;
unsigned BlockIdx; // This is the index of the next statement.
public:
- GRWorkListUnit(ExplodedNode* N, GRBlockCounter C,
+ WorkListUnit(ExplodedNode* N, BlockCounter C,
const CFGBlock* B, unsigned idx)
: Node(N),
Counter(C),
Block(B),
BlockIdx(idx) {}
- explicit GRWorkListUnit(ExplodedNode* N, GRBlockCounter C)
+ explicit WorkListUnit(ExplodedNode* N, BlockCounter C)
: Node(N),
Counter(C),
Block(NULL),
BlockIdx(0) {}
ExplodedNode* getNode() const { return Node; }
- GRBlockCounter getBlockCounter() const { return Counter; }
+ BlockCounter getBlockCounter() const { return Counter; }
const CFGBlock* getBlock() const { return Block; }
unsigned getIndex() const { return BlockIdx; }
};
-class GRWorkList {
- GRBlockCounter CurrentCounter;
+class WorkList {
+ BlockCounter CurrentCounter;
public:
- virtual ~GRWorkList();
+ virtual ~WorkList();
virtual bool hasWork() const = 0;
- virtual void Enqueue(const GRWorkListUnit& U) = 0;
+ virtual void Enqueue(const WorkListUnit& U) = 0;
void Enqueue(ExplodedNode* N, const CFGBlock* B, unsigned idx) {
- Enqueue(GRWorkListUnit(N, CurrentCounter, B, idx));
+ Enqueue(WorkListUnit(N, CurrentCounter, B, idx));
}
void Enqueue(ExplodedNode* N) {
- Enqueue(GRWorkListUnit(N, CurrentCounter));
+ Enqueue(WorkListUnit(N, CurrentCounter));
}
- virtual GRWorkListUnit Dequeue() = 0;
+ virtual WorkListUnit Dequeue() = 0;
- void setBlockCounter(GRBlockCounter C) { CurrentCounter = C; }
- GRBlockCounter getBlockCounter() const { return CurrentCounter; }
+ void setBlockCounter(BlockCounter C) { CurrentCounter = C; }
+ BlockCounter getBlockCounter() const { return CurrentCounter; }
class Visitor {
public:
Visitor() {}
virtual ~Visitor();
- virtual bool Visit(const GRWorkListUnit &U) = 0;
+ virtual bool Visit(const WorkListUnit &U) = 0;
};
virtual bool VisitItemsInWorkList(Visitor &V) = 0;
- static GRWorkList *MakeDFS();
- static GRWorkList *MakeBFS();
- static GRWorkList *MakeBFSBlockDFSContents();
+ static WorkList *MakeDFS();
+ static WorkList *MakeBFS();
+ static WorkList *MakeBFSBlockDFSContents();
};
} // end GR namespace
//
//===----------------------------------------------------------------------===//
-#include "clang/GR/PathSensitive/GRExprEngine.h"
+#include "clang/GR/PathSensitive/ExprEngine.h"
#include "clang/AST/StmtVisitor.h"
using namespace clang;
/// is used for evaluating exprs of C++ object type. Evaluating such exprs
/// requires a destination pointer pointing to the object being evaluated
/// into. Passing such a pointer around would pollute the Visit* interface of
-/// GRExprEngine. AggExprVisitor encapsulates code that goes through various
+/// ExprEngine. AggExprVisitor encapsulates code that goes through various
/// cast and construct exprs (and others), and at the final point, dispatches
-/// back to the GRExprEngine to let the real evaluation logic happen.
+/// back to the ExprEngine to let the real evaluation logic happen.
class AggExprVisitor : public StmtVisitor<AggExprVisitor> {
const MemRegion *Dest;
ExplodedNode *Pred;
ExplodedNodeSet &DstSet;
- GRExprEngine &Eng;
+ ExprEngine &Eng;
public:
AggExprVisitor(const MemRegion *dest, ExplodedNode *N, ExplodedNodeSet &dst,
- GRExprEngine &eng)
+ ExprEngine &eng)
: Dest(dest), Pred(N), DstSet(dst), Eng(eng) {}
void VisitCastExpr(CastExpr *E);
Eng.VisitCXXConstructExpr(E, Dest, Pred, DstSet);
}
-void GRExprEngine::VisitAggExpr(const Expr *E, const MemRegion *Dest,
+void ExprEngine::VisitAggExpr(const Expr *E, const MemRegion *Dest,
ExplodedNode *Pred, ExplodedNodeSet &Dst) {
AggExprVisitor(Dest, Pred, Dst, *this).Visit(const_cast<Expr *>(E));
}
#include "clang/GR/BugReporter/PathDiagnostic.h"
#include "clang/GR/PathSensitive/AnalysisManager.h"
#include "clang/GR/BugReporter/BugReporter.h"
-#include "clang/GR/PathSensitive/GRExprEngine.h"
-#include "clang/GR/PathSensitive/GRTransferFuncs.h"
+#include "clang/GR/PathSensitive/ExprEngine.h"
+#include "clang/GR/PathSensitive/TransferFuncs.h"
#include "clang/GR/PathDiagnosticClients.h"
// FIXME: Restructure checker registration.
-#include "Checkers/GRExprEngineExperimentalChecks.h"
-#include "Checkers/GRExprEngineInternalChecks.h"
+#include "Checkers/ExprEngineExperimentalChecks.h"
+#include "Checkers/ExprEngineInternalChecks.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/SourceManager.h"
}
-static void ActionGRExprEngine(AnalysisConsumer &C, AnalysisManager& mgr,
+static void ActionExprEngine(AnalysisConsumer &C, AnalysisManager& mgr,
Decl *D,
- GRTransferFuncs* tf) {
+ TransferFuncs* tf) {
- llvm::OwningPtr<GRTransferFuncs> TF(tf);
+ llvm::OwningPtr<TransferFuncs> TF(tf);
// Construct the analysis engine. We first query for the LiveVariables
// information to see if the CFG is valid.
// FIXME: Inter-procedural analysis will need to handle invalid CFGs.
if (!mgr.getLiveVariables(D))
return;
- GRExprEngine Eng(mgr, TF.take());
+ ExprEngine Eng(mgr, TF.take());
if (C.Opts.EnableExperimentalInternalChecks)
RegisterExperimentalInternalChecks(Eng);
static void ActionObjCMemCheckerAux(AnalysisConsumer &C, AnalysisManager& mgr,
Decl *D, bool GCEnabled) {
- GRTransferFuncs* TF = MakeCFRefCountTF(mgr.getASTContext(),
+ TransferFuncs* TF = MakeCFRefCountTF(mgr.getASTContext(),
GCEnabled,
mgr.getLangOptions());
- ActionGRExprEngine(C, mgr, D, TF);
+ ActionExprEngine(C, mgr, D, TF);
}
static void ActionObjCMemChecker(AnalysisConsumer &C, AnalysisManager& mgr,
#include "clang/GR/BugReporter/BugReporter.h"
// FIXME: Restructure checker registration.
-#include "Checkers/GRExprEngineExperimentalChecks.h"
+#include "Checkers/ExprEngineExperimentalChecks.h"
#include "clang/Basic/SourceManager.h"
#include "llvm/ADT/SmallPtrSet.h"
class AnalyzerStatsChecker : public CheckerVisitor<AnalyzerStatsChecker> {
public:
static void *getTag();
- void VisitEndAnalysis(ExplodedGraph &G, BugReporter &B, GRExprEngine &Eng);
+ void VisitEndAnalysis(ExplodedGraph &G, BugReporter &B, ExprEngine &Eng);
private:
llvm::SmallPtrSet<const CFGBlock*, 256> reachable;
return &x;
}
-void GR::RegisterAnalyzerStatsChecker(GRExprEngine &Eng) {
+void GR::RegisterAnalyzerStatsChecker(ExprEngine &Eng) {
Eng.registerCheck(new AnalyzerStatsChecker());
}
void AnalyzerStatsChecker::VisitEndAnalysis(ExplodedGraph &G,
BugReporter &B,
- GRExprEngine &Eng) {
+ ExprEngine &Eng) {
const CFG *C = 0;
const Decl *D = 0;
const LocationContext *LC = 0;
D->getLocation());
// Emit warning for each block we bailed out on
- typedef GRCoreEngine::BlocksAborted::const_iterator AbortedIterator;
- const GRCoreEngine &CE = Eng.getCoreEngine();
+ typedef CoreEngine::BlocksAborted::const_iterator AbortedIterator;
+ const CoreEngine &CE = Eng.getCoreEngine();
for (AbortedIterator I = CE.blocks_aborted_begin(),
E = CE.blocks_aborted_end(); I != E; ++I) {
const BlockEdge &BE = I->first;
#include "SimpleConstraintManager.h"
#include "clang/GR/PathSensitive/GRState.h"
#include "clang/GR/PathSensitive/GRStateTrait.h"
-#include "clang/GR/PathSensitive/GRTransferFuncs.h"
+#include "clang/GR/PathSensitive/TransferFuncs.h"
#include "llvm/Support/raw_ostream.h"
using namespace clang;
: public SimpleConstraintManager {
GRState::IntSetTy::Factory ISetFactory;
public:
- BasicConstraintManager(GRStateManager &statemgr, GRSubEngine &subengine)
+ BasicConstraintManager(GRStateManager &statemgr, SubEngine &subengine)
: SimpleConstraintManager(subengine),
ISetFactory(statemgr.getAllocator()) {}
} // end anonymous namespace
ConstraintManager* GR::CreateBasicConstraintManager(GRStateManager& statemgr,
- GRSubEngine &subengine) {
+ SubEngine &subengine) {
return new BasicConstraintManager(statemgr, subengine);
}
return store;
}
- /// ArrayToPointer - Used by GRExprEngine::VistCast to handle implicit
+ /// ArrayToPointer - Used by ExprEngine::VistCast to handle implicit
/// conversions between arrays and pointers.
SVal ArrayToPointer(Loc Array) { return Array; }
//===----------------------------------------------------------------------===//
//
// This file defines BasicValueFactory, a class that manages the lifetime
-// of APSInt objects and symbolic constraints used by GRExprEngine
+// of APSInt objects and symbolic constraints used by ExprEngine
// and related classes.
//
//===----------------------------------------------------------------------===//
-//==- GRBlockCounter.h - ADT for counting block visits -------------*- C++ -*-//
+//==- BlockCounter.h - ADT for counting block visits -------------*- C++ -*-//
//
// The LLVM Compiler Infrastructure
//
//
//===----------------------------------------------------------------------===//
//
-// This file defines GRBlockCounter, an abstract data type used to count
+// This file defines BlockCounter, an abstract data type used to count
// the number of times a given block has been visited along a path
-// analyzed by GRCoreEngine.
+// analyzed by CoreEngine.
//
//===----------------------------------------------------------------------===//
-#include "clang/GR/PathSensitive/GRBlockCounter.h"
+#include "clang/GR/PathSensitive/BlockCounter.h"
#include "llvm/ADT/ImmutableMap.h"
using namespace clang;
return *static_cast<CountMap::Factory*>(F);
}
-unsigned GRBlockCounter::getNumVisited(const StackFrameContext *CallSite,
+unsigned BlockCounter::getNumVisited(const StackFrameContext *CallSite,
unsigned BlockID) const {
CountMap M = GetMap(Data);
CountMap::data_type* T = M.lookup(CountKey(CallSite, BlockID));
return T ? *T : 0;
}
-GRBlockCounter::Factory::Factory(llvm::BumpPtrAllocator& Alloc) {
+BlockCounter::Factory::Factory(llvm::BumpPtrAllocator& Alloc) {
F = new CountMap::Factory(Alloc);
}
-GRBlockCounter::Factory::~Factory() {
+BlockCounter::Factory::~Factory() {
delete static_cast<CountMap::Factory*>(F);
}
-GRBlockCounter
-GRBlockCounter::Factory::IncrementCount(GRBlockCounter BC,
+BlockCounter
+BlockCounter::Factory::IncrementCount(BlockCounter BC,
const StackFrameContext *CallSite,
unsigned BlockID) {
- return GRBlockCounter(GetFactory(F).add(GetMap(BC.Data),
+ return BlockCounter(GetFactory(F).add(GetMap(BC.Data),
CountKey(CallSite, BlockID),
BC.getNumVisited(CallSite, BlockID)+1).getRoot());
}
-GRBlockCounter
-GRBlockCounter::Factory::GetEmptyCounter() {
- return GRBlockCounter(GetFactory(F).getEmptyMap().getRoot());
+BlockCounter
+BlockCounter::Factory::GetEmptyCounter() {
+ return BlockCounter(GetFactory(F).getEmptyMap().getRoot());
}
#include "clang/GR/BugReporter/BugReporter.h"
#include "clang/GR/BugReporter/BugType.h"
-#include "clang/GR/PathSensitive/GRExprEngine.h"
+#include "clang/GR/PathSensitive/ExprEngine.h"
#include "clang/AST/ASTContext.h"
#include "clang/Analysis/CFG.h"
#include "clang/AST/Expr.h"
#include "clang/GR/Checkers/LocalCheckers.h"
#include "clang/Analysis/DomainSpecific/CocoaConventions.h"
#include "clang/GR/PathSensitive/CheckerVisitor.h"
-#include "clang/GR/PathSensitive/GRExprEngineBuilders.h"
+#include "clang/GR/PathSensitive/ExprEngineBuilders.h"
#include "clang/GR/PathSensitive/GRStateTrait.h"
-#include "clang/GR/PathSensitive/GRTransferFuncs.h"
+#include "clang/GR/PathSensitive/TransferFuncs.h"
#include "clang/GR/PathSensitive/SymbolManager.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/FoldingSet.h"
namespace {
class GenericNodeBuilder {
- GRStmtNodeBuilder *SNB;
+ StmtNodeBuilder *SNB;
const Stmt *S;
const void *tag;
- GREndPathNodeBuilder *ENB;
+ EndPathNodeBuilder *ENB;
public:
- GenericNodeBuilder(GRStmtNodeBuilder &snb, const Stmt *s,
+ GenericNodeBuilder(StmtNodeBuilder &snb, const Stmt *s,
const void *t)
: SNB(&snb), S(s), tag(t), ENB(0) {}
- GenericNodeBuilder(GREndPathNodeBuilder &enb)
+ GenericNodeBuilder(EndPathNodeBuilder &enb)
: SNB(0), S(0), tag(0), ENB(&enb) {}
ExplodedNode *MakeNode(const GRState *state, ExplodedNode *Pred) {
namespace {
-class CFRefCount : public GRTransferFuncs {
+class CFRefCount : public TransferFuncs {
public:
class BindingsPrinter : public GRState::Printer {
public:
RefVal::Kind& hasErr);
void ProcessNonLeakError(ExplodedNodeSet& Dst,
- GRStmtNodeBuilder& Builder,
+ StmtNodeBuilder& Builder,
const Expr* NodeExpr, SourceRange ErrorRange,
ExplodedNode* Pred,
const GRState* St,
ExplodedNode* ProcessLeaks(const GRState * state,
llvm::SmallVectorImpl<SymbolRef> &Leaked,
GenericNodeBuilder &Builder,
- GRExprEngine &Eng,
+ ExprEngine &Eng,
ExplodedNode *Pred = 0);
public:
virtual ~CFRefCount() {}
- void RegisterChecks(GRExprEngine &Eng);
+ void RegisterChecks(ExprEngine &Eng);
virtual void RegisterPrinters(std::vector<GRState::Printer*>& Printers) {
Printers.push_back(new BindingsPrinter());
// Calls.
void evalSummary(ExplodedNodeSet& Dst,
- GRExprEngine& Eng,
- GRStmtNodeBuilder& Builder,
+ ExprEngine& Eng,
+ StmtNodeBuilder& Builder,
const Expr* Ex,
InstanceReceiver Receiver,
const RetainSummary& Summ,
ExplodedNode* Pred, const GRState *state);
virtual void evalCall(ExplodedNodeSet& Dst,
- GRExprEngine& Eng,
- GRStmtNodeBuilder& Builder,
+ ExprEngine& Eng,
+ StmtNodeBuilder& Builder,
const CallExpr* CE, SVal L,
ExplodedNode* Pred);
virtual void evalObjCMessageExpr(ExplodedNodeSet& Dst,
- GRExprEngine& Engine,
- GRStmtNodeBuilder& Builder,
+ ExprEngine& Engine,
+ StmtNodeBuilder& Builder,
const ObjCMessageExpr* ME,
ExplodedNode* Pred,
const GRState *state);
// Stores.
- virtual void evalBind(GRStmtNodeBuilderRef& B, SVal location, SVal val);
+ virtual void evalBind(StmtNodeBuilderRef& B, SVal location, SVal val);
// End-of-path.
- virtual void evalEndPath(GRExprEngine& Engine,
- GREndPathNodeBuilder& Builder);
+ virtual void evalEndPath(ExprEngine& Engine,
+ EndPathNodeBuilder& Builder);
virtual void evalDeadSymbols(ExplodedNodeSet& Dst,
- GRExprEngine& Engine,
- GRStmtNodeBuilder& Builder,
+ ExprEngine& Engine,
+ StmtNodeBuilder& Builder,
ExplodedNode* Pred,
const GRState* state,
SymbolReaper& SymReaper);
std::pair<ExplodedNode*, const GRState *>
HandleAutoreleaseCounts(const GRState * state, GenericNodeBuilder Bd,
- ExplodedNode* Pred, GRExprEngine &Eng,
+ ExplodedNode* Pred, ExprEngine &Eng,
SymbolRef Sym, RefVal V, bool &stop);
// Return statements.
virtual void evalReturn(ExplodedNodeSet& Dst,
- GRExprEngine& Engine,
- GRStmtNodeBuilder& Builder,
+ ExprEngine& Engine,
+ StmtNodeBuilder& Builder,
const ReturnStmt* S,
ExplodedNode* Pred);
public:
CFRefLeakReport(CFRefBug& D, const CFRefCount &tf,
ExplodedNode *n, SymbolRef sym,
- GRExprEngine& Eng);
+ ExprEngine& Eng);
PathDiagnosticPiece* getEndPath(BugReporterContext& BRC,
const ExplodedNode* N);
CFRefLeakReport::CFRefLeakReport(CFRefBug& D, const CFRefCount &tf,
ExplodedNode *n,
- SymbolRef sym, GRExprEngine& Eng)
+ SymbolRef sym, ExprEngine& Eng)
: CFRefReport(D, tf, n, sym) {
// Most bug reports are cached at the location where they occured.
}
void CFRefCount::evalSummary(ExplodedNodeSet& Dst,
- GRExprEngine& Eng,
- GRStmtNodeBuilder& Builder,
+ ExprEngine& Eng,
+ StmtNodeBuilder& Builder,
const Expr* Ex,
InstanceReceiver Receiver,
const RetainSummary& Summ,
void CFRefCount::evalCall(ExplodedNodeSet& Dst,
- GRExprEngine& Eng,
- GRStmtNodeBuilder& Builder,
+ ExprEngine& Eng,
+ StmtNodeBuilder& Builder,
const CallExpr* CE, SVal L,
ExplodedNode* Pred) {
}
void CFRefCount::evalObjCMessageExpr(ExplodedNodeSet& Dst,
- GRExprEngine& Eng,
- GRStmtNodeBuilder& Builder,
+ ExprEngine& Eng,
+ StmtNodeBuilder& Builder,
const ObjCMessageExpr* ME,
ExplodedNode* Pred,
const GRState *state) {
} // end anonymous namespace
-void CFRefCount::evalBind(GRStmtNodeBuilderRef& B, SVal location, SVal val) {
+void CFRefCount::evalBind(StmtNodeBuilderRef& B, SVal location, SVal val) {
// Are we storing to something that causes the value to "escape"?
bool escapes = false;
// Return statements.
void CFRefCount::evalReturn(ExplodedNodeSet& Dst,
- GRExprEngine& Eng,
- GRStmtNodeBuilder& Builder,
+ ExprEngine& Eng,
+ StmtNodeBuilder& Builder,
const ReturnStmt* S,
ExplodedNode* Pred) {
std::pair<ExplodedNode*, const GRState *>
CFRefCount::HandleAutoreleaseCounts(const GRState * state, GenericNodeBuilder Bd,
ExplodedNode* Pred,
- GRExprEngine &Eng,
+ ExprEngine &Eng,
SymbolRef Sym, RefVal V, bool &stop) {
unsigned ACnt = V.getAutoreleaseCount();
CFRefCount::ProcessLeaks(const GRState * state,
llvm::SmallVectorImpl<SymbolRef> &Leaked,
GenericNodeBuilder &Builder,
- GRExprEngine& Eng,
+ ExprEngine& Eng,
ExplodedNode *Pred) {
if (Leaked.empty())
return N;
}
-void CFRefCount::evalEndPath(GRExprEngine& Eng,
- GREndPathNodeBuilder& Builder) {
+void CFRefCount::evalEndPath(ExprEngine& Eng,
+ EndPathNodeBuilder& Builder) {
const GRState *state = Builder.getState();
GenericNodeBuilder Bd(Builder);
}
void CFRefCount::evalDeadSymbols(ExplodedNodeSet& Dst,
- GRExprEngine& Eng,
- GRStmtNodeBuilder& Builder,
+ ExprEngine& Eng,
+ StmtNodeBuilder& Builder,
ExplodedNode* Pred,
const GRState* state,
SymbolReaper& SymReaper) {
}
void CFRefCount::ProcessNonLeakError(ExplodedNodeSet& Dst,
- GRStmtNodeBuilder& Builder,
+ StmtNodeBuilder& Builder,
const Expr* NodeExpr,
SourceRange ErrorRange,
ExplodedNode* Pred,
// Transfer function creation for external clients.
//===----------------------------------------------------------------------===//
-void CFRefCount::RegisterChecks(GRExprEngine& Eng) {
+void CFRefCount::RegisterChecks(ExprEngine& Eng) {
BugReporter &BR = Eng.getBugReporter();
useAfterRelease = new UseAfterRelease(this);
// Save the reference to the BugReporter.
this->BR = &BR;
- // Register the RetainReleaseChecker with the GRExprEngine object.
+ // Register the RetainReleaseChecker with the ExprEngine object.
// Functionality in CFRefCount will be migrated to RetainReleaseChecker
// over time.
Eng.registerCheck(new RetainReleaseChecker(this));
}
-GRTransferFuncs* GR::MakeCFRefCountTF(ASTContext& Ctx, bool GCEnabled,
+TransferFuncs* GR::MakeCFRefCountTF(ASTContext& Ctx, bool GCEnabled,
const LangOptions& lopts) {
return new CFRefCount(Ctx, GCEnabled, lopts);
}
ExplodedGraph.cpp
FlatStore.cpp
FrontendActions.cpp
- GRBlockCounter.cpp
- GRCXXExprEngine.cpp
- GRCoreEngine.cpp
- GRExprEngine.cpp
+ BlockCounter.cpp
+ CXXExprEngine.cpp
+ CoreEngine.cpp
+ ExprEngine.cpp
GRState.cpp
HTMLDiagnostics.cpp
ManagerRegistry.cpp
//===----------------------------------------------------------------------===//
#include "clang/GR/PathSensitive/AnalysisManager.h"
-#include "clang/GR/PathSensitive/GRExprEngine.h"
+#include "clang/GR/PathSensitive/ExprEngine.h"
#include "clang/AST/DeclCXX.h"
using namespace clang;
};
}
-void GRExprEngine::evalArguments(ConstExprIterator AI, ConstExprIterator AE,
+void ExprEngine::evalArguments(ConstExprIterator AI, ConstExprIterator AE,
const FunctionProtoType *FnType,
ExplodedNode *Pred, ExplodedNodeSet &Dst,
bool FstArgAsLValue) {
}
}
-const CXXThisRegion *GRExprEngine::getCXXThisRegion(const CXXRecordDecl *D,
+const CXXThisRegion *ExprEngine::getCXXThisRegion(const CXXRecordDecl *D,
const StackFrameContext *SFC) {
Type *T = D->getTypeForDecl();
QualType PT = getContext().getPointerType(QualType(T, 0));
return svalBuilder.getRegionManager().getCXXThisRegion(PT, SFC);
}
-const CXXThisRegion *GRExprEngine::getCXXThisRegion(const CXXMethodDecl *decl,
+const CXXThisRegion *ExprEngine::getCXXThisRegion(const CXXMethodDecl *decl,
const StackFrameContext *frameCtx) {
return svalBuilder.getRegionManager().
getCXXThisRegion(decl->getThisType(getContext()), frameCtx);
}
-void GRExprEngine::CreateCXXTemporaryObject(const Expr *Ex, ExplodedNode *Pred,
+void ExprEngine::CreateCXXTemporaryObject(const Expr *Ex, ExplodedNode *Pred,
ExplodedNodeSet &Dst) {
ExplodedNodeSet Tmp;
Visit(Ex, Pred, Tmp);
}
}
-void GRExprEngine::VisitCXXConstructExpr(const CXXConstructExpr *E,
+void ExprEngine::VisitCXXConstructExpr(const CXXConstructExpr *E,
const MemRegion *Dest,
ExplodedNode *Pred,
ExplodedNodeSet &Dst) {
}
}
-void GRExprEngine::VisitCXXDestructor(const CXXDestructorDecl *DD,
+void ExprEngine::VisitCXXDestructor(const CXXDestructorDecl *DD,
const MemRegion *Dest,
const Stmt *S,
ExplodedNode *Pred,
Dst.Add(N);
}
-void GRExprEngine::VisitCXXMemberCallExpr(const CXXMemberCallExpr *MCE,
+void ExprEngine::VisitCXXMemberCallExpr(const CXXMemberCallExpr *MCE,
ExplodedNode *Pred,
ExplodedNodeSet &Dst) {
// Get the method type.
evalMethodCall(MCE, MD, ObjArgExpr, Pred, AllargsEvaluated, Dst);
}
-void GRExprEngine::VisitCXXOperatorCallExpr(const CXXOperatorCallExpr *C,
+void ExprEngine::VisitCXXOperatorCallExpr(const CXXOperatorCallExpr *C,
ExplodedNode *Pred,
ExplodedNodeSet &Dst) {
const CXXMethodDecl *MD = dyn_cast_or_null<CXXMethodDecl>(C->getCalleeDecl());
evalMethodCall(C, MD, C->getArg(0), Pred, argsEvaluated, Dst);
}
-void GRExprEngine::evalMethodCall(const CallExpr *MCE, const CXXMethodDecl *MD,
+void ExprEngine::evalMethodCall(const CallExpr *MCE, const CXXMethodDecl *MD,
const Expr *ThisExpr, ExplodedNode *Pred,
ExplodedNodeSet &Src, ExplodedNodeSet &Dst) {
// Allow checkers to pre-visit the member call.
}
}
-void GRExprEngine::VisitCXXNewExpr(const CXXNewExpr *CNE, ExplodedNode *Pred,
+void ExprEngine::VisitCXXNewExpr(const CXXNewExpr *CNE, ExplodedNode *Pred,
ExplodedNodeSet &Dst) {
if (CNE->isArray()) {
// FIXME: allocating an array has not been handled.
}
}
-void GRExprEngine::VisitCXXDeleteExpr(const CXXDeleteExpr *CDE,
+void ExprEngine::VisitCXXDeleteExpr(const CXXDeleteExpr *CDE,
ExplodedNode *Pred,ExplodedNodeSet &Dst) {
// Should do more checking.
ExplodedNodeSet Argevaluated;
}
}
-void GRExprEngine::VisitCXXThisExpr(const CXXThisExpr *TE, ExplodedNode *Pred,
+void ExprEngine::VisitCXXThisExpr(const CXXThisExpr *TE, ExplodedNode *Pred,
ExplodedNodeSet &Dst) {
// Get the this object region from StoreManager.
const MemRegion *R =
//
//===----------------------------------------------------------------------===//
-#include "GRExprEngineInternalChecks.h"
+#include "ExprEngineInternalChecks.h"
#include "clang/GR/BugReporter/BugReporter.h"
-#include "clang/GR/PathSensitive/GRExprEngine.h"
+#include "clang/GR/PathSensitive/ExprEngine.h"
#include "clang/GR/PathSensitive/CheckerVisitor.h"
using namespace clang;
};
}
-void GR::RegisterAdjustedReturnValueChecker(GRExprEngine &Eng) {
+void GR::RegisterAdjustedReturnValueChecker(ExprEngine &Eng) {
Eng.registerCheck(new AdjustedReturnValueChecker());
}
//
//===----------------------------------------------------------------------===//
-#include "GRExprEngineInternalChecks.h"
+#include "ExprEngineInternalChecks.h"
#include "clang/GR/BugReporter/BugType.h"
#include "clang/GR/PathSensitive/CheckerVisitor.h"
-#include "clang/GR/PathSensitive/GRExprEngine.h"
+#include "clang/GR/PathSensitive/ExprEngine.h"
using namespace clang;
using namespace GR;
};
}
-void GR::RegisterArrayBoundChecker(GRExprEngine &Eng) {
+void GR::RegisterArrayBoundChecker(ExprEngine &Eng) {
Eng.registerCheck(new ArrayBoundChecker());
}
//
//===----------------------------------------------------------------------===//
//
-// This defines AttrNonNullChecker, a builtin check in GRExprEngine that
+// This defines AttrNonNullChecker, a builtin check in ExprEngine that
// performs checks for arguments declared to have nonnull attribute.
//
//===----------------------------------------------------------------------===//
-#include "GRExprEngineInternalChecks.h"
+#include "ExprEngineInternalChecks.h"
#include "clang/GR/BugReporter/BugType.h"
#include "clang/GR/PathSensitive/CheckerVisitor.h"
};
} // end anonymous namespace
-void GR::RegisterAttrNonNullChecker(GRExprEngine &Eng) {
+void GR::RegisterAttrNonNullChecker(ExprEngine &Eng) {
Eng.registerCheck(new AttrNonNullChecker());
}
#include "clang/GR/PathSensitive/ExplodedGraph.h"
#include "clang/GR/PathSensitive/CheckerVisitor.h"
-#include "clang/GR/PathSensitive/GRExprEngine.h"
+#include "clang/GR/PathSensitive/ExprEngine.h"
#include "clang/GR/PathSensitive/GRState.h"
#include "clang/GR/BugReporter/BugType.h"
#include "clang/GR/PathSensitive/MemRegion.h"
// Check registration.
//===----------------------------------------------------------------------===//
-void GR::RegisterAppleChecks(GRExprEngine& Eng, const Decl &D) {
+void GR::RegisterAppleChecks(ExprEngine& Eng, const Decl &D) {
Eng.registerCheck(new NilArgChecker());
Eng.registerCheck(new CFNumberCreateChecker());
RegisterNSErrorChecks(Eng.getBugReporter(), Eng, D);
namespace GR {
class BugReporter;
-class GRExprEngine;
+class ExprEngine;
-void RegisterNSErrorChecks(BugReporter& BR, GRExprEngine &Eng, const Decl &D);
-void RegisterNSAutoreleasePoolChecks(GRExprEngine &Eng);
+void RegisterNSErrorChecks(BugReporter& BR, ExprEngine &Eng, const Decl &D);
+void RegisterNSAutoreleasePoolChecks(ExprEngine &Eng);
} // end GR namespace
//
//===----------------------------------------------------------------------===//
-#include "GRExprEngineInternalChecks.h"
+#include "ExprEngineInternalChecks.h"
#include "clang/GR/PathSensitive/Checker.h"
#include "clang/Basic/Builtins.h"
}
-void GR::RegisterBuiltinFunctionChecker(GRExprEngine &Eng) {
+void GR::RegisterBuiltinFunctionChecker(ExprEngine &Eng) {
Eng.registerCheck(new BuiltinFunctionChecker());
}
DereferenceChecker.cpp
DivZeroChecker.cpp
FixedAddressChecker.cpp
- GRExprEngineExperimentalChecks.cpp
+ ExprEngineExperimentalChecks.cpp
IdempotentOperationChecker.cpp
LLVMConventionsChecker.cpp
MacOSXAPIChecker.cpp
//
//===----------------------------------------------------------------------===//
-#include "GRExprEngineExperimentalChecks.h"
+#include "ExprEngineExperimentalChecks.h"
#include "clang/GR/BugReporter/BugType.h"
#include "clang/GR/PathSensitive/CheckerVisitor.h"
#include "clang/GR/PathSensitive/GRStateTrait.h"
}
}
-void GR::RegisterCStringChecker(GRExprEngine &Eng) {
+void GR::RegisterCStringChecker(ExprEngine &Eng) {
Eng.registerCheck(new CStringChecker());
}
//
//===----------------------------------------------------------------------===//
-#include "GRExprEngineInternalChecks.h"
+#include "ExprEngineInternalChecks.h"
#include "clang/AST/ParentMap.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/GR/BugReporter/BugType.h"
};
} // end anonymous namespace
-void GR::RegisterCallAndMessageChecker(GRExprEngine &Eng) {
+void GR::RegisterCallAndMessageChecker(ExprEngine &Eng) {
Eng.registerCheck(new CallAndMessageChecker());
}
#include "clang/AST/CharUnits.h"
#include "clang/GR/BugReporter/BugType.h"
#include "clang/GR/PathSensitive/CheckerVisitor.h"
-#include "GRExprEngineInternalChecks.h"
+#include "ExprEngineInternalChecks.h"
using namespace clang;
using namespace GR;
}
-void GR::RegisterCastSizeChecker(GRExprEngine &Eng) {
+void GR::RegisterCastSizeChecker(ExprEngine &Eng) {
Eng.registerCheck(new CastSizeChecker());
}
#include "clang/GR/BugReporter/BugType.h"
#include "clang/GR/PathSensitive/CheckerVisitor.h"
-#include "GRExprEngineInternalChecks.h"
+#include "ExprEngineInternalChecks.h"
using namespace clang;
using namespace GR;
}
}
-void GR::RegisterCastToStructChecker(GRExprEngine &Eng) {
+void GR::RegisterCastToStructChecker(ExprEngine &Eng) {
Eng.registerCheck(new CastToStructChecker());
}
#include "clang/Analysis/Analyses/LiveVariables.h"
#include "clang/Analysis/Visitors/CFGRecStmtVisitor.h"
#include "clang/GR/BugReporter/BugReporter.h"
-#include "clang/GR/PathSensitive/GRExprEngine.h"
+#include "clang/GR/PathSensitive/ExprEngine.h"
#include "clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/AST/ASTContext.h"
//
//===----------------------------------------------------------------------===//
-#include "GRExprEngineExperimentalChecks.h"
+#include "ExprEngineExperimentalChecks.h"
#include "clang/GR/BugReporter/BugType.h"
#include "clang/GR/PathSensitive/CheckerVisitor.h"
#include "clang/GR/PathSensitive/GRState.h"
} // end anonymous namespace
-void GR::RegisterChrootChecker(GRExprEngine &Eng) {
+void GR::RegisterChrootChecker(ExprEngine &Eng) {
Eng.registerCheck(new ChrootChecker());
}
//
//===----------------------------------------------------------------------===//
//
-// This defines NullDerefChecker, a builtin check in GRExprEngine that performs
+// This defines NullDerefChecker, a builtin check in ExprEngine that performs
// checks for null pointers at loads and stores.
//
//===----------------------------------------------------------------------===//
-#include "GRExprEngineInternalChecks.h"
+#include "ExprEngineInternalChecks.h"
#include "clang/GR/BugReporter/BugType.h"
#include "clang/GR/Checkers/DereferenceChecker.h"
#include "clang/GR/PathSensitive/Checker.h"
-#include "clang/GR/PathSensitive/GRExprEngine.h"
+#include "clang/GR/PathSensitive/ExprEngine.h"
using namespace clang;
using namespace GR;
};
} // end anonymous namespace
-void GR::RegisterDereferenceChecker(GRExprEngine &Eng) {
+void GR::RegisterDereferenceChecker(ExprEngine &Eng) {
Eng.registerCheck(new DereferenceChecker());
}
std::pair<ExplodedNode * const *, ExplodedNode * const *>
-GR::GetImplicitNullDereferences(GRExprEngine &Eng) {
+GR::GetImplicitNullDereferences(ExprEngine &Eng) {
DereferenceChecker *checker = Eng.getChecker<DereferenceChecker>();
if (!checker)
return std::make_pair((ExplodedNode * const *) 0,
//
//===----------------------------------------------------------------------===//
//
-// This defines DivZeroChecker, a builtin check in GRExprEngine that performs
+// This defines DivZeroChecker, a builtin check in ExprEngine that performs
// checks for division by zeros.
//
//===----------------------------------------------------------------------===//
-#include "GRExprEngineInternalChecks.h"
+#include "ExprEngineInternalChecks.h"
#include "clang/GR/BugReporter/BugType.h"
#include "clang/GR/PathSensitive/CheckerVisitor.h"
};
} // end anonymous namespace
-void GR::RegisterDivZeroChecker(GRExprEngine &Eng) {
+void GR::RegisterDivZeroChecker(ExprEngine &Eng) {
Eng.registerCheck(new DivZeroChecker());
}
-//=-- GRExprEngineExperimentalChecks.h ------------------------------*- C++ -*-=
+//=-- ExprEngineExperimentalChecks.h ------------------------------*- C++ -*-=
//
// The LLVM Compiler Infrastructure
//
//===----------------------------------------------------------------------===//
//
// This file defines functions to instantiate and register experimental
-// checks in GRExprEngine.
+// checks in ExprEngine.
//
//===----------------------------------------------------------------------===//
-#include "GRExprEngineInternalChecks.h"
-#include "GRExprEngineExperimentalChecks.h"
+#include "ExprEngineInternalChecks.h"
+#include "ExprEngineExperimentalChecks.h"
#include "clang/GR/Checkers/LocalCheckers.h"
using namespace clang;
using namespace GR;
-void GR::RegisterExperimentalChecks(GRExprEngine &Eng) {
+void GR::RegisterExperimentalChecks(ExprEngine &Eng) {
// These are checks that never belong as internal checks
- // within GRExprEngine.
+ // within ExprEngine.
RegisterCStringChecker(Eng);
RegisterChrootChecker(Eng);
RegisterMallocChecker(Eng);
RegisterUnreachableCodeChecker(Eng);
}
-void GR::RegisterExperimentalInternalChecks(GRExprEngine &Eng) {
+void GR::RegisterExperimentalInternalChecks(ExprEngine &Eng) {
// These are internal checks that should eventually migrate to
// RegisterInternalChecks() once they have been further tested.
--- /dev/null
+//=-- ExprEngineExperimentalChecks.h ------------------------------*- 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 functions to instantiate and register experimental
+// checks in ExprEngine.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_GR_ExprEngine_EXPERIMENTAL_CHECKS
+#define LLVM_CLANG_GR_ExprEngine_EXPERIMENTAL_CHECKS
+
+namespace clang {
+
+namespace GR {
+
+class ExprEngine;
+
+void RegisterAnalyzerStatsChecker(ExprEngine &Eng);
+void RegisterChrootChecker(ExprEngine &Eng);
+void RegisterCStringChecker(ExprEngine &Eng);
+void RegisterIdempotentOperationChecker(ExprEngine &Eng);
+void RegisterMallocChecker(ExprEngine &Eng);
+void RegisterPthreadLockChecker(ExprEngine &Eng);
+void RegisterStreamChecker(ExprEngine &Eng);
+void RegisterUnreachableCodeChecker(ExprEngine &Eng);
+
+} // end GR namespace
+
+} // end clang namespace
+
+#endif
--- /dev/null
+//=-- ExprEngineInternalChecks.h- Builtin ExprEngine Checks -----*- 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 functions to instantiate and register the "built-in"
+// checks in ExprEngine.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_GR_ExprEngine_INTERNAL_CHECKS
+#define LLVM_CLANG_GR_ExprEngine_INTERNAL_CHECKS
+
+namespace clang {
+
+namespace GR {
+
+class ExprEngine;
+
+// Foundational checks that handle basic semantics.
+void RegisterAdjustedReturnValueChecker(ExprEngine &Eng);
+void RegisterArrayBoundChecker(ExprEngine &Eng);
+void RegisterAttrNonNullChecker(ExprEngine &Eng);
+void RegisterBuiltinFunctionChecker(ExprEngine &Eng);
+void RegisterCallAndMessageChecker(ExprEngine &Eng);
+void RegisterCastToStructChecker(ExprEngine &Eng);
+void RegisterCastSizeChecker(ExprEngine &Eng);
+void RegisterDereferenceChecker(ExprEngine &Eng);
+void RegisterDivZeroChecker(ExprEngine &Eng);
+void RegisterFixedAddressChecker(ExprEngine &Eng);
+void RegisterNoReturnFunctionChecker(ExprEngine &Eng);
+void RegisterObjCAtSyncChecker(ExprEngine &Eng);
+void RegisterPointerArithChecker(ExprEngine &Eng);
+void RegisterPointerSubChecker(ExprEngine &Eng);
+void RegisterReturnPointerRangeChecker(ExprEngine &Eng);
+void RegisterReturnUndefChecker(ExprEngine &Eng);
+void RegisterStackAddrLeakChecker(ExprEngine &Eng);
+void RegisterUndefBranchChecker(ExprEngine &Eng);
+void RegisterUndefCapturedBlockVarChecker(ExprEngine &Eng);
+void RegisterUndefResultChecker(ExprEngine &Eng);
+void RegisterUndefinedArraySubscriptChecker(ExprEngine &Eng);
+void RegisterUndefinedAssignmentChecker(ExprEngine &Eng);
+void RegisterVLASizeChecker(ExprEngine &Eng);
+
+// API checks.
+void RegisterMacOSXAPIChecker(ExprEngine &Eng);
+void RegisterOSAtomicChecker(ExprEngine &Eng);
+void RegisterUnixAPIChecker(ExprEngine &Eng);
+
+} // end GR namespace
+
+} // end clang namespace
+
+#endif
//
//===----------------------------------------------------------------------===//
-#include "GRExprEngineInternalChecks.h"
+#include "ExprEngineInternalChecks.h"
#include "clang/GR/BugReporter/BugType.h"
#include "clang/GR/PathSensitive/CheckerVisitor.h"
}
}
-void GR::RegisterFixedAddressChecker(GRExprEngine &Eng) {
+void GR::RegisterFixedAddressChecker(ExprEngine &Eng) {
Eng.registerCheck(new FixedAddressChecker());
}
+++ /dev/null
-//=-- GRExprEngineExperimentalChecks.h ------------------------------*- 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 functions to instantiate and register experimental
-// checks in GRExprEngine.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_GR_GREXPRENGINE_EXPERIMENTAL_CHECKS
-#define LLVM_CLANG_GR_GREXPRENGINE_EXPERIMENTAL_CHECKS
-
-namespace clang {
-
-namespace GR {
-
-class GRExprEngine;
-
-void RegisterAnalyzerStatsChecker(GRExprEngine &Eng);
-void RegisterChrootChecker(GRExprEngine &Eng);
-void RegisterCStringChecker(GRExprEngine &Eng);
-void RegisterIdempotentOperationChecker(GRExprEngine &Eng);
-void RegisterMallocChecker(GRExprEngine &Eng);
-void RegisterPthreadLockChecker(GRExprEngine &Eng);
-void RegisterStreamChecker(GRExprEngine &Eng);
-void RegisterUnreachableCodeChecker(GRExprEngine &Eng);
-
-} // end GR namespace
-
-} // end clang namespace
-
-#endif
+++ /dev/null
-//=-- GRExprEngineInternalChecks.h- Builtin GRExprEngine Checks -----*- 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 functions to instantiate and register the "built-in"
-// checks in GRExprEngine.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_GR_GREXPRENGINE_INTERNAL_CHECKS
-#define LLVM_CLANG_GR_GREXPRENGINE_INTERNAL_CHECKS
-
-namespace clang {
-
-namespace GR {
-
-class GRExprEngine;
-
-// Foundational checks that handle basic semantics.
-void RegisterAdjustedReturnValueChecker(GRExprEngine &Eng);
-void RegisterArrayBoundChecker(GRExprEngine &Eng);
-void RegisterAttrNonNullChecker(GRExprEngine &Eng);
-void RegisterBuiltinFunctionChecker(GRExprEngine &Eng);
-void RegisterCallAndMessageChecker(GRExprEngine &Eng);
-void RegisterCastToStructChecker(GRExprEngine &Eng);
-void RegisterCastSizeChecker(GRExprEngine &Eng);
-void RegisterDereferenceChecker(GRExprEngine &Eng);
-void RegisterDivZeroChecker(GRExprEngine &Eng);
-void RegisterFixedAddressChecker(GRExprEngine &Eng);
-void RegisterNoReturnFunctionChecker(GRExprEngine &Eng);
-void RegisterObjCAtSyncChecker(GRExprEngine &Eng);
-void RegisterPointerArithChecker(GRExprEngine &Eng);
-void RegisterPointerSubChecker(GRExprEngine &Eng);
-void RegisterReturnPointerRangeChecker(GRExprEngine &Eng);
-void RegisterReturnUndefChecker(GRExprEngine &Eng);
-void RegisterStackAddrLeakChecker(GRExprEngine &Eng);
-void RegisterUndefBranchChecker(GRExprEngine &Eng);
-void RegisterUndefCapturedBlockVarChecker(GRExprEngine &Eng);
-void RegisterUndefResultChecker(GRExprEngine &Eng);
-void RegisterUndefinedArraySubscriptChecker(GRExprEngine &Eng);
-void RegisterUndefinedAssignmentChecker(GRExprEngine &Eng);
-void RegisterVLASizeChecker(GRExprEngine &Eng);
-
-// API checks.
-void RegisterMacOSXAPIChecker(GRExprEngine &Eng);
-void RegisterOSAtomicChecker(GRExprEngine &Eng);
-void RegisterUnixAPIChecker(GRExprEngine &Eng);
-
-} // end GR namespace
-
-} // end clang namespace
-
-#endif
// - Finer grained false positive control (levels)
// - Handling ~0 values
-#include "GRExprEngineExperimentalChecks.h"
+#include "ExprEngineExperimentalChecks.h"
#include "clang/Analysis/CFGStmtMap.h"
#include "clang/Analysis/Analyses/PseudoConstantAnalysis.h"
#include "clang/GR/BugReporter/BugReporter.h"
#include "clang/GR/BugReporter/BugType.h"
#include "clang/GR/PathSensitive/CheckerHelpers.h"
#include "clang/GR/PathSensitive/CheckerVisitor.h"
-#include "clang/GR/PathSensitive/GRCoreEngine.h"
+#include "clang/GR/PathSensitive/CoreEngine.h"
#include "clang/GR/PathSensitive/SVals.h"
#include "clang/AST/Stmt.h"
#include "llvm/ADT/DenseMap.h"
static void *getTag();
void PreVisitBinaryOperator(CheckerContext &C, const BinaryOperator *B);
void PostVisitBinaryOperator(CheckerContext &C, const BinaryOperator *B);
- void VisitEndAnalysis(ExplodedGraph &G, BugReporter &B, GRExprEngine &Eng);
+ void VisitEndAnalysis(ExplodedGraph &G, BugReporter &B, ExprEngine &Eng);
private:
// Our assumption about a particular operation.
bool PathWasCompletelyAnalyzed(const CFG *C,
const CFGBlock *CB,
const CFGStmtMap *CBM,
- const GRCoreEngine &CE);
+ const CoreEngine &CE);
static bool CanVary(const Expr *Ex,
AnalysisContext *AC);
static bool isConstantOrPseudoConstant(const DeclRefExpr *DR,
return &x;
}
-void GR::RegisterIdempotentOperationChecker(GRExprEngine &Eng) {
+void GR::RegisterIdempotentOperationChecker(ExprEngine &Eng) {
Eng.registerCheck(new IdempotentOperationChecker());
}
void IdempotentOperationChecker::VisitEndAnalysis(ExplodedGraph &G,
BugReporter &BR,
- GRExprEngine &Eng) {
+ ExprEngine &Eng) {
BugType *BT = new BugType("Idempotent operation", "Dead code");
// Iterate over the hash to see if we have any paths with definite
// idempotent operations.
const CFG *C,
const CFGBlock *CB,
const CFGStmtMap *CBM,
- const GRCoreEngine &CE) {
+ const CoreEngine &CE) {
// Test for reachability from any aborted blocks to this block
- typedef GRCoreEngine::BlocksAborted::const_iterator AbortedIterator;
+ typedef CoreEngine::BlocksAborted::const_iterator AbortedIterator;
for (AbortedIterator I = CE.blocks_aborted_begin(),
E = CE.blocks_aborted_end(); I != E; ++I) {
const BlockEdge &BE = I->first;
// For the items still on the worklist, see if they are in blocks that
// can eventually reach 'CB'.
- class VisitWL : public GRWorkList::Visitor {
+ class VisitWL : public WorkList::Visitor {
const CFGStmtMap *CBM;
const CFGBlock *TargetBlock;
CFGReachabilityAnalysis &CRA;
VisitWL(const CFGStmtMap *cbm, const CFGBlock *targetBlock,
CFGReachabilityAnalysis &cra)
: CBM(cbm), TargetBlock(targetBlock), CRA(cra) {}
- virtual bool Visit(const GRWorkListUnit &U) {
+ virtual bool Visit(const WorkListUnit &U) {
ProgramPoint P = U.getNode()->getLocation();
const CFGBlock *B = 0;
if (StmtPoint *SP = dyn_cast<StmtPoint>(&P)) {
//
//===----------------------------------------------------------------------===//
-#include "GRExprEngineInternalChecks.h"
+#include "ExprEngineInternalChecks.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/GR/BugReporter/BugType.h"
#include "clang/GR/PathSensitive/CheckerVisitor.h"
};
} //end anonymous namespace
-void GR::RegisterMacOSXAPIChecker(GRExprEngine &Eng) {
+void GR::RegisterMacOSXAPIChecker(ExprEngine &Eng) {
if (Eng.getContext().Target.getTriple().getVendor() == llvm::Triple::Apple)
Eng.registerCheck(new MacOSXAPIChecker());
}
//
//===----------------------------------------------------------------------===//
-#include "GRExprEngineExperimentalChecks.h"
+#include "ExprEngineExperimentalChecks.h"
#include "clang/GR/BugReporter/BugType.h"
#include "clang/GR/PathSensitive/CheckerVisitor.h"
#include "clang/GR/PathSensitive/GRState.h"
static void *getTag();
bool evalCallExpr(CheckerContext &C, const CallExpr *CE);
void evalDeadSymbols(CheckerContext &C, SymbolReaper &SymReaper);
- void evalEndPath(GREndPathNodeBuilder &B, void *tag, GRExprEngine &Eng);
+ void evalEndPath(EndPathNodeBuilder &B, void *tag, ExprEngine &Eng);
void PreVisitReturnStmt(CheckerContext &C, const ReturnStmt *S);
const GRState *evalAssume(const GRState *state, SVal Cond, bool Assumption,
bool *respondsToCallback);
}
}
-void GR::RegisterMallocChecker(GRExprEngine &Eng) {
+void GR::RegisterMallocChecker(ExprEngine &Eng) {
Eng.registerCheck(new MallocChecker());
}
C.generateNode(state->set<RegionState>(RS));
}
-void MallocChecker::evalEndPath(GREndPathNodeBuilder &B, void *tag,
- GRExprEngine &Eng) {
+void MallocChecker::evalEndPath(EndPathNodeBuilder &B, void *tag,
+ ExprEngine &Eng) {
SaveAndRestore<bool> OldHasGen(B.HasGeneratedNode);
const GRState *state = B.getState();
RegionStateTy M = state->get<RegionState>();
//===----------------------------------------------------------------------===//
#include "clang/GR/BugReporter/BugReporter.h"
-#include "clang/GR/PathSensitive/GRExprEngine.h"
+#include "clang/GR/PathSensitive/ExprEngine.h"
#include "clang/GR/PathSensitive/CheckerVisitor.h"
#include "BasicObjCFoundationChecks.h"
#include "clang/AST/DeclObjC.h"
} // end anonymous namespace
-void GR::RegisterNSAutoreleasePoolChecks(GRExprEngine &Eng) {
+void GR::RegisterNSAutoreleasePoolChecks(ExprEngine &Eng) {
ASTContext &Ctx = Eng.getContext();
if (Ctx.getLangOptions().getGCMode() != LangOptions::NonGC) {
Eng.registerCheck(new NSAutoreleasePoolChecker(GetNullarySelector("release",
#include "clang/GR/Checkers/LocalCheckers.h"
#include "clang/GR/BugReporter/BugType.h"
-#include "clang/GR/PathSensitive/GRExprEngine.h"
+#include "clang/GR/PathSensitive/ExprEngine.h"
#include "clang/GR/Checkers/DereferenceChecker.h"
#include "BasicObjCFoundationChecks.h"
#include "clang/AST/DeclObjC.h"
const Decl &CodeDecl;
const bool isNSErrorWarning;
IdentifierInfo * const II;
- GRExprEngine &Eng;
+ ExprEngine &Eng;
void CheckSignature(const ObjCMethodDecl& MD, QualType& ResultTy,
llvm::SmallVectorImpl<VarDecl*>& ErrorParams);
void EmitRetTyWarning(BugReporter& BR, const Decl& CodeDecl);
public:
- NSErrorChecker(const Decl &D, bool isNSError, GRExprEngine& eng)
+ NSErrorChecker(const Decl &D, bool isNSError, ExprEngine& eng)
: BugType(isNSError ? "NSError** null dereference"
: "CFErrorRef* null dereference",
"Coding conventions (Apple)"),
} // end anonymous namespace
-void GR::RegisterNSErrorChecks(BugReporter& BR, GRExprEngine &Eng,
+void GR::RegisterNSErrorChecks(BugReporter& BR, ExprEngine &Eng,
const Decl &D) {
BR.Register(new NSErrorChecker(D, true, Eng));
BR.Register(new NSErrorChecker(D, false, Eng));
//
//===----------------------------------------------------------------------===//
-#include "GRExprEngineInternalChecks.h"
+#include "ExprEngineInternalChecks.h"
#include "clang/GR/PathSensitive/CheckerVisitor.h"
#include "llvm/ADT/StringSwitch.h"
}
-void GR::RegisterNoReturnFunctionChecker(GRExprEngine &Eng) {
+void GR::RegisterNoReturnFunctionChecker(ExprEngine &Eng) {
Eng.registerCheck(new NoReturnFunctionChecker());
}
//
//===----------------------------------------------------------------------===//
-#include "GRExprEngineInternalChecks.h"
+#include "ExprEngineInternalChecks.h"
#include "clang/GR/PathSensitive/Checker.h"
#include "clang/Basic/Builtins.h"
}
-void GR::RegisterOSAtomicChecker(GRExprEngine &Eng) {
+void GR::RegisterOSAtomicChecker(ExprEngine &Eng) {
Eng.registerCheck(new OSAtomicChecker());
}
const void *OSAtomicStoreTag = &magic_store;
// Load 'theValue'.
- GRExprEngine &Engine = C.getEngine();
+ ExprEngine &Engine = C.getEngine();
const GRState *state = C.getState();
ExplodedNodeSet Tmp;
SVal location = state->getSVal(theValueExpr);
//
//===----------------------------------------------------------------------===//
-#include "GRExprEngineInternalChecks.h"
+#include "ExprEngineInternalChecks.h"
#include "clang/GR/BugReporter/BugType.h"
#include "clang/GR/Checkers/DereferenceChecker.h"
#include "clang/GR/PathSensitive/CheckerVisitor.h"
-#include "clang/GR/PathSensitive/GRExprEngine.h"
+#include "clang/GR/PathSensitive/ExprEngine.h"
using namespace clang;
using namespace GR;
};
} // end anonymous namespace
-void GR::RegisterObjCAtSyncChecker(GRExprEngine &Eng) {
+void GR::RegisterObjCAtSyncChecker(ExprEngine &Eng) {
// @synchronized is an Objective-C 2 feature.
if (Eng.getContext().getLangOptions().ObjC2)
Eng.registerCheck(new ObjCAtSyncChecker());
//
//===----------------------------------------------------------------------===//
-#include "GRExprEngineInternalChecks.h"
+#include "ExprEngineInternalChecks.h"
#include "clang/GR/BugReporter/BugType.h"
#include "clang/GR/PathSensitive/CheckerVisitor.h"
}
}
-void GR::RegisterPointerArithChecker(GRExprEngine &Eng) {
+void GR::RegisterPointerArithChecker(ExprEngine &Eng) {
Eng.registerCheck(new PointerArithChecker());
}
//
//===----------------------------------------------------------------------===//
-#include "GRExprEngineInternalChecks.h"
+#include "ExprEngineInternalChecks.h"
#include "clang/GR/BugReporter/BugType.h"
#include "clang/GR/PathSensitive/CheckerVisitor.h"
}
}
-void GR::RegisterPointerSubChecker(GRExprEngine &Eng) {
+void GR::RegisterPointerSubChecker(ExprEngine &Eng) {
Eng.registerCheck(new PointerSubChecker());
}
//===----------------------------------------------------------------------===//
//
// This defines PthreadLockChecker, a simple lock -> unlock checker. Eventually
-// this shouldn't be registered with GRExprEngineInternalChecks.
+// this shouldn't be registered with ExprEngineInternalChecks.
//
//===----------------------------------------------------------------------===//
#include "clang/GR/PathSensitive/CheckerVisitor.h"
#include "clang/GR/BugReporter/BugReporter.h"
#include "clang/GR/PathSensitive/GRStateTrait.h"
-#include "GRExprEngineExperimentalChecks.h"
+#include "ExprEngineExperimentalChecks.h"
#include "llvm/ADT/ImmutableSet.h"
using namespace clang;
} // end GR namespace
} // end clang namespace
-void GR::RegisterPthreadLockChecker(GRExprEngine &Eng) {
+void GR::RegisterPthreadLockChecker(ExprEngine &Eng) {
Eng.registerCheck(new PthreadLockChecker());
}
//
//===----------------------------------------------------------------------===//
-#include "GRExprEngineInternalChecks.h"
+#include "ExprEngineInternalChecks.h"
#include "clang/GR/BugReporter/BugType.h"
#include "clang/GR/PathSensitive/CheckerVisitor.h"
-#include "clang/GR/PathSensitive/GRExprEngine.h"
+#include "clang/GR/PathSensitive/ExprEngine.h"
using namespace clang;
using namespace GR;
};
}
-void GR::RegisterReturnPointerRangeChecker(GRExprEngine &Eng) {
+void GR::RegisterReturnPointerRangeChecker(ExprEngine &Eng) {
Eng.registerCheck(new ReturnPointerRangeChecker());
}
//
//===----------------------------------------------------------------------===//
-#include "GRExprEngineInternalChecks.h"
+#include "ExprEngineInternalChecks.h"
#include "clang/GR/BugReporter/BugType.h"
#include "clang/GR/PathSensitive/CheckerVisitor.h"
-#include "clang/GR/PathSensitive/GRExprEngine.h"
+#include "clang/GR/PathSensitive/ExprEngine.h"
using namespace clang;
using namespace GR;
};
}
-void GR::RegisterReturnUndefChecker(GRExprEngine &Eng) {
+void GR::RegisterReturnUndefChecker(ExprEngine &Eng) {
Eng.registerCheck(new ReturnUndefChecker());
}
//
//===----------------------------------------------------------------------===//
-#include "GRExprEngineInternalChecks.h"
+#include "ExprEngineInternalChecks.h"
#include "clang/GR/BugReporter/BugType.h"
#include "clang/GR/PathSensitive/CheckerVisitor.h"
#include "clang/GR/PathSensitive/GRState.h"
return &x;
}
void PreVisitReturnStmt(CheckerContext &C, const ReturnStmt *RS);
- void evalEndPath(GREndPathNodeBuilder &B, void *tag, GRExprEngine &Eng);
+ void evalEndPath(EndPathNodeBuilder &B, void *tag, ExprEngine &Eng);
private:
void EmitStackError(CheckerContext &C, const MemRegion *R, const Expr *RetE);
SourceRange GenName(llvm::raw_ostream &os, const MemRegion *R,
};
}
-void GR::RegisterStackAddrLeakChecker(GRExprEngine &Eng) {
+void GR::RegisterStackAddrLeakChecker(ExprEngine &Eng) {
Eng.registerCheck(new StackAddrLeakChecker());
}
}
}
-void StackAddrLeakChecker::evalEndPath(GREndPathNodeBuilder &B, void *tag,
- GRExprEngine &Eng) {
+void StackAddrLeakChecker::evalEndPath(EndPathNodeBuilder &B, void *tag,
+ ExprEngine &Eng) {
SaveAndRestore<bool> OldHasGen(B.HasGeneratedNode);
const GRState *state = B.getState();
//
//===----------------------------------------------------------------------===//
-#include "GRExprEngineExperimentalChecks.h"
+#include "ExprEngineExperimentalChecks.h"
#include "clang/GR/BugReporter/BugType.h"
#include "clang/GR/PathSensitive/CheckerVisitor.h"
#include "clang/GR/PathSensitive/GRState.h"
virtual bool evalCallExpr(CheckerContext &C, const CallExpr *CE);
void evalDeadSymbols(CheckerContext &C, SymbolReaper &SymReaper);
- void evalEndPath(GREndPathNodeBuilder &B, void *tag, GRExprEngine &Eng);
+ void evalEndPath(EndPathNodeBuilder &B, void *tag, ExprEngine &Eng);
void PreVisitReturnStmt(CheckerContext &C, const ReturnStmt *S);
private:
}
}
-void GR::RegisterStreamChecker(GRExprEngine &Eng) {
+void GR::RegisterStreamChecker(ExprEngine &Eng) {
Eng.registerCheck(new StreamChecker());
}
}
}
-void StreamChecker::evalEndPath(GREndPathNodeBuilder &B, void *tag,
- GRExprEngine &Eng) {
+void StreamChecker::evalEndPath(EndPathNodeBuilder &B, void *tag,
+ ExprEngine &Eng) {
SaveAndRestore<bool> OldHasGen(B.HasGeneratedNode);
const GRState *state = B.getState();
typedef llvm::ImmutableMap<SymbolRef, StreamState> SymMap;
//
//===----------------------------------------------------------------------===//
-#include "GRExprEngineInternalChecks.h"
+#include "ExprEngineInternalChecks.h"
#include "clang/GR/BugReporter/BugType.h"
#include "clang/GR/PathSensitive/Checker.h"
public:
UndefBranchChecker() : BT(0) {}
static void *getTag();
- void VisitBranchCondition(GRBranchNodeBuilder &Builder, GRExprEngine &Eng,
+ void VisitBranchCondition(BranchNodeBuilder &Builder, ExprEngine &Eng,
const Stmt *Condition, void *tag);
};
}
-void GR::RegisterUndefBranchChecker(GRExprEngine &Eng) {
+void GR::RegisterUndefBranchChecker(ExprEngine &Eng) {
Eng.registerCheck(new UndefBranchChecker());
}
return &x;
}
-void UndefBranchChecker::VisitBranchCondition(GRBranchNodeBuilder &Builder,
- GRExprEngine &Eng,
+void UndefBranchChecker::VisitBranchCondition(BranchNodeBuilder &Builder,
+ ExprEngine &Eng,
const Stmt *Condition, void *tag){
const GRState *state = Builder.getState();
SVal X = state->getSVal(Condition);
//
//===----------------------------------------------------------------------===//
-#include "GRExprEngineInternalChecks.h"
+#include "ExprEngineInternalChecks.h"
#include "clang/GR/PathSensitive/CheckerVisitor.h"
-#include "clang/GR/PathSensitive/GRExprEngine.h"
+#include "clang/GR/PathSensitive/ExprEngine.h"
#include "clang/GR/BugReporter/BugType.h"
#include "llvm/Support/raw_ostream.h"
};
} // end anonymous namespace
-void GR::RegisterUndefCapturedBlockVarChecker(GRExprEngine &Eng) {
+void GR::RegisterUndefCapturedBlockVarChecker(ExprEngine &Eng) {
Eng.registerCheck(new UndefCapturedBlockVarChecker());
}
//
//===----------------------------------------------------------------------===//
//
-// This defines UndefResultChecker, a builtin check in GRExprEngine that
+// This defines UndefResultChecker, a builtin check in ExprEngine that
// performs checks for undefined results of non-assignment binary operators.
//
//===----------------------------------------------------------------------===//
-#include "GRExprEngineInternalChecks.h"
+#include "ExprEngineInternalChecks.h"
#include "clang/GR/BugReporter/BugType.h"
#include "clang/GR/PathSensitive/CheckerVisitor.h"
-#include "clang/GR/PathSensitive/GRExprEngine.h"
+#include "clang/GR/PathSensitive/ExprEngine.h"
using namespace clang;
using namespace GR;
};
} // end anonymous namespace
-void GR::RegisterUndefResultChecker(GRExprEngine &Eng) {
+void GR::RegisterUndefResultChecker(ExprEngine &Eng) {
Eng.registerCheck(new UndefResultChecker());
}
//
//===----------------------------------------------------------------------===//
//
-// This defines UndefinedArraySubscriptChecker, a builtin check in GRExprEngine
+// This defines UndefinedArraySubscriptChecker, a builtin check in ExprEngine
// that performs checks for undefined array subscripts.
//
//===----------------------------------------------------------------------===//
-#include "GRExprEngineInternalChecks.h"
+#include "ExprEngineInternalChecks.h"
#include "clang/GR/BugReporter/BugType.h"
#include "clang/GR/PathSensitive/CheckerVisitor.h"
};
} // end anonymous namespace
-void GR::RegisterUndefinedArraySubscriptChecker(GRExprEngine &Eng) {
+void GR::RegisterUndefinedArraySubscriptChecker(ExprEngine &Eng) {
Eng.registerCheck(new UndefinedArraySubscriptChecker());
}
//
//===----------------------------------------------------------------------===//
//
-// This defines UndefinedAssginmentChecker, a builtin check in GRExprEngine that
+// This defines UndefinedAssginmentChecker, a builtin check in ExprEngine that
// checks for assigning undefined values.
//
//===----------------------------------------------------------------------===//
-#include "GRExprEngineInternalChecks.h"
+#include "ExprEngineInternalChecks.h"
#include "clang/GR/BugReporter/BugType.h"
#include "clang/GR/PathSensitive/CheckerVisitor.h"
};
}
-void GR::RegisterUndefinedAssignmentChecker(GRExprEngine &Eng){
+void GR::RegisterUndefinedAssignmentChecker(ExprEngine &Eng){
Eng.registerCheck(new UndefinedAssignmentChecker());
}
//
//===----------------------------------------------------------------------===//
-#include "GRExprEngineInternalChecks.h"
+#include "ExprEngineInternalChecks.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/GR/BugReporter/BugType.h"
#include "clang/GR/PathSensitive/CheckerVisitor.h"
};
} //end anonymous namespace
-void GR::RegisterUnixAPIChecker(GRExprEngine &Eng) {
+void GR::RegisterUnixAPIChecker(ExprEngine &Eng) {
Eng.registerCheck(new UnixAPIChecker());
}
else {
// FIXME: We need a more general way of getting the O_CREAT value.
// We could possibly grovel through the preprocessor state, but
- // that would require passing the Preprocessor object to the GRExprEngine.
+ // that would require passing the Preprocessor object to the ExprEngine.
return;
}
}
#include "clang/GR/PathSensitive/SVals.h"
#include "clang/GR/PathSensitive/CheckerHelpers.h"
#include "clang/GR/BugReporter/BugReporter.h"
-#include "GRExprEngineExperimentalChecks.h"
+#include "ExprEngineExperimentalChecks.h"
#include "llvm/ADT/SmallPtrSet.h"
// The number of CFGBlock pointers we want to reserve memory for. This is used
static void *getTag();
void VisitEndAnalysis(ExplodedGraph &G,
BugReporter &B,
- GRExprEngine &Eng);
+ ExprEngine &Eng);
private:
static inline const Stmt *getUnreachableStmt(const CFGBlock *CB);
void FindUnreachableEntryPoints(const CFGBlock *CB);
return &x;
}
-void GR::RegisterUnreachableCodeChecker(GRExprEngine &Eng) {
+void GR::RegisterUnreachableCodeChecker(ExprEngine &Eng) {
Eng.registerCheck(new UnreachableCodeChecker());
}
void UnreachableCodeChecker::VisitEndAnalysis(ExplodedGraph &G,
BugReporter &B,
- GRExprEngine &Eng) {
+ ExprEngine &Eng) {
// Bail out if we didn't cover all paths
if (Eng.hasWorkRemaining())
return;
//
//===----------------------------------------------------------------------===//
//
-// This defines VLASizeChecker, a builtin check in GRExprEngine that
+// This defines VLASizeChecker, a builtin check in ExprEngine that
// performs checks for declaration of VLA of undefined or zero size.
// In addition, VLASizeChecker is responsible for defining the extent
// of the MemRegion that represents a VLA.
//
//===----------------------------------------------------------------------===//
-#include "GRExprEngineInternalChecks.h"
+#include "ExprEngineInternalChecks.h"
#include "clang/AST/CharUnits.h"
#include "clang/GR/BugReporter/BugType.h"
#include "clang/GR/PathSensitive/CheckerVisitor.h"
-#include "clang/GR/PathSensitive/GRExprEngine.h"
+#include "clang/GR/PathSensitive/ExprEngine.h"
using namespace clang;
using namespace GR;
};
} // end anonymous namespace
-void GR::RegisterVLASizeChecker(GRExprEngine &Eng) {
+void GR::RegisterVLASizeChecker(ExprEngine &Eng) {
Eng.registerCheck(new VLASizeChecker());
}
-//==- GRCoreEngine.cpp - Path-Sensitive Dataflow Engine ------------*- C++ -*-//
+//==- CoreEngine.cpp - Path-Sensitive Dataflow Engine ------------*- C++ -*-//
//
// The LLVM Compiler Infrastructure
//
//===----------------------------------------------------------------------===//
#include "clang/GR/PathSensitive/AnalysisManager.h"
-#include "clang/GR/PathSensitive/GRCoreEngine.h"
-#include "clang/GR/PathSensitive/GRExprEngine.h"
+#include "clang/GR/PathSensitive/CoreEngine.h"
+#include "clang/GR/PathSensitive/ExprEngine.h"
#include "clang/Index/TranslationUnit.h"
#include "clang/AST/Expr.h"
#include "llvm/Support/Casting.h"
// This should be removed in the future.
namespace clang {
namespace GR {
-GRTransferFuncs* MakeCFRefCountTF(ASTContext& Ctx, bool GCEnabled,
+TransferFuncs* MakeCFRefCountTF(ASTContext& Ctx, bool GCEnabled,
const LangOptions& lopts);
}
}
// Worklist classes for exploration of reachable states.
//===----------------------------------------------------------------------===//
-GRWorkList::Visitor::~Visitor() {}
+WorkList::Visitor::~Visitor() {}
namespace {
-class DFS : public GRWorkList {
- llvm::SmallVector<GRWorkListUnit,20> Stack;
+class DFS : public WorkList {
+ llvm::SmallVector<WorkListUnit,20> Stack;
public:
virtual bool hasWork() const {
return !Stack.empty();
}
- virtual void Enqueue(const GRWorkListUnit& U) {
+ virtual void Enqueue(const WorkListUnit& U) {
Stack.push_back(U);
}
- virtual GRWorkListUnit Dequeue() {
+ virtual WorkListUnit Dequeue() {
assert (!Stack.empty());
- const GRWorkListUnit& U = Stack.back();
+ const WorkListUnit& U = Stack.back();
Stack.pop_back(); // This technically "invalidates" U, but we are fine.
return U;
}
virtual bool VisitItemsInWorkList(Visitor &V) {
- for (llvm::SmallVectorImpl<GRWorkListUnit>::iterator
+ for (llvm::SmallVectorImpl<WorkListUnit>::iterator
I = Stack.begin(), E = Stack.end(); I != E; ++I) {
if (V.Visit(*I))
return true;
}
};
-class BFS : public GRWorkList {
- std::deque<GRWorkListUnit> Queue;
+class BFS : public WorkList {
+ std::deque<WorkListUnit> Queue;
public:
virtual bool hasWork() const {
return !Queue.empty();
}
- virtual void Enqueue(const GRWorkListUnit& U) {
+ virtual void Enqueue(const WorkListUnit& U) {
Queue.push_front(U);
}
- virtual GRWorkListUnit Dequeue() {
- GRWorkListUnit U = Queue.front();
+ virtual WorkListUnit Dequeue() {
+ WorkListUnit U = Queue.front();
Queue.pop_front();
return U;
}
virtual bool VisitItemsInWorkList(Visitor &V) {
- for (std::deque<GRWorkListUnit>::iterator
+ for (std::deque<WorkListUnit>::iterator
I = Queue.begin(), E = Queue.end(); I != E; ++I) {
if (V.Visit(*I))
return true;
} // end anonymous namespace
-// Place the dstor for GRWorkList here because it contains virtual member
+// Place the dstor for WorkList here because it contains virtual member
// functions, and we the code for the dstor generated in one compilation unit.
-GRWorkList::~GRWorkList() {}
+WorkList::~WorkList() {}
-GRWorkList *GRWorkList::MakeDFS() { return new DFS(); }
-GRWorkList *GRWorkList::MakeBFS() { return new BFS(); }
+WorkList *WorkList::MakeDFS() { return new DFS(); }
+WorkList *WorkList::MakeBFS() { return new BFS(); }
namespace {
- class BFSBlockDFSContents : public GRWorkList {
- std::deque<GRWorkListUnit> Queue;
- llvm::SmallVector<GRWorkListUnit,20> Stack;
+ class BFSBlockDFSContents : public WorkList {
+ std::deque<WorkListUnit> Queue;
+ llvm::SmallVector<WorkListUnit,20> Stack;
public:
virtual bool hasWork() const {
return !Queue.empty() || !Stack.empty();
}
- virtual void Enqueue(const GRWorkListUnit& U) {
+ virtual void Enqueue(const WorkListUnit& U) {
if (isa<BlockEntrance>(U.getNode()->getLocation()))
Queue.push_front(U);
else
Stack.push_back(U);
}
- virtual GRWorkListUnit Dequeue() {
+ virtual WorkListUnit Dequeue() {
// Process all basic blocks to completion.
if (!Stack.empty()) {
- const GRWorkListUnit& U = Stack.back();
+ const WorkListUnit& U = Stack.back();
Stack.pop_back(); // This technically "invalidates" U, but we are fine.
return U;
}
assert(!Queue.empty());
// Don't use const reference. The subsequent pop_back() might make it
// unsafe.
- GRWorkListUnit U = Queue.front();
+ WorkListUnit U = Queue.front();
Queue.pop_front();
return U;
}
virtual bool VisitItemsInWorkList(Visitor &V) {
- for (llvm::SmallVectorImpl<GRWorkListUnit>::iterator
+ for (llvm::SmallVectorImpl<WorkListUnit>::iterator
I = Stack.begin(), E = Stack.end(); I != E; ++I) {
if (V.Visit(*I))
return true;
}
- for (std::deque<GRWorkListUnit>::iterator
+ for (std::deque<WorkListUnit>::iterator
I = Queue.begin(), E = Queue.end(); I != E; ++I) {
if (V.Visit(*I))
return true;
};
} // end anonymous namespace
-GRWorkList* GRWorkList::MakeBFSBlockDFSContents() {
+WorkList* WorkList::MakeBFSBlockDFSContents() {
return new BFSBlockDFSContents();
}
//===----------------------------------------------------------------------===//
/// ExecuteWorkList - Run the worklist algorithm for a maximum number of steps.
-bool GRCoreEngine::ExecuteWorkList(const LocationContext *L, unsigned Steps,
+bool CoreEngine::ExecuteWorkList(const LocationContext *L, unsigned Steps,
const GRState *InitState) {
if (G->num_roots() == 0) { // Initialize the analysis by constructing
--Steps;
}
- const GRWorkListUnit& WU = WList->Dequeue();
+ const WorkListUnit& WU = WList->Dequeue();
// Set the current block counter.
WList->setBlockCounter(WU.getBlockCounter());
}
}
- SubEngine.ProcessEndWorklist(hasWorkRemaining());
+ SubEng.ProcessEndWorklist(hasWorkRemaining());
return WList->hasWork();
}
-void GRCoreEngine::ExecuteWorkListWithInitialState(const LocationContext *L,
+void CoreEngine::ExecuteWorkListWithInitialState(const LocationContext *L,
unsigned Steps,
const GRState *InitState,
ExplodedNodeSet &Dst) {
}
}
-void GRCoreEngine::HandleCallEnter(const CallEnter &L, const CFGBlock *Block,
+void CoreEngine::HandleCallEnter(const CallEnter &L, const CFGBlock *Block,
unsigned Index, ExplodedNode *Pred) {
- GRCallEnterNodeBuilder Builder(*this, Pred, L.getCallExpr(),
+ CallEnterNodeBuilder Builder(*this, Pred, L.getCallExpr(),
L.getCalleeContext(), Block, Index);
ProcessCallEnter(Builder);
}
-void GRCoreEngine::HandleCallExit(const CallExit &L, ExplodedNode *Pred) {
- GRCallExitNodeBuilder Builder(*this, Pred);
+void CoreEngine::HandleCallExit(const CallExit &L, ExplodedNode *Pred) {
+ CallExitNodeBuilder Builder(*this, Pred);
ProcessCallExit(Builder);
}
-void GRCoreEngine::HandleBlockEdge(const BlockEdge& L, ExplodedNode* Pred) {
+void CoreEngine::HandleBlockEdge(const BlockEdge& L, ExplodedNode* Pred) {
const CFGBlock* Blk = L.getDst();
&& "EXIT block cannot contain Stmts.");
// Process the final state transition.
- GREndPathNodeBuilder Builder(Blk, Pred, this);
+ EndPathNodeBuilder Builder(Blk, Pred, this);
ProcessEndPath(Builder);
// This path is done. Don't enqueue any more nodes.
}
}
-void GRCoreEngine::HandleBlockEntrance(const BlockEntrance& L,
+void CoreEngine::HandleBlockEntrance(const BlockEntrance& L,
ExplodedNode* Pred) {
// Increment the block counter.
- GRBlockCounter Counter = WList->getBlockCounter();
+ BlockCounter Counter = WList->getBlockCounter();
Counter = BCounterFactory.IncrementCount(Counter,
Pred->getLocationContext()->getCurrentStackFrame(),
L.getBlock()->getBlockID());
// Process the entrance of the block.
if (CFGElement E = L.getFirstElement()) {
- GRStmtNodeBuilder Builder(L.getBlock(), 0, Pred, this,
- SubEngine.getStateManager());
+ StmtNodeBuilder Builder(L.getBlock(), 0, Pred, this,
+ SubEng.getStateManager());
ProcessElement(E, Builder);
}
else
HandleBlockExit(L.getBlock(), Pred);
}
-void GRCoreEngine::HandleBlockExit(const CFGBlock * B, ExplodedNode* Pred) {
+void CoreEngine::HandleBlockExit(const CFGBlock * B, ExplodedNode* Pred) {
if (const Stmt* Term = B->getTerminator()) {
switch (Term->getStmtClass()) {
// Only 1 successor: the indirect goto dispatch block.
assert (B->succ_size() == 1);
- GRIndirectGotoNodeBuilder
+ IndirectGotoNodeBuilder
builder(Pred, B, cast<IndirectGotoStmt>(Term)->getTarget(),
*(B->succ_begin()), this);
}
case Stmt::SwitchStmtClass: {
- GRSwitchNodeBuilder builder(Pred, B, cast<SwitchStmt>(Term)->getCond(),
+ SwitchNodeBuilder builder(Pred, B, cast<SwitchStmt>(Term)->getCond(),
this);
ProcessSwitch(builder);
Pred->State, Pred);
}
-void GRCoreEngine::HandleBranch(const Stmt* Cond, const Stmt* Term,
+void CoreEngine::HandleBranch(const Stmt* Cond, const Stmt* Term,
const CFGBlock * B, ExplodedNode* Pred) {
assert (B->succ_size() == 2);
- GRBranchNodeBuilder Builder(B, *(B->succ_begin()), *(B->succ_begin()+1),
+ BranchNodeBuilder Builder(B, *(B->succ_begin()), *(B->succ_begin()+1),
Pred, this);
ProcessBranch(Cond, Term, Builder);
}
-void GRCoreEngine::HandlePostStmt(const CFGBlock* B, unsigned StmtIdx,
+void CoreEngine::HandlePostStmt(const CFGBlock* B, unsigned StmtIdx,
ExplodedNode* Pred) {
assert (!B->empty());
if (StmtIdx == B->size())
HandleBlockExit(B, Pred);
else {
- GRStmtNodeBuilder Builder(B, StmtIdx, Pred, this,
- SubEngine.getStateManager());
+ StmtNodeBuilder Builder(B, StmtIdx, Pred, this,
+ SubEng.getStateManager());
ProcessElement((*B)[StmtIdx], Builder);
}
}
/// generateNode - Utility method to generate nodes, hook up successors,
/// and add nodes to the worklist.
-void GRCoreEngine::generateNode(const ProgramPoint& Loc,
- const GRState* State, ExplodedNode* Pred) {
+void CoreEngine::generateNode(const ProgramPoint& Loc,
+ const GRState* State, ExplodedNode* Pred) {
bool IsNew;
ExplodedNode* Node = G->getNode(Loc, State, &IsNew);
if (IsNew) WList->Enqueue(Node);
}
-GRStmtNodeBuilder::GRStmtNodeBuilder(const CFGBlock* b, unsigned idx,
- ExplodedNode* N, GRCoreEngine* e,
+StmtNodeBuilder::StmtNodeBuilder(const CFGBlock* b, unsigned idx,
+ ExplodedNode* N, CoreEngine* e,
GRStateManager &mgr)
: Eng(*e), B(*b), Idx(idx), Pred(N), Mgr(mgr),
PurgingDeadSymbols(false), BuildSinks(false), HasGeneratedNode(false),
CleanedState = Pred->getState();
}
-GRStmtNodeBuilder::~GRStmtNodeBuilder() {
+StmtNodeBuilder::~StmtNodeBuilder() {
for (DeferredTy::iterator I=Deferred.begin(), E=Deferred.end(); I!=E; ++I)
if (!(*I)->isSink())
GenerateAutoTransition(*I);
}
-void GRStmtNodeBuilder::GenerateAutoTransition(ExplodedNode* N) {
+void StmtNodeBuilder::GenerateAutoTransition(ExplodedNode* N) {
assert (!N->isSink());
// Check if this node entered a callee.
Eng.WList->Enqueue(Succ, &B, Idx+1);
}
-ExplodedNode* GRStmtNodeBuilder::MakeNode(ExplodedNodeSet& Dst, const Stmt* S,
+ExplodedNode* StmtNodeBuilder::MakeNode(ExplodedNodeSet& Dst, const Stmt* S,
ExplodedNode* Pred, const GRState* St,
ProgramPoint::Kind K) {
}
ExplodedNode*
-GRStmtNodeBuilder::generateNodeInternal(const Stmt* S, const GRState* state,
+StmtNodeBuilder::generateNodeInternal(const Stmt* S, const GRState* state,
ExplodedNode* Pred,
ProgramPoint::Kind K,
const void *tag) {
}
ExplodedNode*
-GRStmtNodeBuilder::generateNodeInternal(const ProgramPoint &Loc,
+StmtNodeBuilder::generateNodeInternal(const ProgramPoint &Loc,
const GRState* State,
ExplodedNode* Pred) {
bool IsNew;
return NULL;
}
-ExplodedNode* GRBranchNodeBuilder::generateNode(const GRState* State,
+ExplodedNode* BranchNodeBuilder::generateNode(const GRState* State,
bool branch) {
// If the branch has been marked infeasible we should not generate a node.
return NULL;
}
-GRBranchNodeBuilder::~GRBranchNodeBuilder() {
+BranchNodeBuilder::~BranchNodeBuilder() {
if (!GeneratedTrue) generateNode(Pred->State, true);
if (!GeneratedFalse) generateNode(Pred->State, false);
ExplodedNode*
-GRIndirectGotoNodeBuilder::generateNode(const iterator& I, const GRState* St,
+IndirectGotoNodeBuilder::generateNode(const iterator& I, const GRState* St,
bool isSink) {
bool IsNew;
ExplodedNode*
-GRSwitchNodeBuilder::generateCaseStmtNode(const iterator& I, const GRState* St){
+SwitchNodeBuilder::generateCaseStmtNode(const iterator& I, const GRState* St){
bool IsNew;
ExplodedNode*
-GRSwitchNodeBuilder::generateDefaultCaseNode(const GRState* St, bool isSink) {
+SwitchNodeBuilder::generateDefaultCaseNode(const GRState* St, bool isSink) {
// Get the block for the default case.
assert (Src->succ_rbegin() != Src->succ_rend());
return NULL;
}
-GREndPathNodeBuilder::~GREndPathNodeBuilder() {
+EndPathNodeBuilder::~EndPathNodeBuilder() {
// Auto-generate an EOP node if one has not been generated.
if (!HasGeneratedNode) {
// If we are in an inlined call, generate CallExit node.
}
ExplodedNode*
-GREndPathNodeBuilder::generateNode(const GRState* State, const void *tag,
+EndPathNodeBuilder::generateNode(const GRState* State, const void *tag,
ExplodedNode* P) {
HasGeneratedNode = true;
bool IsNew;
return NULL;
}
-void GREndPathNodeBuilder::GenerateCallExitNode(const GRState *state) {
+void EndPathNodeBuilder::GenerateCallExitNode(const GRState *state) {
HasGeneratedNode = true;
// Create a CallExit node and enqueue it.
const StackFrameContext *LocCtx
}
-void GRCallEnterNodeBuilder::generateNode(const GRState *state) {
+void CallEnterNodeBuilder::generateNode(const GRState *state) {
// Check if the callee is in the same translation unit.
if (CalleeCtx->getTranslationUnit() !=
Pred->getLocationContext()->getTranslationUnit()) {
// Create a new engine. We must be careful that the new engine should not
// reference data structures owned by the old engine.
- AnalysisManager &OldMgr = Eng.SubEngine.getAnalysisManager();
+ AnalysisManager &OldMgr = Eng.SubEng.getAnalysisManager();
// Get the callee's translation unit.
idx::TranslationUnit *TU = CalleeCtx->getTranslationUnit();
OldMgr.getAnalysisContextManager().getUseUnoptimizedCFG(),
OldMgr.getAnalysisContextManager().getAddImplicitDtors(),
OldMgr.getAnalysisContextManager().getAddInitializers());
- llvm::OwningPtr<GRTransferFuncs> TF(MakeCFRefCountTF(AMgr.getASTContext(),
+ llvm::OwningPtr<TransferFuncs> TF(MakeCFRefCountTF(AMgr.getASTContext(),
/* GCEnabled */ false,
AMgr.getLangOptions()));
// Create the new engine.
- GRExprEngine NewEng(AMgr, TF.take());
+ ExprEngine NewEng(AMgr, TF.take());
// Create the new LocationContext.
AnalysisContext *NewAnaCtx = AMgr.getAnalysisContext(CalleeCtx->getDecl(),
Eng.WList->Enqueue(Node);
}
-void GRCallExitNodeBuilder::generateNode(const GRState *state) {
+void CallExitNodeBuilder::generateNode(const GRState *state) {
// Get the callee's location context.
const StackFrameContext *LocCtx
= cast<StackFrameContext>(Pred->getLocationContext());
-//=-- GRExprEngine.cpp - Path-Sensitive Expression-Level Dataflow ---*- C++ -*-=
+//=-- ExprEngine.cpp - Path-Sensitive Expression-Level Dataflow ---*- C++ -*-=
//
// The LLVM Compiler Infrastructure
//
//===----------------------------------------------------------------------===//
// FIXME: Restructure checker registration.
-#include "Checkers/GRExprEngineInternalChecks.h"
+#include "Checkers/ExprEngineInternalChecks.h"
#include "clang/GR/BugReporter/BugType.h"
#include "clang/GR/PathSensitive/AnalysisManager.h"
-#include "clang/GR/PathSensitive/GRExprEngine.h"
-#include "clang/GR/PathSensitive/GRExprEngineBuilders.h"
+#include "clang/GR/PathSensitive/ExprEngine.h"
+#include "clang/GR/PathSensitive/ExprEngineBuilders.h"
#include "clang/GR/PathSensitive/Checker.h"
#include "clang/AST/CharUnits.h"
#include "clang/AST/ParentMap.h"
// Checker worklist routines.
//===----------------------------------------------------------------------===//
-void GRExprEngine::CheckerVisit(const Stmt *S, ExplodedNodeSet &Dst,
+void ExprEngine::CheckerVisit(const Stmt *S, ExplodedNodeSet &Dst,
ExplodedNodeSet &Src, CallbackKind Kind) {
// Determine if we already have a cached 'CheckersOrdered' vector
// automatically.
}
-void GRExprEngine::CheckerEvalNilReceiver(const ObjCMessageExpr *ME,
+void ExprEngine::CheckerEvalNilReceiver(const ObjCMessageExpr *ME,
ExplodedNodeSet &Dst,
const GRState *state,
ExplodedNode *Pred) {
// CheckerEvalCall returns true if one of the checkers processed the node.
// This may return void when all call evaluation logic goes to some checker
// in the future.
-bool GRExprEngine::CheckerEvalCall(const CallExpr *CE,
+bool ExprEngine::CheckerEvalCall(const CallExpr *CE,
ExplodedNodeSet &Dst,
ExplodedNode *Pred) {
bool evaluated = false;
// FIXME: This is largely copy-paste from CheckerVisit(). Need to
// unify.
-void GRExprEngine::CheckerVisitBind(const Stmt *StoreE, ExplodedNodeSet &Dst,
+void ExprEngine::CheckerVisitBind(const Stmt *StoreE, ExplodedNodeSet &Dst,
ExplodedNodeSet &Src, SVal location,
SVal val, bool isPrevisit) {
// Engine construction and deletion.
//===----------------------------------------------------------------------===//
-static void RegisterInternalChecks(GRExprEngine &Eng) {
+static void RegisterInternalChecks(ExprEngine &Eng) {
// Register internal "built-in" BugTypes with the BugReporter. These BugTypes
// are different than what probably many checks will do since they don't
- // create BugReports on-the-fly but instead wait until GRExprEngine finishes
+ // create BugReports on-the-fly but instead wait until ExprEngine finishes
// analyzing a function. Generation of BugReport objects is done via a call
// to 'FlushReports' from BugReporter.
// The following checks do not need to have their associated BugTypes
// explicitly registered with the BugReporter. If they issue any BugReports,
// their associated BugType will get registered with the BugReporter
- // automatically. Note that the check itself is owned by the GRExprEngine
+ // automatically. Note that the check itself is owned by the ExprEngine
// object.
RegisterAdjustedReturnValueChecker(Eng);
// CallAndMessageChecker should be registered before AttrNonNullChecker,
RegisterMacOSXAPIChecker(Eng);
}
-GRExprEngine::GRExprEngine(AnalysisManager &mgr, GRTransferFuncs *tf)
+ExprEngine::ExprEngine(AnalysisManager &mgr, TransferFuncs *tf)
: AMgr(mgr),
- CoreEngine(*this),
- G(CoreEngine.getGraph()),
+ Engine(*this),
+ G(Engine.getGraph()),
Builder(NULL),
StateMgr(getContext(), mgr.getStoreManagerCreator(),
mgr.getConstraintManagerCreator(), G.getAllocator(),
TF->RegisterPrinters(getStateManager().Printers);
}
-GRExprEngine::~GRExprEngine() {
+ExprEngine::~ExprEngine() {
BR.FlushReports();
delete [] NSExceptionInstanceRaiseSelectors;
// Utility methods.
//===----------------------------------------------------------------------===//
-const GRState* GRExprEngine::getInitialState(const LocationContext *InitLoc) {
+const GRState* ExprEngine::getInitialState(const LocationContext *InitLoc) {
const GRState *state = StateMgr.getInitialState(InitLoc);
// Preconditions.
/// evalAssume - Called by ConstraintManager. Used to call checker-specific
/// logic for handling assumptions on symbolic values.
-const GRState *GRExprEngine::ProcessAssume(const GRState *state, SVal cond,
+const GRState *ExprEngine::ProcessAssume(const GRState *state, SVal cond,
bool assumption) {
// Determine if we already have a cached 'CheckersOrdered' vector
// specifically tailored for processing assumptions. This
return TF->evalAssume(state, cond, assumption);
}
-bool GRExprEngine::WantsRegionChangeUpdate(const GRState* state) {
+bool ExprEngine::WantsRegionChangeUpdate(const GRState* state) {
CallbackTag K = GetCallbackTag(EvalRegionChangesCallback);
CheckersOrdered *CO = COCache[K];
}
const GRState *
-GRExprEngine::ProcessRegionChanges(const GRState *state,
+ExprEngine::ProcessRegionChanges(const GRState *state,
const MemRegion * const *Begin,
const MemRegion * const *End) {
// FIXME: Most of this method is copy-pasted from ProcessAssume.
return state;
}
-void GRExprEngine::ProcessEndWorklist(bool hasWorkRemaining) {
+void ExprEngine::ProcessEndWorklist(bool hasWorkRemaining) {
for (CheckersOrdered::iterator I = Checkers.begin(), E = Checkers.end();
I != E; ++I) {
I->second->VisitEndAnalysis(G, BR, *this);
}
}
-void GRExprEngine::ProcessElement(const CFGElement E,
- GRStmtNodeBuilder& builder) {
+void ExprEngine::ProcessElement(const CFGElement E,
+ StmtNodeBuilder& builder) {
switch (E.getKind()) {
case CFGElement::Statement:
ProcessStmt(E.getAs<CFGStmt>(), builder);
}
}
-void GRExprEngine::ProcessStmt(const CFGStmt S, GRStmtNodeBuilder& builder) {
+void ExprEngine::ProcessStmt(const CFGStmt S, StmtNodeBuilder& builder) {
currentStmt = S.getStmt();
PrettyStackTraceLoc CrashInfo(getContext().getSourceManager(),
currentStmt->getLocStart(),
Visit(currentStmt, *I, Dst);
// Do we need to auto-generate a node? We only need to do this to generate
- // a node with a "cleaned" state; GRCoreEngine will actually handle
+ // a node with a "cleaned" state; CoreEngine will actually handle
// auto-transitions for other cases.
if (Dst.size() == 1 && *Dst.begin() == EntryNode
&& !Builder->HasGeneratedNode && !HasAutoGenerated) {
Builder = NULL;
}
-void GRExprEngine::ProcessInitializer(const CFGInitializer Init,
- GRStmtNodeBuilder &builder) {
+void ExprEngine::ProcessInitializer(const CFGInitializer Init,
+ StmtNodeBuilder &builder) {
// We don't set EntryNode and currentStmt. And we don't clean up state.
const CXXBaseOrMemberInitializer *BMI = Init.getInitializer();
}
}
-void GRExprEngine::ProcessImplicitDtor(const CFGImplicitDtor D,
- GRStmtNodeBuilder &builder) {
+void ExprEngine::ProcessImplicitDtor(const CFGImplicitDtor D,
+ StmtNodeBuilder &builder) {
Builder = &builder;
switch (D.getDtorKind()) {
}
}
-void GRExprEngine::ProcessAutomaticObjDtor(const CFGAutomaticObjDtor dtor,
- GRStmtNodeBuilder &builder) {
+void ExprEngine::ProcessAutomaticObjDtor(const CFGAutomaticObjDtor dtor,
+ StmtNodeBuilder &builder) {
ExplodedNode *pred = builder.getBasePredecessor();
const GRState *state = pred->getState();
const VarDecl *varDecl = dtor.getVarDecl();
dtor.getTriggerStmt(), pred, dstSet);
}
-void GRExprEngine::ProcessBaseDtor(const CFGBaseDtor D,
- GRStmtNodeBuilder &builder) {
+void ExprEngine::ProcessBaseDtor(const CFGBaseDtor D,
+ StmtNodeBuilder &builder) {
}
-void GRExprEngine::ProcessMemberDtor(const CFGMemberDtor D,
- GRStmtNodeBuilder &builder) {
+void ExprEngine::ProcessMemberDtor(const CFGMemberDtor D,
+ StmtNodeBuilder &builder) {
}
-void GRExprEngine::ProcessTemporaryDtor(const CFGTemporaryDtor D,
- GRStmtNodeBuilder &builder) {
+void ExprEngine::ProcessTemporaryDtor(const CFGTemporaryDtor D,
+ StmtNodeBuilder &builder) {
}
-void GRExprEngine::Visit(const Stmt* S, ExplodedNode* Pred,
+void ExprEngine::Visit(const Stmt* S, ExplodedNode* Pred,
ExplodedNodeSet& Dst) {
PrettyStackTraceLoc CrashInfo(getContext().getSourceManager(),
S->getLocStart(),
// Block entrance. (Update counters).
//===----------------------------------------------------------------------===//
-bool GRExprEngine::ProcessBlockEntrance(const CFGBlock* B,
+bool ExprEngine::ProcessBlockEntrance(const CFGBlock* B,
const ExplodedNode *Pred,
- GRBlockCounter BC) {
+ BlockCounter BC) {
return BC.getNumVisited(Pred->getLocationContext()->getCurrentStackFrame(),
B->getBlockID()) < AMgr.getMaxVisit();
}
// Generic node creation.
//===----------------------------------------------------------------------===//
-ExplodedNode* GRExprEngine::MakeNode(ExplodedNodeSet& Dst, const Stmt* S,
+ExplodedNode* ExprEngine::MakeNode(ExplodedNodeSet& Dst, const Stmt* S,
ExplodedNode* Pred, const GRState* St,
ProgramPoint::Kind K, const void *tag) {
- assert (Builder && "GRStmtNodeBuilder not present.");
+ assert (Builder && "StmtNodeBuilder not present.");
SaveAndRestore<const void*> OldTag(Builder->Tag);
Builder->Tag = tag;
return Builder->MakeNode(Dst, S, Pred, St, K);
// Branch processing.
//===----------------------------------------------------------------------===//
-const GRState* GRExprEngine::MarkBranch(const GRState* state,
+const GRState* ExprEngine::MarkBranch(const GRState* state,
const Stmt* Terminator,
bool branchTaken) {
return state->getSVal(Ex);
}
-void GRExprEngine::ProcessBranch(const Stmt* Condition, const Stmt* Term,
- GRBranchNodeBuilder& builder) {
+void ExprEngine::ProcessBranch(const Stmt* Condition, const Stmt* Term,
+ BranchNodeBuilder& builder) {
// Check for NULL conditions; e.g. "for(;;)"
if (!Condition) {
}
}
-/// ProcessIndirectGoto - Called by GRCoreEngine. Used to generate successor
+/// ProcessIndirectGoto - Called by CoreEngine. Used to generate successor
/// nodes by processing the 'effects' of a computed goto jump.
-void GRExprEngine::ProcessIndirectGoto(GRIndirectGotoNodeBuilder& builder) {
+void ExprEngine::ProcessIndirectGoto(IndirectGotoNodeBuilder& builder) {
const GRState *state = builder.getState();
SVal V = state->getSVal(builder.getTarget());
// (3) We have no clue about the label. Dispatch to all targets.
//
- typedef GRIndirectGotoNodeBuilder::iterator iterator;
+ typedef IndirectGotoNodeBuilder::iterator iterator;
if (isa<loc::GotoLabel>(V)) {
const LabelStmt* L = cast<loc::GotoLabel>(V).getLabel();
}
-void GRExprEngine::VisitGuardedExpr(const Expr* Ex, const Expr* L,
+void ExprEngine::VisitGuardedExpr(const Expr* Ex, const Expr* L,
const Expr* R,
ExplodedNode* Pred, ExplodedNodeSet& Dst) {
MakeNode(Dst, Ex, Pred, state->BindExpr(Ex, X, true));
}
-/// ProcessEndPath - Called by GRCoreEngine. Used to generate end-of-path
+/// ProcessEndPath - Called by CoreEngine. Used to generate end-of-path
/// nodes when the control reaches the end of a function.
-void GRExprEngine::ProcessEndPath(GREndPathNodeBuilder& builder) {
+void ExprEngine::ProcessEndPath(EndPathNodeBuilder& builder) {
getTF().evalEndPath(*this, builder);
StateMgr.EndPath(builder.getState());
for (CheckersOrdered::iterator I=Checkers.begin(),E=Checkers.end(); I!=E;++I){
}
}
-/// ProcessSwitch - Called by GRCoreEngine. Used to generate successor
+/// ProcessSwitch - Called by CoreEngine. Used to generate successor
/// nodes by processing the 'effects' of a switch statement.
-void GRExprEngine::ProcessSwitch(GRSwitchNodeBuilder& builder) {
- typedef GRSwitchNodeBuilder::iterator iterator;
+void ExprEngine::ProcessSwitch(SwitchNodeBuilder& builder) {
+ typedef SwitchNodeBuilder::iterator iterator;
const GRState* state = builder.getState();
const Expr* CondE = builder.getCondition();
SVal CondV_untested = state->getSVal(CondE);
builder.generateDefaultCaseNode(DefaultSt);
}
-void GRExprEngine::ProcessCallEnter(GRCallEnterNodeBuilder &B) {
+void ExprEngine::ProcessCallEnter(CallEnterNodeBuilder &B) {
const GRState *state = B.getState()->EnterStackFrame(B.getCalleeContext());
B.generateNode(state);
}
-void GRExprEngine::ProcessCallExit(GRCallExitNodeBuilder &B) {
+void ExprEngine::ProcessCallExit(CallExitNodeBuilder &B) {
const GRState *state = B.getState();
const ExplodedNode *Pred = B.getPredecessor();
const StackFrameContext *calleeCtx =
// Transfer functions: logical operations ('&&', '||').
//===----------------------------------------------------------------------===//
-void GRExprEngine::VisitLogicalExpr(const BinaryOperator* B, ExplodedNode* Pred,
+void ExprEngine::VisitLogicalExpr(const BinaryOperator* B, ExplodedNode* Pred,
ExplodedNodeSet& Dst) {
assert(B->getOpcode() == BO_LAnd ||
// Transfer functions: Loads and stores.
//===----------------------------------------------------------------------===//
-void GRExprEngine::VisitBlockExpr(const BlockExpr *BE, ExplodedNode *Pred,
+void ExprEngine::VisitBlockExpr(const BlockExpr *BE, ExplodedNode *Pred,
ExplodedNodeSet &Dst) {
ExplodedNodeSet Tmp;
CheckerVisit(BE, Dst, Tmp, PostVisitStmtCallback);
}
-void GRExprEngine::VisitCommonDeclRefExpr(const Expr *Ex, const NamedDecl *D,
- ExplodedNode *Pred,
- ExplodedNodeSet &Dst) {
+void ExprEngine::VisitCommonDeclRefExpr(const Expr *Ex, const NamedDecl *D,
+ ExplodedNode *Pred,
+ ExplodedNodeSet &Dst) {
const GRState *state = GetState(Pred);
if (const VarDecl* VD = dyn_cast<VarDecl>(D)) {
}
/// VisitArraySubscriptExpr - Transfer function for array accesses
-void GRExprEngine::VisitLvalArraySubscriptExpr(const ArraySubscriptExpr* A,
- ExplodedNode* Pred,
- ExplodedNodeSet& Dst){
+void ExprEngine::VisitLvalArraySubscriptExpr(const ArraySubscriptExpr* A,
+ ExplodedNode* Pred,
+ ExplodedNodeSet& Dst){
const Expr* Base = A->getBase()->IgnoreParens();
const Expr* Idx = A->getIdx()->IgnoreParens();
}
/// VisitMemberExpr - Transfer function for member expressions.
-void GRExprEngine::VisitMemberExpr(const MemberExpr* M, ExplodedNode* Pred,
- ExplodedNodeSet& Dst) {
+void ExprEngine::VisitMemberExpr(const MemberExpr* M, ExplodedNode* Pred,
+ ExplodedNodeSet& Dst) {
Expr *baseExpr = M->getBase()->IgnoreParens();
ExplodedNodeSet dstBase;
/// evalBind - Handle the semantics of binding a value to a specific location.
/// This method is used by evalStore and (soon) VisitDeclStmt, and others.
-void GRExprEngine::evalBind(ExplodedNodeSet& Dst, const Stmt* StoreE,
+void ExprEngine::evalBind(ExplodedNodeSet& Dst, const Stmt* StoreE,
ExplodedNode* Pred, const GRState* state,
SVal location, SVal Val, bool atDeclInit) {
}
}
- // The next thing to do is check if the GRTransferFuncs object wants to
+ // The next thing to do is check if the TransferFuncs object wants to
// update the state based on the new binding. If the GRTransferFunc object
// doesn't do anything, just auto-propagate the current state.
// NOTE: We use 'AssignE' for the location of the PostStore if 'AssignE'
// is non-NULL. Checkers typically care about
- GRStmtNodeBuilderRef BuilderRef(Dst, *Builder, *this, *I, newState, StoreE,
+ StmtNodeBuilderRef BuilderRef(Dst, *Builder, *this, *I, newState, StoreE,
true);
getTF().evalBind(BuilderRef, location, Val);
/// @param state The current simulation state
/// @param location The location to store the value
/// @param Val The value to be stored
-void GRExprEngine::evalStore(ExplodedNodeSet& Dst, const Expr *AssignE,
+void ExprEngine::evalStore(ExplodedNodeSet& Dst, const Expr *AssignE,
const Expr* LocationE,
ExplodedNode* Pred,
const GRState* state, SVal location, SVal Val,
const void *tag) {
- assert(Builder && "GRStmtNodeBuilder must be defined.");
+ assert(Builder && "StmtNodeBuilder must be defined.");
// Evaluate the location (checks for bad dereferences).
ExplodedNodeSet Tmp;
evalBind(Dst, StoreE, *NI, GetState(*NI), location, Val);
}
-void GRExprEngine::evalLoad(ExplodedNodeSet& Dst, const Expr *Ex,
+void ExprEngine::evalLoad(ExplodedNodeSet& Dst, const Expr *Ex,
ExplodedNode* Pred,
const GRState* state, SVal location,
const void *tag, QualType LoadTy) {
evalLoadCommon(Dst, Ex, Pred, state, location, tag, LoadTy);
}
-void GRExprEngine::evalLoadCommon(ExplodedNodeSet& Dst, const Expr *Ex,
+void ExprEngine::evalLoadCommon(ExplodedNodeSet& Dst, const Expr *Ex,
ExplodedNode* Pred,
const GRState* state, SVal location,
const void *tag, QualType LoadTy) {
}
}
-void GRExprEngine::evalLocation(ExplodedNodeSet &Dst, const Stmt *S,
+void ExprEngine::evalLocation(ExplodedNodeSet &Dst, const Stmt *S,
ExplodedNode* Pred,
const GRState* state, SVal location,
const void *tag, bool isLoad) {
}
}
-bool GRExprEngine::InlineCall(ExplodedNodeSet &Dst, const CallExpr *CE,
+bool ExprEngine::InlineCall(ExplodedNodeSet &Dst, const CallExpr *CE,
ExplodedNode *Pred) {
const GRState *state = GetState(Pred);
const Expr *Callee = CE->getCallee();
return false;
}
-void GRExprEngine::VisitCall(const CallExpr* CE, ExplodedNode* Pred,
+void ExprEngine::VisitCall(const CallExpr* CE, ExplodedNode* Pred,
CallExpr::const_arg_iterator AI,
CallExpr::const_arg_iterator AE,
ExplodedNodeSet& Dst) {
// Dispatch to transfer function logic to handle the call itself.
// FIXME: Allow us to chain together transfer functions.
- assert(Builder && "GRStmtNodeBuilder must be defined.");
+ assert(Builder && "StmtNodeBuilder must be defined.");
getTF().evalCall(DstTmp3, *this, *Builder, CE, L, Pred);
// Handle the case where no nodes where generated. Auto-generate that
static std::pair<const void*,const void*> EagerlyAssumeTag
= std::pair<const void*,const void*>(&EagerlyAssumeTag,static_cast<void*>(0));
-void GRExprEngine::evalEagerlyAssume(ExplodedNodeSet &Dst, ExplodedNodeSet &Src,
+void ExprEngine::evalEagerlyAssume(ExplodedNodeSet &Dst, ExplodedNodeSet &Src,
const Expr *Ex) {
for (ExplodedNodeSet::iterator I=Src.begin(), E=Src.end(); I!=E; ++I) {
ExplodedNode *Pred = *I;
// Transfer function: Objective-C @synchronized.
//===----------------------------------------------------------------------===//
-void GRExprEngine::VisitObjCAtSynchronizedStmt(const ObjCAtSynchronizedStmt *S,
+void ExprEngine::VisitObjCAtSynchronizedStmt(const ObjCAtSynchronizedStmt *S,
ExplodedNode *Pred,
ExplodedNodeSet &Dst) {
// Transfer function: Objective-C ivar references.
//===----------------------------------------------------------------------===//
-void GRExprEngine::VisitLvalObjCIvarRefExpr(const ObjCIvarRefExpr* Ex,
- ExplodedNode* Pred,
- ExplodedNodeSet& Dst) {
+void ExprEngine::VisitLvalObjCIvarRefExpr(const ObjCIvarRefExpr* Ex,
+ ExplodedNode* Pred,
+ ExplodedNodeSet& Dst) {
// Visit the base expression, which is needed for computing the lvalue
// of the ivar.
// Transfer function: Objective-C fast enumeration 'for' statements.
//===----------------------------------------------------------------------===//
-void GRExprEngine::VisitObjCForCollectionStmt(const ObjCForCollectionStmt* S,
+void ExprEngine::VisitObjCForCollectionStmt(const ObjCForCollectionStmt* S,
ExplodedNode* Pred, ExplodedNodeSet& Dst) {
// ObjCForCollectionStmts are processed in two places. This method
}
}
-void GRExprEngine::VisitObjCForCollectionStmtAux(const ObjCForCollectionStmt* S,
+void ExprEngine::VisitObjCForCollectionStmtAux(const ObjCForCollectionStmt* S,
ExplodedNode* Pred, ExplodedNodeSet& Dst,
SVal ElementV) {
};
} // end anonymous namespace
-void GRExprEngine::VisitObjCMessageExpr(const ObjCMessageExpr* ME,
+void ExprEngine::VisitObjCMessageExpr(const ObjCMessageExpr* ME,
ExplodedNode* Pred,
ExplodedNodeSet& Dst){
// Transfer functions: Miscellaneous statements.
//===----------------------------------------------------------------------===//
-void GRExprEngine::VisitCast(const CastExpr *CastE, const Expr *Ex,
- ExplodedNode *Pred, ExplodedNodeSet &Dst) {
+void ExprEngine::VisitCast(const CastExpr *CastE, const Expr *Ex,
+ ExplodedNode *Pred, ExplodedNodeSet &Dst) {
ExplodedNodeSet S1;
Visit(Ex, Pred, S1);
}
}
-void GRExprEngine::VisitCompoundLiteralExpr(const CompoundLiteralExpr* CL,
+void ExprEngine::VisitCompoundLiteralExpr(const CompoundLiteralExpr* CL,
ExplodedNode* Pred,
ExplodedNodeSet& Dst) {
const InitListExpr* ILE
}
}
-void GRExprEngine::VisitDeclStmt(const DeclStmt *DS, ExplodedNode *Pred,
+void ExprEngine::VisitDeclStmt(const DeclStmt *DS, ExplodedNode *Pred,
ExplodedNodeSet& Dst) {
// The CFG has one DeclStmt per Decl.
}
}
-void GRExprEngine::VisitCondInit(const VarDecl *VD, const Stmt *S,
+void ExprEngine::VisitCondInit(const VarDecl *VD, const Stmt *S,
ExplodedNode *Pred, ExplodedNodeSet& Dst) {
const Expr* InitEx = VD->getInit();
}
-void GRExprEngine::VisitInitListExpr(const InitListExpr* E, ExplodedNode* Pred,
+void ExprEngine::VisitInitListExpr(const InitListExpr* E, ExplodedNode* Pred,
ExplodedNodeSet& Dst) {
const GRState* state = GetState(Pred);
}
/// VisitSizeOfAlignOfExpr - Transfer function for sizeof(type).
-void GRExprEngine::VisitSizeOfAlignOfExpr(const SizeOfAlignOfExpr* Ex,
+void ExprEngine::VisitSizeOfAlignOfExpr(const SizeOfAlignOfExpr* Ex,
ExplodedNode* Pred,
ExplodedNodeSet& Dst) {
QualType T = Ex->getTypeOfArgument();
svalBuilder.makeIntVal(amt.getQuantity(), Ex->getType())));
}
-void GRExprEngine::VisitOffsetOfExpr(const OffsetOfExpr* OOE,
+void ExprEngine::VisitOffsetOfExpr(const OffsetOfExpr* OOE,
ExplodedNode* Pred, ExplodedNodeSet& Dst) {
Expr::EvalResult Res;
if (OOE->Evaluate(Res, getContext()) && Res.Val.isInt()) {
Dst.Add(Pred);
}
-void GRExprEngine::VisitUnaryOperator(const UnaryOperator* U,
+void ExprEngine::VisitUnaryOperator(const UnaryOperator* U,
ExplodedNode* Pred,
ExplodedNodeSet& Dst) {
}
}
-void GRExprEngine::VisitAsmStmt(const AsmStmt* A, ExplodedNode* Pred,
+void ExprEngine::VisitAsmStmt(const AsmStmt* A, ExplodedNode* Pred,
ExplodedNodeSet& Dst) {
VisitAsmStmtHelperOutputs(A, A->begin_outputs(), A->end_outputs(), Pred, Dst);
}
-void GRExprEngine::VisitAsmStmtHelperOutputs(const AsmStmt* A,
+void ExprEngine::VisitAsmStmtHelperOutputs(const AsmStmt* A,
AsmStmt::const_outputs_iterator I,
AsmStmt::const_outputs_iterator E,
ExplodedNode* Pred, ExplodedNodeSet& Dst) {
VisitAsmStmtHelperOutputs(A, I, E, *NI, Dst);
}
-void GRExprEngine::VisitAsmStmtHelperInputs(const AsmStmt* A,
+void ExprEngine::VisitAsmStmtHelperInputs(const AsmStmt* A,
AsmStmt::const_inputs_iterator I,
AsmStmt::const_inputs_iterator E,
ExplodedNode* Pred,
VisitAsmStmtHelperInputs(A, I, E, *NI, Dst);
}
-void GRExprEngine::VisitReturnStmt(const ReturnStmt *RS, ExplodedNode *Pred,
+void ExprEngine::VisitReturnStmt(const ReturnStmt *RS, ExplodedNode *Pred,
ExplodedNodeSet &Dst) {
ExplodedNodeSet Src;
if (const Expr *RetE = RS->getRetValue()) {
for (ExplodedNodeSet::iterator I = CheckedSet.begin(), E = CheckedSet.end();
I != E; ++I) {
- assert(Builder && "GRStmtNodeBuilder must be defined.");
+ assert(Builder && "StmtNodeBuilder must be defined.");
Pred = *I;
unsigned size = Dst.size();
// Transfer functions: Binary operators.
//===----------------------------------------------------------------------===//
-void GRExprEngine::VisitBinaryOperator(const BinaryOperator* B,
+void ExprEngine::VisitBinaryOperator(const BinaryOperator* B,
ExplodedNode* Pred,
ExplodedNodeSet& Dst) {
ExplodedNodeSet Tmp1;
// Checker registration/lookup.
//===----------------------------------------------------------------------===//
-Checker *GRExprEngine::lookupChecker(void *tag) const {
+Checker *ExprEngine::lookupChecker(void *tag) const {
CheckerMap::const_iterator I = CheckerM.find(tag);
return (I == CheckerM.end()) ? NULL : Checkers[I->second].second;
}
//===----------------------------------------------------------------------===//
#ifndef NDEBUG
-static GRExprEngine* GraphPrintCheckerState;
+static ExprEngine* GraphPrintCheckerState;
static SourceManager* GraphPrintSourceManager;
namespace llvm {
DOTGraphTraits (bool isSimple=false) : DefaultDOTGraphTraits(isSimple) {}
- // FIXME: Since we do not cache error nodes in GRExprEngine now, this does not
+ // FIXME: Since we do not cache error nodes in ExprEngine now, this does not
// work.
static std::string getNodeAttributes(const ExplodedNode* N, void*) {
}
#endif
-void GRExprEngine::ViewGraph(bool trim) {
+void ExprEngine::ViewGraph(bool trim) {
#ifndef NDEBUG
if (trim) {
std::vector<ExplodedNode*> Src;
GraphPrintCheckerState = this;
GraphPrintSourceManager = &getContext().getSourceManager();
- llvm::ViewGraph(*G.roots_begin(), "GRExprEngine");
+ llvm::ViewGraph(*G.roots_begin(), "ExprEngine");
GraphPrintCheckerState = NULL;
GraphPrintSourceManager = NULL;
#endif
}
-void GRExprEngine::ViewGraph(ExplodedNode** Beg, ExplodedNode** End) {
+void ExprEngine::ViewGraph(ExplodedNode** Beg, ExplodedNode** End) {
#ifndef NDEBUG
GraphPrintCheckerState = this;
GraphPrintSourceManager = &getContext().getSourceManager();
if (!TrimmedG.get())
llvm::errs() << "warning: Trimmed ExplodedGraph is empty.\n";
else
- llvm::ViewGraph(*TrimmedG->roots_begin(), "TrimmedGRExprEngine");
+ llvm::ViewGraph(*TrimmedG->roots_begin(), "TrimmedExprEngine");
GraphPrintCheckerState = NULL;
GraphPrintSourceManager = NULL;
#include "clang/Analysis/CFG.h"
#include "clang/GR/PathSensitive/GRStateTrait.h"
#include "clang/GR/PathSensitive/GRState.h"
-#include "clang/GR/PathSensitive/GRSubEngine.h"
-#include "clang/GR/PathSensitive/GRTransferFuncs.h"
+#include "clang/GR/PathSensitive/SubEngine.h"
+#include "clang/GR/PathSensitive/TransferFuncs.h"
#include "llvm/Support/raw_ostream.h"
using namespace clang;
StoreManager::InvalidatedSymbols *IS,
bool invalidateGlobals) const {
GRStateManager &Mgr = getStateManager();
- GRSubEngine &Eng = Mgr.getOwningEngine();
+ SubEngine &Eng = Mgr.getOwningEngine();
if (Eng.WantsRegionChangeUpdate(this)) {
StoreManager::InvalidatedRegions Regions;
#include "SimpleConstraintManager.h"
#include "clang/GR/PathSensitive/GRState.h"
#include "clang/GR/PathSensitive/GRStateTrait.h"
-#include "clang/GR/PathSensitive/GRTransferFuncs.h"
+#include "clang/GR/PathSensitive/TransferFuncs.h"
#include "clang/GR/ManagerRegistry.h"
#include "llvm/Support/Debug.h"
#include "llvm/ADT/FoldingSet.h"
class RangeConstraintManager : public SimpleConstraintManager{
RangeSet GetRange(const GRState *state, SymbolRef sym);
public:
- RangeConstraintManager(GRSubEngine &subengine)
+ RangeConstraintManager(SubEngine &subengine)
: SimpleConstraintManager(subengine) {}
const GRState *assumeSymNE(const GRState* state, SymbolRef sym,
} // end anonymous namespace
ConstraintManager* GR::CreateRangeConstraintManager(GRStateManager&,
- GRSubEngine &subeng) {
+ SubEngine &subeng) {
return new RangeConstraintManager(subeng);
}
/// type. 'Array' represents the lvalue of the array being decayed
/// to a pointer, and the returned SVal represents the decayed
/// version of that lvalue (i.e., a pointer to the first element of
- /// the array). This is called by GRExprEngine when evaluating
+ /// the array). This is called by ExprEngine when evaluating
/// casts from arrays to pointers.
SVal ArrayToPointer(Loc Array);
/// type. 'Array' represents the lvalue of the array being decayed
/// to a pointer, and the returned SVal represents the decayed
/// version of that lvalue (i.e., a pointer to the first element of
-/// the array). This is called by GRExprEngine when evaluating casts
+/// the array). This is called by ExprEngine when evaluating casts
/// from arrays to pointers.
SVal RegionStoreManager::ArrayToPointer(Loc Array) {
if (!isa<loc::MemRegionVal>(Array))
//===----------------------------------------------------------------------===//
#include "SimpleConstraintManager.h"
-#include "clang/GR/PathSensitive/GRExprEngine.h"
+#include "clang/GR/PathSensitive/ExprEngine.h"
#include "clang/GR/PathSensitive/GRState.h"
#include "clang/GR/PathSensitive/Checker.h"
namespace GR {
class SimpleConstraintManager : public ConstraintManager {
- GRSubEngine &SU;
+ SubEngine &SU;
public:
- SimpleConstraintManager(GRSubEngine &subengine) : SU(subengine) {}
+ SimpleConstraintManager(SubEngine &subengine) : SU(subengine) {}
virtual ~SimpleConstraintManager();
//===------------------------------------------------------------------===//
case BO_XorAssign:
case BO_OrAssign:
case BO_Comma:
- assert(false && "'=' and ',' operators handled by GRExprEngine.");
+ assert(false && "'=' and ',' operators handled by ExprEngine.");
return UnknownVal();
case BO_PtrMemD:
case BO_PtrMemI:
//===----------------------------------------------------------------------===//
//
// This file defines SymbolManager, a class that manages symbolic values
-// created for use by GRExprEngine and related classes.
+// created for use by ExprEngine and related classes.
//
//===----------------------------------------------------------------------===//
void push_back(const T&) { int a[sizeof(T) ? -1: -1]; } // expected-error {{array size is negative}}
};
-class GRExprEngine {
+class ExprEngine {
public:
typedef vector<S<void *> >CheckersOrdered;
CheckersOrdered Checkers;
class RetainReleaseChecker { };
-void f(GRExprEngine& Eng) {
- Eng.registerCheck(new RetainReleaseChecker); // expected-note {{in instantiation of function template specialization 'GRExprEngine::registerCheck<RetainReleaseChecker>' requested here}}
+void f(ExprEngine& Eng) {
+ Eng.registerCheck(new RetainReleaseChecker); // expected-note {{in instantiation of function template specialization 'ExprEngine::registerCheck<RetainReleaseChecker>' requested here}}
}
// PR 5838