[cfe-commits] r46536 - in /cfe/trunk: Analysis/GRConstants.cpp Analysis/GREngine.cpp include/clang/Analysis/PathSensitive/GREngine.h
Ted Kremenek
kremenek at apple.com
Tue Jan 29 15:32:35 PST 2008
Author: kremenek
Date: Tue Jan 29 17:32:35 2008
New Revision: 46536
URL: http://llvm.org/viewvc/llvm-project?rev=46536&view=rev
Log:
Implemented more boilerplate in GREngine for processing branches. Now
we automatically generate a new successor node along an edge if the checker
did not explicitly do so (i.e., we just propagate the current state).
Modified:
cfe/trunk/Analysis/GRConstants.cpp
cfe/trunk/Analysis/GREngine.cpp
cfe/trunk/include/clang/Analysis/PathSensitive/GREngine.h
Modified: cfe/trunk/Analysis/GRConstants.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/GRConstants.cpp?rev=46536&r1=46535&r2=46536&view=diff
==============================================================================
--- cfe/trunk/Analysis/GRConstants.cpp (original)
+++ cfe/trunk/Analysis/GRConstants.cpp Tue Jan 29 17:32:35 2008
@@ -831,8 +831,7 @@
/// ProcessBranch - Called by GREngine. Used to generate successor
/// nodes by processing the 'effects' of a branch condition.
- void ProcessBranch(Stmt* Condition, Stmt* Term, BranchNodeBuilder& builder)
- {}
+ void ProcessBranch(Stmt* Condition, Stmt* Term, BranchNodeBuilder& builder);
/// RemoveDeadBindings - Return a new state that is the same as 'M' except
/// that all subexpression mappings are removed and that any
@@ -877,6 +876,12 @@
} // end anonymous namespace
+void GRConstants::ProcessBranch(Stmt* Condition, Stmt* Term,
+ BranchNodeBuilder& builder) {
+
+
+}
+
void GRConstants::ProcessStmt(Stmt* S, StmtNodeBuilder& builder) {
Builder = &builder;
Modified: cfe/trunk/Analysis/GREngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/GREngine.cpp?rev=46536&r1=46535&r2=46536&view=diff
==============================================================================
--- cfe/trunk/Analysis/GREngine.cpp (original)
+++ cfe/trunk/Analysis/GREngine.cpp Tue Jan 29 17:32:35 2008
@@ -296,6 +296,14 @@
Succ->addPredecessor(Pred);
+ if (branch) GeneratedTrue = true;
+ else GeneratedFalse = true;
+
if (IsNew)
Eng.WList->Enqueue(GRWorkListUnit(Succ));
}
+
+GRBranchNodeBuilderImpl::~GRBranchNodeBuilderImpl() {
+ if (!GeneratedTrue) generateNodeImpl(Pred->State, true);
+ if (!GeneratedFalse) generateNodeImpl(Pred->State, false);
+}
Modified: cfe/trunk/include/clang/Analysis/PathSensitive/GREngine.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/GREngine.h?rev=46536&r1=46535&r2=46536&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/GREngine.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/GREngine.h Tue Jan 29 17:32:35 2008
@@ -167,12 +167,16 @@
CFGBlock* DstF;
ExplodedNodeImpl* Pred;
+ bool GeneratedTrue;
+ bool GeneratedFalse;
+
public:
GRBranchNodeBuilderImpl(CFGBlock* src, CFGBlock* dstT, CFGBlock* dstF,
ExplodedNodeImpl* pred, GREngineImpl* e)
- : Eng(*e), Src(src), DstT(dstT), DstF(dstF), Pred(pred) {}
+ : Eng(*e), Src(src), DstT(dstT), DstF(dstF), Pred(pred),
+ GeneratedTrue(false), GeneratedFalse(false) {}
- ~GRBranchNodeBuilderImpl() {}
+ ~GRBranchNodeBuilderImpl();
const ExplodedGraphImpl& getGraph() const { return *Eng.G; }
More information about the cfe-commits
mailing list