From df95d146c13cf02e106b32b01d147577d6d6b5a1 Mon Sep 17 00:00:00 2001 From: Anna Zaks Date: Thu, 27 Oct 2011 00:59:32 +0000 Subject: [PATCH] [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 --- .../clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); -- 2.50.1