aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-12-02 07:49:45 +0000
committerTed Kremenek <kremenek@apple.com>2010-12-02 07:49:45 +0000
commitc8413fd03f73084a5c93028f8b4db619fc388087 (patch)
tree0815a7cb0b9c477e280a91e4c89713488e43f7f2
parent0608f53744ccf88c4d21d6b500f6d23927533ac9 (diff)
Merge ValueManager into SValBuilder.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120696 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Checker/BugReporter/BugReporter.h4
-rw-r--r--include/clang/Checker/PathSensitive/Checker.h4
-rw-r--r--include/clang/Checker/PathSensitive/Environment.h11
-rw-r--r--include/clang/Checker/PathSensitive/GRExprEngine.h8
-rw-r--r--include/clang/Checker/PathSensitive/GRState.h33
-rw-r--r--include/clang/Checker/PathSensitive/MemRegion.h14
-rw-r--r--include/clang/Checker/PathSensitive/SValBuilder.h186
-rw-r--r--include/clang/Checker/PathSensitive/SVals.h14
-rw-r--r--include/clang/Checker/PathSensitive/Store.h15
-rw-r--r--include/clang/Checker/PathSensitive/ValueManager.h216
-rw-r--r--lib/Checker/BasicObjCFoundationChecks.cpp7
-rw-r--r--lib/Checker/BasicStore.cpp28
-rw-r--r--lib/Checker/BuiltinFunctionChecker.cpp10
-rw-r--r--lib/Checker/CFRefCount.cpp22
-rw-r--r--lib/Checker/CMakeLists.txt1
-rw-r--r--lib/Checker/CStringChecker.cpp275
-rw-r--r--lib/Checker/CallAndMessageChecker.cpp16
-rw-r--r--lib/Checker/CastSizeChecker.cpp27
-rw-r--r--lib/Checker/Environment.cpp35
-rw-r--r--lib/Checker/FlatStore.cpp4
-rw-r--r--lib/Checker/GRCXXExprEngine.cpp16
-rw-r--r--lib/Checker/GRExprEngine.cpp63
-rw-r--r--lib/Checker/GRState.cpp29
-rw-r--r--lib/Checker/MallocChecker.cpp82
-rw-r--r--lib/Checker/MemRegion.cpp28
-rw-r--r--lib/Checker/OSAtomicChecker.cpp4
-rw-r--r--lib/Checker/RegionStore.cpp91
-rw-r--r--lib/Checker/SValBuilder.cpp154
-rw-r--r--lib/Checker/SVals.cpp13
-rw-r--r--lib/Checker/SimpleSValBuilder.cpp150
-rw-r--r--lib/Checker/Store.cpp22
-rw-r--r--lib/Checker/StreamChecker.cpp6
-rw-r--r--lib/Checker/UndefCapturedBlockVarChecker.cpp2
-rw-r--r--lib/Checker/UnixAPIChecker.cpp2
-rw-r--r--lib/Checker/VLASizeChecker.cpp20
-rw-r--r--lib/Checker/ValueManager.cpp162
36 files changed, 827 insertions, 947 deletions
diff --git a/include/clang/Checker/BugReporter/BugReporter.h b/include/clang/Checker/BugReporter/BugReporter.h
index 89075c6537..461472478a 100644
--- a/include/clang/Checker/BugReporter/BugReporter.h
+++ b/include/clang/Checker/BugReporter/BugReporter.h
@@ -426,8 +426,8 @@ public:
return BR.getStateManager();
}
- ValueManager& getValueManager() {
- return getStateManager().getValueManager();
+ SValBuilder& getSValBuilder() {
+ return getStateManager().getSValBuilder();
}
ASTContext& getASTContext() {
diff --git a/include/clang/Checker/PathSensitive/Checker.h b/include/clang/Checker/PathSensitive/Checker.h
index 73ce782b2d..6077ed78e2 100644
--- a/include/clang/Checker/PathSensitive/Checker.h
+++ b/include/clang/Checker/PathSensitive/Checker.h
@@ -87,10 +87,6 @@ public:
return getBugReporter().getSourceManager();
}
- ValueManager &getValueManager() {
- return Eng.getValueManager();
- }
-
SValBuilder &getSValBuilder() {
return Eng.getSValBuilder();
}
diff --git a/include/clang/Checker/PathSensitive/Environment.h b/include/clang/Checker/PathSensitive/Environment.h
index 6340cbcdfc..dd030fe051 100644
--- a/include/clang/Checker/PathSensitive/Environment.h
+++ b/include/clang/Checker/PathSensitive/Environment.h
@@ -14,17 +14,14 @@
#ifndef LLVM_CLANG_ANALYSIS_ENVIRONMENT_H
#define LLVM_CLANG_ANALYSIS_ENVIRONMENT_H
-// For using typedefs in StoreManager. Should find a better place for these
-// typedefs.
#include "clang/Checker/PathSensitive/Store.h"
-
#include "clang/Checker/PathSensitive/SVals.h"
#include "llvm/ADT/ImmutableMap.h"
namespace clang {
class EnvironmentManager;
-class ValueManager;
+class SValBuilder;
class LiveVariables;
/// Environment - An immutable map from Stmts to their current
@@ -55,12 +52,12 @@ public:
/// GetSVal - Fetches the current binding of the expression in the
/// Environment.
- SVal GetSVal(const Stmt* Ex, ValueManager& ValMgr) const;
+ SVal getSVal(const Stmt* Ex, SValBuilder& svalBuilder) const;
/// Profile - Profile the contents of an Environment object for use
/// in a FoldingSet.
- static void Profile(llvm::FoldingSetNodeID& ID, const Environment* E) {
- E->ExprBindings.Profile(ID);
+ static void Profile(llvm::FoldingSetNodeID& ID, const Environment* env) {
+ env->ExprBindings.Profile(ID);
}
/// Profile - Used to profile the contents of this object for inclusion
diff --git a/include/clang/Checker/PathSensitive/GRExprEngine.h b/include/clang/Checker/PathSensitive/GRExprEngine.h
index 08fdd06e33..2a0298f963 100644
--- a/include/clang/Checker/PathSensitive/GRExprEngine.h
+++ b/include/clang/Checker/PathSensitive/GRExprEngine.h
@@ -50,9 +50,6 @@ class GRExprEngine : public GRSubEngine {
/// SymMgr - Object that manages the symbol information.
SymbolManager& SymMgr;
- /// ValMgr - Object that manages/creates SVals.
- ValueManager &ValMgr;
-
/// svalBuilder - SValBuilder object that creates SVals from expressions.
SValBuilder &svalBuilder;
@@ -246,7 +243,7 @@ public:
return StateMgr.getConstraintManager();
}
- // FIXME: Remove when we migrate over to just using ValueManager.
+ // FIXME: Remove when we migrate over to just using SValBuilder.
BasicValueFactory& getBasicVals() {
return StateMgr.getBasicVals();
}
@@ -254,9 +251,6 @@ public:
return StateMgr.getBasicVals();
}
- ValueManager &getValueManager() { return ValMgr; }
- const ValueManager &getValueManager() const { return ValMgr; }
-
// FIXME: Remove when we migrate over to just using ValueManager.
SymbolManager& getSymbolManager() { return SymMgr; }
const SymbolManager& getSymbolManager() const { return SymMgr; }
diff --git a/include/clang/Checker/PathSensitive/GRState.h b/include/clang/Checker/PathSensitive/GRState.h
index c59842f88d..e38f43ea63 100644
--- a/include/clang/Checker/PathSensitive/GRState.h
+++ b/include/clang/Checker/PathSensitive/GRState.h
@@ -17,7 +17,7 @@
#include "clang/Checker/PathSensitive/ConstraintManager.h"
#include "clang/Checker/PathSensitive/Environment.h"
#include "clang/Checker/PathSensitive/Store.h"
-#include "clang/Checker/PathSensitive/ValueManager.h"
+#include "clang/Checker/PathSensitive/SValBuilder.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/ImmutableMap.h"
#include "llvm/Support/Casting.h"
@@ -426,8 +426,8 @@ private:
/// a particular function. This is used to unique states.
llvm::FoldingSet<GRState> StateSet;
- /// ValueMgr - Object that manages the data for all created SVals.
- ValueManager ValueMgr;
+ /// Object that manages the data for all created SVals.
+ llvm::OwningPtr<SValBuilder> svalBuilder;
/// Alloc - A BumpPtrAllocator to allocate states.
llvm::BumpPtrAllocator &Alloc;
@@ -441,7 +441,7 @@ public:
: Eng(subeng),
EnvMgr(alloc),
GDMFactory(alloc),
- ValueMgr(alloc, Ctx, *this),
+ svalBuilder(createSimpleSValBuilder(alloc, Ctx, *this)),
Alloc(alloc) {
StoreMgr.reset((*CreateStoreManager)(*this));
ConstraintMgr.reset((*CreateConstraintManager)(*this, subeng));
@@ -451,33 +451,34 @@ public:
const GRState *getInitialState(const LocationContext *InitLoc);
- ASTContext &getContext() { return ValueMgr.getContext(); }
- const ASTContext &getContext() const { return ValueMgr.getContext(); }
+ ASTContext &getContext() { return svalBuilder->getContext(); }
+ const ASTContext &getContext() const { return svalBuilder->getContext(); }
BasicValueFactory &getBasicVals() {
- return ValueMgr.getBasicValueFactory();
+ return svalBuilder->getBasicValueFactory();
}
const BasicValueFactory& getBasicVals() const {
- return ValueMgr.getBasicValueFactory();
+ return svalBuilder->getBasicValueFactory();
+ }
+
+ SValBuilder &getSValBuilder() {
+ return *svalBuilder;
}
SymbolManager &getSymbolManager() {
- return ValueMgr.getSymbolManager();
+ return svalBuilder->getSymbolManager();
}
const SymbolManager &getSymbolManager() const {
- return ValueMgr.getSymbolManager();
+ return svalBuilder->getSymbolManager();
}
- ValueManager &getValueManager() { return ValueMgr; }
- const ValueManager &getValueManager() const { return ValueMgr; }
-
llvm::BumpPtrAllocator& getAllocator() { return Alloc; }
MemRegionManager& getRegionManager() {
- return ValueMgr.getRegionManager();
+ return svalBuilder->getRegionManager();
}
const MemRegionManager& getRegionManager() const {
- return ValueMgr.getRegionManager();
+ return svalBuilder->getRegionManager();
}
StoreManager& getStoreManager() { return *StoreMgr; }
@@ -658,7 +659,7 @@ inline const llvm::APSInt *GRState::getSymVal(SymbolRef sym) const {
}
inline SVal GRState::getSVal(const Stmt* Ex) const {
- return Env.GetSVal(Ex, getStateManager().ValueMgr);
+ return Env.getSVal(Ex, *getStateManager().svalBuilder);
}
inline SVal GRState::getSValAsScalarOrLoc(const Stmt *S) const {
diff --git a/include/clang/Checker/PathSensitive/MemRegion.h b/include/clang/Checker/PathSensitive/MemRegion.h
index f5e503a07b..fb0ed27c14 100644
--- a/include/clang/Checker/PathSensitive/MemRegion.h
+++ b/include/clang/Checker/PathSensitive/MemRegion.h
@@ -35,7 +35,7 @@ class MemRegionManager;
class MemSpaceRegion;
class LocationContext;
class StackFrameContext;
-class ValueManager;
+class SValBuilder;
class VarRegion;
class CodeTextRegion;
@@ -295,7 +295,7 @@ public:
}
/// getExtent - Returns the size of the region in bytes.
- virtual DefinedOrUnknownSVal getExtent(ValueManager& ValMgr) const {
+ virtual DefinedOrUnknownSVal getExtent(SValBuilder &svalBuilder) const {
return UnknownVal();
}
@@ -330,7 +330,7 @@ public:
bool isBoundable() const { return true; }
- DefinedOrUnknownSVal getExtent(ValueManager& ValMgr) const;
+ DefinedOrUnknownSVal getExtent(SValBuilder &svalBuilder) const;
void Profile(llvm::FoldingSetNodeID& ID) const;
@@ -543,7 +543,7 @@ public:
bool isBoundable() const { return true; }
- DefinedOrUnknownSVal getExtent(ValueManager& ValMgr) const;
+ DefinedOrUnknownSVal getExtent(SValBuilder &svalBuilder) const;
void Profile(llvm::FoldingSetNodeID& ID) const;
@@ -579,7 +579,7 @@ public:
return Str->getType();
}
- DefinedOrUnknownSVal getExtent(ValueManager& ValMgr) const;
+ DefinedOrUnknownSVal getExtent(SValBuilder &svalBuilder) const;
bool isBoundable() const { return false; }
@@ -640,7 +640,7 @@ public:
const Decl* getDecl() const { return D; }
void Profile(llvm::FoldingSetNodeID& ID) const;
- DefinedOrUnknownSVal getExtent(ValueManager& ValMgr) const;
+ DefinedOrUnknownSVal getExtent(SValBuilder &svalBuilder) const;
static bool classof(const MemRegion* R) {
unsigned k = R->getKind();
@@ -726,7 +726,7 @@ public:
return getDecl()->getType();
}
- DefinedOrUnknownSVal getExtent(ValueManager& ValMgr) const;
+ DefinedOrUnknownSVal getExtent(SValBuilder &svalBuilder) const;
static void ProfileRegion(llvm::FoldingSetNodeID& ID, const FieldDecl* FD,
const MemRegion* superRegion) {
diff --git a/include/clang/Checker/PathSensitive/SValBuilder.h b/include/clang/Checker/PathSensitive/SValBuilder.h
index 09ce4a472c..b1776e0a87 100644
--- a/include/clang/Checker/PathSensitive/SValBuilder.h
+++ b/include/clang/Checker/PathSensitive/SValBuilder.h
@@ -16,17 +16,35 @@
#define LLVM_CLANG_ANALYSIS_SVALBUILDER
#include "clang/AST/Expr.h"
+#include "clang/AST/ExprCXX.h"
#include "clang/Checker/PathSensitive/SVals.h"
+#include "clang/Checker/PathSensitive/BasicValueFactory.h"
+#include "clang/Checker/PathSensitive/MemRegion.h"
namespace clang {
class GRState;
-class ValueManager;
class SValBuilder {
- friend class ValueManager;
protected:
- ValueManager &ValMgr;
+ ASTContext &Context;
+
+ /// Manager of APSInt values.
+ BasicValueFactory BasicVals;
+
+ /// Manages the creation of symbols.
+ SymbolManager SymMgr;
+
+ /// Manages the creation of memory regions.
+ MemRegionManager MemMgr;
+
+ GRStateManager &StateMgr;
+
+ /// The scalar type to use for array indices.
+ const QualType ArrayIndexTy;
+
+ /// The width of the scalar type used for array indices.
+ const unsigned ArrayIndexWidth;
public:
// FIXME: Make these protected again one RegionStoreManager correctly
@@ -35,7 +53,15 @@ public:
virtual SVal evalCastL(Loc val, QualType castTy) = 0;
public:
- SValBuilder(ValueManager &valMgr) : ValMgr(valMgr) {}
+ SValBuilder(llvm::BumpPtrAllocator &alloc, ASTContext &context,
+ GRStateManager &stateMgr)
+ : Context(context), BasicVals(context, alloc),
+ SymMgr(context, BasicVals, alloc),
+ MemMgr(context, alloc),
+ StateMgr(stateMgr),
+ ArrayIndexTy(context.IntTy),
+ ArrayIndexWidth(context.getTypeSize(ArrayIndexTy)) {}
+
virtual ~SValBuilder() {}
SVal evalCast(SVal V, QualType castTy, QualType originalType);
@@ -62,9 +88,159 @@ public:
DefinedOrUnknownSVal evalEQ(const GRState *ST, DefinedOrUnknownSVal L,
DefinedOrUnknownSVal R);
+
+ ASTContext &getContext() { return Context; }
+ const ASTContext &getContext() const { return Context; }
+
+ GRStateManager &getStateManager() { return StateMgr; }
+
+ BasicValueFactory &getBasicValueFactory() { return BasicVals; }
+ const BasicValueFactory &getBasicValueFactory() const { return BasicVals; }
+
+ SymbolManager &getSymbolManager() { return SymMgr; }
+ const SymbolManager &getSymbolManager() const { return SymMgr; }
+
+ MemRegionManager &getRegionManager() { return MemMgr; }
+ const MemRegionManager &getRegionManager() const { return MemMgr; }
+
+ // Forwarding methods to SymbolManager.
+
+ const SymbolConjured* getConjuredSymbol(const Stmt* E, QualType T,
+ unsigned VisitCount,
+ const void* SymbolTag = 0) {
+ return SymMgr.getConjuredSymbol(E, T, VisitCount, SymbolTag);
+ }
+
+ const SymbolConjured* getConjuredSymbol(const Expr* E, unsigned VisitCount,
+ const void* SymbolTag = 0) {
+ return SymMgr.getConjuredSymbol(E, VisitCount, SymbolTag);
+ }
+
+ /// makeZeroVal - Construct an SVal representing '0' for the specified type.
+ DefinedOrUnknownSVal makeZeroVal(QualType T);
+
+ /// getRegionValueSymbolVal - make a unique symbol for value of R.
+ DefinedOrUnknownSVal getRegionValueSymbolVal(const TypedRegion *R);
+
+ DefinedOrUnknownSVal getConjuredSymbolVal(const void *SymbolTag,
+ const Expr *E, unsigned Count);
+ DefinedOrUnknownSVal getConjuredSymbolVal(const void *SymbolTag,
+ const Expr *E, QualType T,
+ unsigned Count);
+
+ DefinedOrUnknownSVal getDerivedRegionValueSymbolVal(SymbolRef parentSymbol,
+ const TypedRegion *R);
+
+ DefinedSVal getMetadataSymbolVal(const void *SymbolTag, const MemRegion *MR,
+ const Expr *E, QualType T, unsigned Count);
+
+ DefinedSVal getFunctionPointer(const FunctionDecl *FD);
+
+ DefinedSVal getBlockPointer(const BlockDecl *BD, CanQualType locTy,
+ const LocationContext *LC);
+
+ NonLoc makeCompoundVal(QualType T, llvm::ImmutableList<SVal> Vals) {
+ return nonloc::CompoundVal(BasicVals.getCompoundValData(T, Vals));
+ }
+
+ NonLoc makeLazyCompoundVal(const void *store, const TypedRegion *R) {
+ return nonloc::LazyCompoundVal(BasicVals.getLazyCompoundValData(store, R));
+ }
+
+ NonLoc makeZeroArrayIndex() {
+ return nonloc::ConcreteInt(BasicVals.getValue(0, ArrayIndexTy));
+ }
+
+ NonLoc makeArrayIndex(uint64_t idx) {
+ return nonloc::ConcreteInt(BasicVals.getValue(idx, ArrayIndexTy));
+ }
+
+ SVal convertToArrayIndex(SVal V);
+
+ nonloc::ConcreteInt makeIntVal(const IntegerLiteral* I) {
+ return nonloc::ConcreteInt(BasicVals.getValue(I->getValue(),
+ I->getType()->isUnsignedIntegerType()));
+ }
+
+ nonloc::ConcreteInt makeIntVal(const CXXBoolLiteralExpr *E) {
+ return E->getValue() ? nonloc::ConcreteInt(BasicVals.getValue(1, 1, true))
+ : nonloc::ConcreteInt(BasicVals.getValue(0, 1, true));
+ }
+
+ nonloc::ConcreteInt makeIntVal(const llvm::APSInt& V) {
+ return nonloc::ConcreteInt(BasicVals.getValue(V));
+ }
+
+ loc::ConcreteInt makeIntLocVal(const llvm::APSInt &v) {
+ return loc::ConcreteInt(BasicVals.getValue(v));
+ }
+
+ NonLoc makeIntVal(const llvm::APInt& V, bool isUnsigned) {
+ return nonloc::ConcreteInt(BasicVals.getValue(V, isUnsigned));
+ }
+
+ DefinedSVal makeIntVal(uint64_t X, QualType T) {
+ if (Loc::IsLocType(T))
+ return loc::ConcreteInt(BasicVals.getValue(X, T));
+
+ return nonloc::ConcreteInt(BasicVals.getValue(X, T));
+ }
+
+ NonLoc makeIntVal(uint64_t X, bool isUnsigned) {
+ return nonloc::ConcreteInt(BasicVals.getIntValue(X, isUnsigned));
+ }
+
+ NonLoc makeIntValWithPtrWidth(uint64_t X, bool isUnsigned) {
+ return nonloc::ConcreteInt(BasicVals.getIntWithPtrWidth(X, isUnsigned));
+ }
+
+ NonLoc makeIntVal(uint64_t X, unsigned BitWidth, bool isUnsigned) {
+ return nonloc::ConcreteInt(BasicVals.getValue(X, BitWidth, isUnsigned));
+ }
+
+ NonLoc makeLocAsInteger(Loc V, unsigned Bits) {
+ return nonloc::LocAsInteger(BasicVals.getPersistentSValWithData(V, Bits));
+ }
+
+ NonLoc makeNonLoc(const SymExpr *lhs, BinaryOperator::Opcode op,
+ const llvm::APSInt& rhs, QualType T);
+
+ NonLoc makeNonLoc(const SymExpr *lhs, BinaryOperator::Opcode op,
+ const SymExpr *rhs, QualType T);
+
+ NonLoc makeTruthVal(bool b, QualType T) {
+ return nonloc::ConcreteInt(BasicVals.getTruthValue(b, T));
+ }
+
+ NonLoc makeTruthVal(bool b) {
+ return nonloc::ConcreteInt(BasicVals.getTruthValue(b));
+ }
+
+ Loc makeNull() {
+ return loc::ConcreteInt(BasicVals.getZeroWithPtrWidth());
+ }
+
+ Loc makeLoc(SymbolRef Sym) {
+ return loc::MemRegionVal(MemMgr.getSymbolicRegion(Sym));
+ }
+
+ Loc makeLoc(const MemRegion* R) {
+ return loc::MemRegionVal(R);
+ }
+
+ Loc makeLoc(const AddrLabelExpr* E) {
+ return loc::GotoLabel(E->getLabel());
+ }
+
+ Loc makeLoc(const llvm::APSInt& V) {
+ return loc::ConcreteInt(BasicVals.getValue(V));
+ }
+
};
-SValBuilder* createSimpleSValBuilder(ValueManager &valMgr);
+SValBuilder* createSimpleSValBuilder(llvm::BumpPtrAllocator &alloc,
+ ASTContext &context,
+ GRStateManager &stateMgr);
} // end clang namespace
#endif
diff --git a/include/clang/Checker/PathSensitive/SVals.h b/include/clang/Checker/PathSensitive/SVals.h
index 385814a948..77a62a971f 100644
--- a/include/clang/Checker/PathSensitive/SVals.h
+++ b/include/clang/Checker/PathSensitive/SVals.h
@@ -37,7 +37,7 @@ class MemRegion;
class TypedRegion;
class MemRegionManager;
class GRStateManager;
-class ValueManager;
+class SValBuilder;
/// SVal - This represents a symbolic expression, which can be either
/// an L-value or an R-value.
@@ -321,12 +321,12 @@ public:
}
// Transfer functions for binary/unary operations on ConcreteInts.
- SVal evalBinOp(ValueManager &ValMgr, BinaryOperator::Opcode Op,
+ SVal evalBinOp(SValBuilder &svalBuilder, BinaryOperator::Opcode Op,
const ConcreteInt& R) const;
- ConcreteInt evalComplement(ValueManager &ValMgr) const;
+ ConcreteInt evalComplement(SValBuilder &svalBuilder) const;
- ConcreteInt evalMinus(ValueManager &ValMgr) const;
+ ConcreteInt evalMinus(SValBuilder &svalBuilder) const;
// Implement isa<T> support.
static inline bool classof(const SVal* V) {
@@ -340,7 +340,7 @@ public:
};
class LocAsInteger : public NonLoc {
- friend class clang::ValueManager;
+ friend class clang::SValBuilder;
LocAsInteger(const std::pair<SVal, uintptr_t>& data) :
NonLoc(LocAsIntegerKind, &data) {
@@ -374,7 +374,7 @@ public:
};
class CompoundVal : public NonLoc {
- friend class clang::ValueManager;
+ friend class clang::SValBuilder;
CompoundVal(const CompoundValData* D) : NonLoc(CompoundValKind, D) {}
@@ -397,7 +397,7 @@ public:
};
class LazyCompoundVal : public NonLoc {
- friend class clang::ValueManager;
+ friend class clang::SValBuilder;
LazyCompoundVal(const LazyCompoundValData *D)
: NonLoc(LazyCompoundValKind, D) {}
diff --git a/include/clang/Checker/PathSensitive/Store.h b/include/clang/Checker/PathSensitive/Store.h
index c2e5436adb..67b90b3e1e 100644
--- a/include/clang/Checker/PathSensitive/Store.h
+++ b/include/clang/Checker/PathSensitive/Store.h
@@ -15,8 +15,7 @@
#define LLVM_CLANG_ANALYSIS_STORE_H
#include "clang/Checker/PathSensitive/MemRegion.h"
-#include "clang/Checker/PathSensitive/SVals.h"
-#include "clang/Checker/PathSensitive/ValueManager.h"
+#include "clang/Checker/PathSensitive/SValBuilder.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/Optional.h"
@@ -38,7 +37,7 @@ class StackFrameContext;
class StoreManager {
protected:
- ValueManager &ValMgr;
+ SValBuilder &svalBuilder;
GRStateManager &StateMgr;
/// MRMgr - Manages region objects associated with this StoreManager.
@@ -96,11 +95,11 @@ public:
virtual SubRegionMap *getSubRegionMap(Store store) = 0;
virtual Loc getLValueVar(const VarDecl *VD, const LocationContext *LC) {
- return ValMgr.makeLoc(MRMgr.getVarRegion(VD, LC));
+ return svalBuilder.makeLoc(MRMgr.getVarRegion(VD, LC));
}
virtual Loc getLValueString(const StringLiteral* S) {
- return ValMgr.makeLoc(MRMgr.getStringRegion(S));
+ return svalBuilder.makeLoc(MRMgr.getStringRegion(S));
}
Loc getLValueCompoundLiteral(const CompoundLiteralExpr* CL,
@@ -215,17 +214,17 @@ public:
virtual void iterBindings(Store store, BindingsHandler& f) = 0;
protected:
- const MemRegion *MakeElementRegion(const MemRegion *Base,
+ const MemRegion *MakeElementRegion(const MemRegion *baseRegion,
QualType pointeeTy, uint64_t index = 0);
/// CastRetrievedVal - Used by subclasses of StoreManager to implement
/// implicit casts that arise from loads from regions that are reinterpreted
/// as another region.
- SVal CastRetrievedVal(SVal val, const TypedRegion *R, QualType castTy,
+ SVal CastRetrievedVal(SVal val, const TypedRegion *region, QualType castTy,
bool performTestOnly = true);
private:
- SVal getLValueFieldOrIvar(const Decl* D, SVal Base);
+ SVal getLValueFieldOrIvar(const Decl* decl, SVal base);
};
// FIXME: Do we still need this?
diff --git a/include/clang/Checker/PathSensitive/ValueManager.h b/include/clang/Checker/PathSensitive/ValueManager.h
deleted file mode 100644
index 98b4f21f31..0000000000
--- a/include/clang/Checker/PathSensitive/ValueManager.h
+++ /dev/null
@@ -1,216 +0,0 @@
-//== ValueManager.h - Aggregate manager of symbols and SVals ----*- C++ -*--==//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines ValueManager, a class that manages symbolic values
-// and SVals created for use by GRExprEngine and related classes. It
-// wraps and owns SymbolManager, MemRegionManager, and BasicValueFactory.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_ANALYSIS_AGGREGATE_VALUE_MANAGER_H
-#define LLVM_CLANG_ANALYSIS_AGGREGATE_VALUE_MANAGER_H
-
-#include "llvm/ADT/OwningPtr.h"
-#include "clang/Checker/PathSensitive/MemRegion.h"
-#include "clang/Checker/PathSensitive/SVals.h"
-#include "clang/Checker/PathSensitive/BasicValueFactory.h"
-#include "clang/Checker/PathSensitive/SymbolManager.h"
-#include "clang/Checker/PathSensitive/SValBuilder.h"
-#include "clang/AST/ExprCXX.h"
-
-namespace llvm { class BumpPtrAllocator; }
-
-namespace clang {
-
-class GRStateManager;
-
-class ValueManager {
-
- ASTContext &Context;
- BasicValueFactory BasicVals;
-
- /// SymMgr - Object that manages the symbol information.
- SymbolManager SymMgr;
-
- /// svalBuilder - SValBuilder object that creates SVals from expressions.
- llvm::OwningPtr<SValBuilder> svalBuilder;
-
- MemRegionManager MemMgr;
-
- GRStateManager &StateMgr;
-
- const QualType ArrayIndexTy;
- const unsigned ArrayIndexWidth;
-
-public:
- ValueManager(llvm::BumpPtrAllocator &alloc, ASTContext &context,
- GRStateManager &stateMgr)
- : Context(context), BasicVals(context, alloc),
- SymMgr(context, BasicVals, alloc),
- MemMgr(context, alloc), StateMgr(stateMgr),
- ArrayIndexTy(context.IntTy),
- ArrayIndexWidth(context.getTypeSize(ArrayIndexTy)) {
- // FIXME: Generalize later.
- svalBuilder.reset(clang::createSimpleSValBuilder(*this));
- }
-
- // Accessors to submanagers.
-
- ASTContext &getContext() { return Context; }
- const ASTContext &getContext() const { return Context; }
-
- GRStateManager &getStateManager() { return StateMgr; }
-
- BasicValueFactory &getBasicValueFactory() { return BasicVals; }
- const BasicValueFactory &getBasicValueFactory() const { return BasicVals; }
-
- SymbolManager &getSymbolManager() { return SymMgr; }
- const SymbolManager &getSymbolManager() const { return SymMgr; }
-
- SValBuilder &getSValBuilder() { return *svalBuilder.get(); }
-
- MemRegionManager &getRegionManager() { return MemMgr; }
- const MemRegionManager &getRegionManager() const { return MemMgr; }
-
- // Forwarding methods to SymbolManager.
-
- const SymbolConjured* getConjuredSymbol(const Stmt* E, QualType T,
- unsigned VisitCount,
- const void* SymbolTag = 0) {
- return SymMgr.getConjuredSymbol(E, T, VisitCount, SymbolTag);
- }
-
- const SymbolConjured* getConjuredSymbol(const Expr* E, unsigned VisitCount,
- const void* SymbolTag = 0) {
- return SymMgr.getConjuredSymbol(E, VisitCount, SymbolTag);
- }
-
- /// makeZeroVal - Construct an SVal representing '0' for the specified type.
- DefinedOrUnknownSVal makeZeroVal(QualType T);
-
- /// getRegionValueSymbolVal - make a unique symbol for value of R.
- DefinedOrUnknownSVal getRegionValueSymbolVal(const TypedRegion *R);
-
- DefinedOrUnknownSVal getConjuredSymbolVal(const void *SymbolTag,
- const Expr *E, unsigned Count);
- DefinedOrUnknownSVal getConjuredSymbolVal(const void *SymbolTag,
- const Expr *E, QualType T,
- unsigned Count);
-
- DefinedOrUnknownSVal getDerivedRegionValueSymbolVal(SymbolRef parentSymbol,
- const TypedRegion *R);
-
- DefinedSVal getMetadataSymbolVal(const void *SymbolTag, const MemRegion *MR,
- const Expr *E, QualType T, unsigned Count);
-
- DefinedSVal getFunctionPointer(const FunctionDecl *FD);
-
- DefinedSVal getBlockPointer(const BlockDecl *BD, CanQualType locTy,
- const LocationContext *LC);
-
- NonLoc makeCompoundVal(QualType T, llvm::Immu