Hi Ted,

Sorry about that. Here is the patch i regenerated.

2011/4/1 Ted Kremenek <[email protected]>

> Hi Lei,
>
> I think this looks reasonable, but I think you also need to include changes
> to CoreEngine.h.  My tree doesn't build with this patch since
> BranchNodeBuild::generateNode() is not declared in the header.
>
> Cheers,
> Ted
>
> On Mar 30, 2011, at 7:24 PM, 章磊 wrote:
>
> > This patch add a new ProgramPoint PostCondition to represent the post
> position of a branch condition, and a new generateNode method to
> BranchNodeBuilder using PostCondition ProgramPoint. This method generate a
> new ExplodedNode but not a new block edge.
> >
> > This patch is preparation for statistical UncheckedRenturn checker.
> >
> > I'll appreciate it if there are any advice about this patch.
> >
> > --
> > Best regards!
> >
> > Lei Zhang
> > <PostCondition.patch>_______________________________________________
> > cfe-commits mailing list
> > [email protected]
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>


-- 
Best regards!

Lei Zhang
Index: include/clang/Analysis/ProgramPoint.h
===================================================================
--- include/clang/Analysis/ProgramPoint.h	(revision 128522)
+++ include/clang/Analysis/ProgramPoint.h	(working copy)
@@ -43,6 +43,7 @@
               PostStoreKind,
               PostPurgeDeadSymbolsKind,
               PostStmtCustomKind,
+              PostConditionKind,
               PostLValueKind,
               PostInitializerKind,
               CallEnterKind,
@@ -221,7 +222,17 @@
   }
 };
 
-  
+// PostCondition represents the post program point of a branch condition.
+class PostCondition : public PostStmt {
+public:
+  PostCondition(const Stmt* S, const LocationContext *L, const void *tag = 0)
+    : PostStmt(S, PostConditionKind, L, tag) {}
+
+  static bool classof(const ProgramPoint* Location) {
+    return Location->getKind() == PostConditionKind;
+  }
+};
+
 class LocationCheck : public StmtPoint {
 protected:
   LocationCheck(const Stmt *S, const LocationContext *L,
Index: include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
===================================================================
--- include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h	(revision 128522)
+++ include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h	(working copy)
@@ -284,6 +284,8 @@
 
   BlockCounter getBlockCounter() const { return Eng.WList->getBlockCounter();}
 
+  ExplodedNode* generateNode(const Stmt *Condition, const GRState* State);
+
   ExplodedNode* generateNode(const GRState* State, bool branch);
 
   const CFGBlock* getTargetBlock(bool branch) const {
Index: lib/StaticAnalyzer/Core/CoreEngine.cpp
===================================================================
--- lib/StaticAnalyzer/Core/CoreEngine.cpp	(revision 128522)
+++ lib/StaticAnalyzer/Core/CoreEngine.cpp	(working copy)
@@ -602,6 +602,25 @@
   return NULL;
 }
 
+// This function generate a new ExplodedNode but not a new branch(block edge).
+ExplodedNode* BranchNodeBuilder::generateNode(const Stmt* Condition,
+                                              const GRState* State) {
+  bool IsNew;
+  
+  ExplodedNode* Succ 
+    = Eng.G->getNode(PostCondition(Condition, Pred->getLocationContext()), State,
+                     &IsNew);
+  
+  Succ->addPredecessor(Pred, *Eng.G);
+  
+  Pred = Succ;
+  
+  if (IsNew) 
+    return Succ;
+  
+  return NULL;
+}
+
 ExplodedNode* BranchNodeBuilder::generateNode(const GRState* State,
                                                 bool branch) {
 
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to