diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-02-26 23:37:01 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-02-26 23:37:01 +0000 |
commit | 6217dffec367de7fcdb01cf055c1b2b8d9583ee5 (patch) | |
tree | f9d6e5de3e5f901e9e52a13d68b5115e3e86377b /clang/Analysis/ValueState.cpp | |
parent | 30075852ef18303b441792ad3e1ce60f5ce4982c (diff) | |
download | bcm5719-llvm-6217dffec367de7fcdb01cf055c1b2b8d9583ee5.tar.gz bcm5719-llvm-6217dffec367de7fcdb01cf055c1b2b8d9583ee5.zip |
Fix bug when processing '?' operator: invalidate the old "Uninitialized" value of the block-level expression for ?.
llvm-svn: 47645
Diffstat (limited to 'clang/Analysis/ValueState.cpp')
-rw-r--r-- | clang/Analysis/ValueState.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/clang/Analysis/ValueState.cpp b/clang/Analysis/ValueState.cpp index 7be59ce5f5f..97a090dad70 100644 --- a/clang/Analysis/ValueState.cpp +++ b/clang/Analysis/ValueState.cpp @@ -387,12 +387,27 @@ RVal ValueStateManager::GetLVal(ValueState St, Expr* E) { } ValueState -ValueStateManager::SetRVal(ValueState St, Expr* E, bool isBlkExpr, RVal V) { +ValueStateManager::SetRVal(ValueState St, Expr* E, RVal V, + bool isBlkExpr, bool Invalidate) { assert (E); - if (V.isUnknown()) + if (V.isUnknown()) { + + if (Invalidate) { + + ValueStateImpl NewSt = *St; + + if (isBlkExpr) + NewSt.BlockExprBindings = EXFactory.Remove(NewSt.BlockExprBindings, E); + else + NewSt.SubExprBindings = EXFactory.Remove(NewSt.SubExprBindings, E); + + return getPersistentState(NewSt); + } + return St; + } ValueStateImpl NewSt = *St; @@ -406,8 +421,8 @@ ValueStateManager::SetRVal(ValueState St, Expr* E, bool isBlkExpr, RVal V) { return getPersistentState(NewSt); } -ValueState -ValueStateManager::SetRVal(ValueState St, LVal LV, RVal V) { + +ValueState ValueStateManager::SetRVal(ValueState St, LVal LV, RVal V) { switch (LV.getSubKind()) { |