aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2009-04-09 06:30:17 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2009-04-09 06:30:17 +0000
commitfe1635bb27f5a13314169143cfdae6ecc6e4b3e2 (patch)
treec132080fab10cab50d17ceaa59f929d1e4c23732
parent9e82acb49d2fc1bc7e2ca4e0a489dc2b3d145c7b (diff)
Add a new method because sometimes the type of the conjured symbol is not the
type of the expression where we create the symbol. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68692 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Analysis/PathSensitive/SVals.h2
-rw-r--r--lib/Analysis/CFRefCount.cpp2
-rw-r--r--lib/Analysis/SVals.cpp13
3 files changed, 16 insertions, 1 deletions
diff --git a/include/clang/Analysis/PathSensitive/SVals.h b/include/clang/Analysis/PathSensitive/SVals.h
index 6667f9323b..9d9d9d8091 100644
--- a/include/clang/Analysis/PathSensitive/SVals.h
+++ b/include/clang/Analysis/PathSensitive/SVals.h
@@ -78,6 +78,8 @@ public:
static SVal GetConjuredSymbolVal(SymbolManager& SymMgr, MemRegionManager&,
const Expr *E, unsigned Count);
+ static SVal GetConjuredSymbolVal(SymbolManager &SymMgr, MemRegionManager&,
+ const Expr* E, QualType T, unsigned Count);
inline bool isUnknown() const {
return getRawKind() == UnknownKind;
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp
index 9f48fffc28..5d1834f929 100644
--- a/lib/Analysis/CFRefCount.cpp
+++ b/lib/Analysis/CFRefCount.cpp
@@ -1761,7 +1761,7 @@ void CFRefCount::EvalSummary(ExplodedNodeSet<GRState>& Dst,
if (Loc::IsLocType(T) || (T->isIntegerType() && T->isScalarType())){
SVal V = SVal::GetConjuredSymbolVal(Eng.getSymbolManager(),
- Eng.getStoreManager().getRegionManager(), *I, Count);
+ Eng.getStoreManager().getRegionManager(), *I, T, Count);
state = state.BindLoc(Loc::MakeVal(R), V);
}
else if (const RecordType *RT = T->getAsStructureType()) {
diff --git a/lib/Analysis/SVals.cpp b/lib/Analysis/SVals.cpp
index cf3e800d99..ddb2da611f 100644
--- a/lib/Analysis/SVals.cpp
+++ b/lib/Analysis/SVals.cpp
@@ -312,6 +312,19 @@ SVal SVal::GetConjuredSymbolVal(SymbolManager &SymMgr, MemRegionManager& MRMgr,
return UnknownVal();
}
+SVal SVal::GetConjuredSymbolVal(SymbolManager &SymMgr, MemRegionManager& MRMgr,
+ const Expr* E, QualType T, unsigned Count) {
+ SymbolRef sym = SymMgr.getConjuredSymbol(E, T, Count);
+
+ if (Loc::IsLocType(T))
+ return Loc::MakeVal(MRMgr.getSymbolicRegion(sym));
+
+ if (T->isIntegerType() && T->isScalarType())
+ return NonLoc::MakeVal(sym);
+
+ return UnknownVal();
+}
+
nonloc::LocAsInteger nonloc::LocAsInteger::Make(BasicValueFactory& Vals, Loc V,
unsigned Bits) {
return LocAsInteger(Vals.getPersistentSValWithData(V, Bits));