From 1e9775d36de8edbc665c0f0bf4dae1400e3d2112 Mon Sep 17 00:00:00 2001
From: Anna Zaks <ganna@apple.com>
Date: Mon, 3 Oct 2011 21:55:56 +0000
Subject: [PATCH] [analyzer] In UndefBranchChecker, use a node generator which
 does not create an edge/branching. (ExprEngine should be in charge of
 generating edges. The checkers should examine the condition and generate
 PostCondition node if needed.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141034 91177308-0d34-0410-b5e6-96231b3b80d8
---
 include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h | 2 ++
 lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp           | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h b/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
index 93518277027..e2ea13d1c52 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
@@ -316,6 +316,8 @@ public:
 
   BlockCounter getBlockCounter() const { return Eng.WList->getBlockCounter();}
 
+  /// This function generates a new ExplodedNode but not a new
+  /// branch(block edge).
   ExplodedNode *generateNode(const Stmt *Condition, const ProgramState *State);
 
   ExplodedNode *generateNode(const ProgramState *State, bool branch);
diff --git a/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp b/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp
index a7a4b5a11db..b860b34ff35 100644
--- a/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp
@@ -61,7 +61,7 @@ void UndefBranchChecker::checkBranchCondition(const Stmt *Condition,
   const ProgramState *state = Builder.getState();
   SVal X = state->getSVal(Condition);
   if (X.isUndef()) {
-    ExplodedNode *N = Builder.generateNode(state, true);
+    ExplodedNode *N = Builder.generateNode(Condition, state);
     if (N) {
       N->markAsSink();
       if (!BT)
-- 
GitLab