diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-04-23 05:03:18 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-04-23 05:03:18 +0000 |
commit | 5014ab113eb211b8320ae30b173d7020352663c6 (patch) | |
tree | a0b58f3d3252ba1a2f8f740413e82884e047feb6 | |
parent | c66d0aa934f2afd412f50881a5e959bb8582cf14 (diff) |
Remove false path where the default branch in a switch statement would
always be taken even if it was not feasible.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50132 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Analysis/GRExprEngine.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp index d5b2ce8b35..6072094d05 100644 --- a/lib/Analysis/GRExprEngine.cpp +++ b/lib/Analysis/GRExprEngine.cpp @@ -562,6 +562,7 @@ void GRExprEngine::ProcessSwitch(SwitchNodeBuilder& builder) { APSInt V1(bits, false); APSInt V2 = V1; + bool DefaultFeasible = false; for (iterator I = builder.begin(), EI = builder.end(); I != EI; ++I) { @@ -617,8 +618,10 @@ void GRExprEngine::ProcessSwitch(SwitchNodeBuilder& builder) { isFeasible = false; StNew = Assume(DefaultSt, Res, false, isFeasible); - if (isFeasible) + if (isFeasible) { + DefaultFeasible = true; DefaultSt = StNew; + } // Concretize the next value in the range. if (V1 == V2) @@ -632,7 +635,7 @@ void GRExprEngine::ProcessSwitch(SwitchNodeBuilder& builder) { // If we reach here, than we know that the default branch is // possible. - builder.generateDefaultCaseNode(DefaultSt); + if (DefaultFeasible) builder.generateDefaultCaseNode(DefaultSt); } //===----------------------------------------------------------------------===// |