diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-04-22 21:39:21 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-04-22 21:39:21 +0000 |
commit | a548846b471f7ca05ec6038c7d9d3b4d0de777cc (patch) | |
tree | c1058534cfcb155a4145715be9d2e41f2438f928 /lib/Analysis | |
parent | 0fe33bc94a822e315585e5cde1964d3c3b9052f9 (diff) |
Added lval type (and tracking) for StringLiterals.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50109 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r-- | lib/Analysis/CFRefCount.cpp | 2 | ||||
-rw-r--r-- | lib/Analysis/GRExprEngine.cpp | 1 | ||||
-rw-r--r-- | lib/Analysis/GRSimpleVals.cpp | 4 | ||||
-rw-r--r-- | lib/Analysis/RValues.cpp | 10 | ||||
-rw-r--r-- | lib/Analysis/ValueState.cpp | 3 |
5 files changed, 20 insertions, 0 deletions
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp index 253e00589e..499da2f85f 100644 --- a/lib/Analysis/CFRefCount.cpp +++ b/lib/Analysis/CFRefCount.cpp @@ -826,6 +826,8 @@ void CFRefCount::EvalCall(ExplodedNodeSet<ValueState>& Dst, // should compose behavior, not copy it. StateMgr.Unbind(StVals, cast<LVal>(V)); } + else if (isa<nonlval::LValAsInteger>(V)) + StateMgr.Unbind(StVals, cast<nonlval::LValAsInteger>(V).getLVal()); } St = StateMgr.getPersistentState(StVals); diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp index bdb742929d..128ef82c63 100644 --- a/lib/Analysis/GRExprEngine.cpp +++ b/lib/Analysis/GRExprEngine.cpp @@ -2014,6 +2014,7 @@ ValueState* GRExprEngine::AssumeAux(ValueState* St, LVal Cond, case lval::DeclValKind: case lval::FuncValKind: case lval::GotoLabelKind: + case lval::StringLiteralValKind: isFeasible = Assumption; return St; diff --git a/lib/Analysis/GRSimpleVals.cpp b/lib/Analysis/GRSimpleVals.cpp index 2c14dde08b..e41df7662c 100644 --- a/lib/Analysis/GRSimpleVals.cpp +++ b/lib/Analysis/GRSimpleVals.cpp @@ -572,6 +572,10 @@ void GRSimpleVals::EvalCall(ExplodedNodeSet<ValueState>& Dst, if (isa<LVal>(V)) St = StateMgr.SetRVal(St, cast<LVal>(V), UnknownVal()); + else if (isa<nonlval::LValAsInteger>(V)) + St = StateMgr.SetRVal(St, cast<nonlval::LValAsInteger>(V).getLVal(), + UnknownVal()); + } // Make up a symbol for the return value of this function. diff --git a/lib/Analysis/RValues.cpp b/lib/Analysis/RValues.cpp index 86f5ac96fd..5e161f34a5 100644 --- a/lib/Analysis/RValues.cpp +++ b/lib/Analysis/RValues.cpp @@ -240,6 +240,10 @@ RVal RVal::GetSymbolValue(SymbolManager& SymMgr, VarDecl* D) { LVal LVal::MakeVal(AddrLabelExpr* E) { return lval::GotoLabel(E->getLabel()); } +LVal LVal::MakeVal(StringLiteral* S) { + return lval::StringLiteralVal(S); +} + //===----------------------------------------------------------------------===// // Utility methods for constructing RVals (both NonLVals and LVals). //===----------------------------------------------------------------------===// @@ -392,6 +396,12 @@ void LVal::print(std::ostream& Out) const { << cast<lval::FuncVal>(this)->getDecl()->getIdentifier()->getName(); break; + case lval::StringLiteralValKind: + Out << "literal \"" + << cast<lval::StringLiteralVal>(this)->getLiteral()->getStrData() + << "\""; + break; + default: assert (false && "Pretty-printing not implemented for this LVal."); break; diff --git a/lib/Analysis/ValueState.cpp b/lib/Analysis/ValueState.cpp index bba2e06a18..8027ce9fcb 100644 --- a/lib/Analysis/ValueState.cpp +++ b/lib/Analysis/ValueState.cpp @@ -264,6 +264,9 @@ RVal ValueStateManager::GetRVal(ValueState* St, Expr* E) { case Stmt::IntegerLiteralClass: { return NonLVal::MakeVal(BasicVals, cast<IntegerLiteral>(E)); } + + case Stmt::StringLiteralClass: + return LVal::MakeVal(cast<StringLiteral>(E)); // Casts where the source and target type are the same // are no-ops. We blast through these to get the descendant |