aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2011-10-27 00:59:32 +0000
committerAnna Zaks <ganna@apple.com>2011-10-27 00:59:32 +0000
commitdf95d146c13cf02e106b32b01d147577d6d6b5a1 (patch)
treedfdfcf5128127842c780b7d40166cc9d515162a0
parent4d2ae4a70336dc2aa11389b34946be152bb454c9 (diff)
[analyzer] Optimize by not generating empty transitions in CheckerContext
Go not generate a new transition by addTransition methods if nothing changed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143091 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h b/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
index b1aad7f63d..c3a00bd97a 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
@@ -110,7 +110,6 @@ public:
/// \brief Generates a default transition (containing checker tag but no
/// checker state changes).
- // TODO: Can we remove this one? We always generate autotransitions.
ExplodedNode *addTransition() {
return addTransition(getState());
}
@@ -148,6 +147,9 @@ private:
ExplodedNode *P = 0,
const ProgramPointTag *Tag = 0) {
assert(State);
+ if (State == Pred->getState() && !Tag && !MarkAsSink)
+ return Pred;
+
ExplodedNode *node = NB.generateNode(Tag ? Location.withTag(Tag) : Location,
State,
P ? P : Pred, MarkAsSink);