- Exposed the worklist and BlockAborted flag in GRCoreEngine
- Changed postanalysis checkers to use the new infrastructure
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110095
91177308-0d34-0410-b5e6-
96231b3b80d8
}
virtual void VisitEndAnalysis(ExplodedGraph &G, BugReporter &B,
- bool hasWorkRemaining) {}
+ GRExprEngine &Eng) {}
};
} // end clang namespace
void ExecuteWorkListWithInitialState(const LocationContext *L, unsigned Steps,
const GRState *InitState,
ExplodedNodeSet &Dst);
+
+ // Functions for external checking of whether we have unfinished work
+ bool wasBlockAborted() const { return BlockAborted; }
+ bool hasWorkRemaining() const { return BlockAborted || WList->hasWork(); }
+
+ GRWorkList *getWorkList() const { return WList; }
};
class GRStmtNodeBuilder {
SymbolManager& getSymbolManager() { return SymMgr; }
const SymbolManager& getSymbolManager() const { return SymMgr; }
+ // Functions for external checking of whether we have unfinished work
+ bool wasBlockAborted() const { return CoreEngine.wasBlockAborted(); }
+ bool hasWorkRemaining() const {
+ return wasBlockAborted() || getWorkList()->hasWork();
+ }
+
+ GRWorkList *getWorkList() const { return CoreEngine.getWorkList(); }
+
protected:
const GRState* GetState(ExplodedNode* N) {
return N == EntryNode ? CleanedState : N->getState();
void GRExprEngine::ProcessEndWorklist(bool hasWorkRemaining) {
for (CheckersOrdered::iterator I = Checkers.begin(), E = Checkers.end();
I != E; ++I) {
- I->second->VisitEndAnalysis(G, BR, hasWorkRemaining);
+ I->second->VisitEndAnalysis(G, BR, *this);
}
}
public:
static void *getTag();
void PreVisitBinaryOperator(CheckerContext &C, const BinaryOperator *B);
- void VisitEndAnalysis(ExplodedGraph &G, BugReporter &B,
- bool hasWorkRemaining);
+ void VisitEndAnalysis(ExplodedGraph &G, BugReporter &B, GRExprEngine &Eng);
private:
// Our assumption about a particular operation.
void IdempotentOperationChecker::VisitEndAnalysis(ExplodedGraph &G,
BugReporter &BR,
- bool hasWorkRemaining) {
+ GRExprEngine &Eng) {
// If there is any work remaining we cannot be 100% sure about our warnings
- if (hasWorkRemaining)
+ if (Eng.hasWorkRemaining())
return;
// Iterate over the hash to see if we have any paths with definite
class UnreachableCodeChecker : public CheckerVisitor<UnreachableCodeChecker> {
public:
static void *getTag();
- void VisitEndAnalysis(ExplodedGraph &G, BugReporter &B,
- bool hasWorkRemaining);
+ void VisitEndAnalysis(ExplodedGraph &G,
+ BugReporter &B,
+ GRExprEngine &Eng);
private:
typedef bool (*ExplodedNodeHeuristic)(const ExplodedNode &EN);
void UnreachableCodeChecker::VisitEndAnalysis(ExplodedGraph &G,
BugReporter &B,
- bool hasWorkRemaining) {
+ GRExprEngine &Eng) {
// Bail out if we didn't cover all paths
- if (hasWorkRemaining)
+ if (Eng.hasWorkRemaining())
return;
CFG *C = 0;