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 | d2419a0730ca2fec96ec8ec44b995d6c1bc126aa (patch) | |
tree | 7c4935689f16f8709805ff395813e30b4ed5eed5 /clang/lib/Analysis/GRExprEngine.cpp | |
parent | da508ac5d8ba5f778f27d30a18269eeb4ec2f282 (diff) | |
download | bcm5719-llvm-d2419a0730ca2fec96ec8ec44b995d6c1bc126aa.tar.gz bcm5719-llvm-d2419a0730ca2fec96ec8ec44b995d6c1bc126aa.zip |
Remove false path where the default branch in a switch statement would
always be taken even if it was not feasible.
llvm-svn: 50132
Diffstat (limited to 'clang/lib/Analysis/GRExprEngine.cpp')
-rw-r--r-- | clang/lib/Analysis/GRExprEngine.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/Analysis/GRExprEngine.cpp b/clang/lib/Analysis/GRExprEngine.cpp index d5b2ce8b358..6072094d057 100644 --- a/clang/lib/Analysis/GRExprEngine.cpp +++ b/clang/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); } //===----------------------------------------------------------------------===// |