[cfe-commits] r110095 - in /cfe/trunk: include/clang/Checker/PathSensitive/Checker.h include/clang/Checker/PathSensitive/GRCoreEngine.h include/clang/Checker/PathSensitive/GRExprEngine.h lib/Checker/GRExprEngine.cpp lib/Checker/IdempotentOperationChecker.cpp lib/Checker/UnreachableCodeChecker.cpp
Tom Care
tcare at apple.com
Mon Aug 2 18:55:07 PDT 2010
Author: tcare
Date: Mon Aug 2 20:55:07 2010
New Revision: 110095
URL: http://llvm.org/viewvc/llvm-project?rev=110095&view=rev
Log:
Changed GRExprEngine to pass down a reference to itself when checkers are doing postanalysis. This allows the checker to gather information about the state of the engine when it has finished.
- Exposed the worklist and BlockAborted flag in GRCoreEngine
- Changed postanalysis checkers to use the new infrastructure
Modified:
cfe/trunk/include/clang/Checker/PathSensitive/Checker.h
cfe/trunk/include/clang/Checker/PathSensitive/GRCoreEngine.h
cfe/trunk/include/clang/Checker/PathSensitive/GRExprEngine.h
cfe/trunk/lib/Checker/GRExprEngine.cpp
cfe/trunk/lib/Checker/IdempotentOperationChecker.cpp
cfe/trunk/lib/Checker/UnreachableCodeChecker.cpp
Modified: cfe/trunk/include/clang/Checker/PathSensitive/Checker.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Checker/PathSensitive/Checker.h?rev=110095&r1=110094&r2=110095&view=diff
==============================================================================
--- cfe/trunk/include/clang/Checker/PathSensitive/Checker.h (original)
+++ cfe/trunk/include/clang/Checker/PathSensitive/Checker.h Mon Aug 2 20:55:07 2010
@@ -285,7 +285,7 @@
}
virtual void VisitEndAnalysis(ExplodedGraph &G, BugReporter &B,
- bool hasWorkRemaining) {}
+ GRExprEngine &Eng) {}
};
} // end clang namespace
Modified: cfe/trunk/include/clang/Checker/PathSensitive/GRCoreEngine.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Checker/PathSensitive/GRCoreEngine.h?rev=110095&r1=110094&r2=110095&view=diff
==============================================================================
--- cfe/trunk/include/clang/Checker/PathSensitive/GRCoreEngine.h (original)
+++ cfe/trunk/include/clang/Checker/PathSensitive/GRCoreEngine.h Mon Aug 2 20:55:07 2010
@@ -158,6 +158,12 @@
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 {
Modified: cfe/trunk/include/clang/Checker/PathSensitive/GRExprEngine.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Checker/PathSensitive/GRExprEngine.h?rev=110095&r1=110094&r2=110095&view=diff
==============================================================================
--- cfe/trunk/include/clang/Checker/PathSensitive/GRExprEngine.h (original)
+++ cfe/trunk/include/clang/Checker/PathSensitive/GRExprEngine.h Mon Aug 2 20:55:07 2010
@@ -236,6 +236,14 @@
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();
Modified: cfe/trunk/lib/Checker/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/GRExprEngine.cpp?rev=110095&r1=110094&r2=110095&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/GRExprEngine.cpp (original)
+++ cfe/trunk/lib/Checker/GRExprEngine.cpp Mon Aug 2 20:55:07 2010
@@ -518,7 +518,7 @@
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);
}
}
Modified: cfe/trunk/lib/Checker/IdempotentOperationChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/IdempotentOperationChecker.cpp?rev=110095&r1=110094&r2=110095&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/IdempotentOperationChecker.cpp (original)
+++ cfe/trunk/lib/Checker/IdempotentOperationChecker.cpp Mon Aug 2 20:55:07 2010
@@ -65,8 +65,7 @@
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.
@@ -293,9 +292,9 @@
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
Modified: cfe/trunk/lib/Checker/UnreachableCodeChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/UnreachableCodeChecker.cpp?rev=110095&r1=110094&r2=110095&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/UnreachableCodeChecker.cpp (original)
+++ cfe/trunk/lib/Checker/UnreachableCodeChecker.cpp Mon Aug 2 20:55:07 2010
@@ -33,8 +33,9 @@
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);
@@ -60,9 +61,9 @@
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;
More information about the cfe-commits
mailing list