aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/Analysis/PathSensitive/SVals.h4
-rw-r--r--lib/Analysis/GRExprEngine.cpp3
-rw-r--r--lib/Analysis/SVals.cpp23
3 files changed, 14 insertions, 16 deletions
diff --git a/include/clang/Analysis/PathSensitive/SVals.h b/include/clang/Analysis/PathSensitive/SVals.h
index 0f334f12f2..6667f9323b 100644
--- a/include/clang/Analysis/PathSensitive/SVals.h
+++ b/include/clang/Analysis/PathSensitive/SVals.h
@@ -76,8 +76,8 @@ public:
static SVal GetRValueSymbolVal(SymbolManager& SymMgr, MemRegionManager& MRMgr,
const MemRegion* R);
- static SVal GetConjuredSymbolVal(SymbolManager& SymMgr, const Expr *E,
- unsigned Count);
+ static SVal GetConjuredSymbolVal(SymbolManager& SymMgr, MemRegionManager&,
+ const Expr *E, unsigned Count);
inline bool isUnknown() const {
return getRawKind() == UnknownKind;
diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp
index 7e3fd45ab9..1fb7e5d966 100644
--- a/lib/Analysis/GRExprEngine.cpp
+++ b/lib/Analysis/GRExprEngine.cpp
@@ -2536,7 +2536,8 @@ void GRExprEngine::VisitUnaryOperator(UnaryOperator* U, NodeTy* Pred,
// Conjure a new symbol if necessary to recover precision.
if (Result.isUnknown() || !getConstraintManager().canReasonAbout(Result))
- Result = SVal::GetConjuredSymbolVal(SymMgr, Ex,
+ Result = SVal::GetConjuredSymbolVal(SymMgr,
+ getStoreManager().getRegionManager(),Ex,
Builder->getCurrentBlockCount());
state = BindExpr(state, U, U->isPostfix() ? V2 : Result);
diff --git a/lib/Analysis/SVals.cpp b/lib/Analysis/SVals.cpp
index c5900b30cd..cf3e800d99 100644
--- a/lib/Analysis/SVals.cpp
+++ b/lib/Analysis/SVals.cpp
@@ -291,26 +291,23 @@ SVal SVal::GetRValueSymbolVal(SymbolManager& SymMgr, MemRegionManager& MRMgr,
return Loc::MakeVal(MRMgr.getSymbolicRegion(sym));
// Only handle integers for now.
- if (T->isIntegerType())
+ if (T->isIntegerType() && T->isScalarType())
return NonLoc::MakeVal(sym);
}
return UnknownVal();
}
-SVal SVal::GetConjuredSymbolVal(SymbolManager &SymMgr, const Expr* E,
- unsigned Count) {
-
+SVal SVal::GetConjuredSymbolVal(SymbolManager &SymMgr, MemRegionManager& MRMgr,
+ const Expr* E, unsigned Count) {
QualType T = E->getType();
-
- if (Loc::IsLocType(T)) {
- SymbolRef Sym = SymMgr.getConjuredSymbol(E, Count);
- return loc::SymbolVal(Sym);
- }
- else if (T->isIntegerType() && T->isScalarType()) {
- SymbolRef Sym = SymMgr.getConjuredSymbol(E, Count);
- return nonloc::SymbolVal(Sym);
- }
+ SymbolRef sym = SymMgr.getConjuredSymbol(E, Count);
+
+ if (Loc::IsLocType(T))
+ return Loc::MakeVal(MRMgr.getSymbolicRegion(sym));
+
+ if (T->isIntegerType() && T->isScalarType())
+ return NonLoc::MakeVal(sym);
return UnknownVal();
}