summaryrefslogtreecommitdiffstats
path: root/include/clang/Analysis
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/Analysis')
-rw-r--r--include/clang/Analysis/PathSensitive/Environment.h6
-rw-r--r--include/clang/Analysis/PathSensitive/GRExprEngine.h5
-rw-r--r--include/clang/Analysis/PathSensitive/GRState.h6
-rw-r--r--include/clang/Analysis/PathSensitive/MemRegion.h226
-rw-r--r--include/clang/Analysis/PathSensitive/SVals.h35
-rw-r--r--include/clang/Analysis/PathSensitive/ValueManager.h82
6 files changed, 269 insertions, 91 deletions
diff --git a/include/clang/Analysis/PathSensitive/Environment.h b/include/clang/Analysis/PathSensitive/Environment.h
index 0fc49f5..6f8a126 100644
--- a/include/clang/Analysis/PathSensitive/Environment.h
+++ b/include/clang/Analysis/PathSensitive/Environment.h
@@ -27,7 +27,7 @@
namespace clang {
class EnvironmentManager;
-class BasicValueFactory;
+class ValueManager;
class LiveVariables;
class Environment {
@@ -71,8 +71,8 @@ public:
return X ? *X : UnknownVal();
}
- SVal GetSVal(const Stmt* Ex, BasicValueFactory& BasicVals) const;
- SVal GetBlkExprSVal(const Stmt* Ex, BasicValueFactory& BasicVals) const;
+ SVal GetSVal(const Stmt* Ex, ValueManager& ValMgr) const;
+ SVal GetBlkExprSVal(const Stmt* Ex, ValueManager& ValMgr) const;
/// Profile - Profile the contents of an Environment object for use
/// in a FoldingSet.
diff --git a/include/clang/Analysis/PathSensitive/GRExprEngine.h b/include/clang/Analysis/PathSensitive/GRExprEngine.h
index 4af8a7c..5db666c 100644
--- a/include/clang/Analysis/PathSensitive/GRExprEngine.h
+++ b/include/clang/Analysis/PathSensitive/GRExprEngine.h
@@ -481,11 +481,6 @@ protected:
return N == EntryNode ? CleanedState : N->getState();
}
-public:
- inline NonLoc MakeConstantVal(uint64_t X, Expr* Ex) {
- return NonLoc::MakeVal(getBasicVals(), X, Ex->getType());
- }
-
public:
NodeTy* MakeNode(NodeSet& Dst, Stmt* S, NodeTy* Pred, const GRState* St,
ProgramPoint::Kind K = ProgramPoint::PostStmtKind,
diff --git a/include/clang/Analysis/PathSensitive/GRState.h b/include/clang/Analysis/PathSensitive/GRState.h
index 6f95c6f..2cb3f94 100644
--- a/include/clang/Analysis/PathSensitive/GRState.h
+++ b/include/clang/Analysis/PathSensitive/GRState.h
@@ -532,7 +532,7 @@ private:
// Methods that query & manipulate the Environment.
SVal GetSVal(const GRState* St, const Stmt* Ex) {
- return St->getEnvironment().GetSVal(Ex, getBasicVals());
+ return St->getEnvironment().GetSVal(Ex, ValueMgr);
}
SVal GetSValAsScalarOrLoc(const GRState* state, const Stmt *S) {
@@ -546,7 +546,7 @@ private:
}
SVal GetBlkExprSVal(const GRState* St, const Stmt* Ex) {
- return St->getEnvironment().GetBlkExprSVal(Ex, getBasicVals());
+ return St->getEnvironment().GetBlkExprSVal(Ex, ValueMgr);
}
const GRState* BindExpr(const GRState* St, const Stmt* Ex, SVal V,
@@ -613,7 +613,7 @@ public:
// We only want to do fetches from regions that we can actually bind
// values. For example, SymbolicRegions of type 'id<...>' cannot
// have direct bindings (but their can be bindings on their subregions).
- if (!R->isBoundable(getContext()))
+ if (!R->isBoundable())
return UnknownVal();
if (const TypedRegion *TR = dyn_cast<TypedRegion>(R)) {
diff --git a/include/clang/Analysis/PathSensitive/MemRegion.h b/include/clang/Analysis/PathSensitive/MemRegion.h
index 8afcc4c..ac158dc 100644
--- a/include/clang/Analysis/PathSensitive/MemRegion.h
+++ b/include/clang/Analysis/PathSensitive/MemRegion.h
@@ -59,11 +59,14 @@ private:
protected:
MemRegion(Kind k) : kind(k) {}
virtual ~MemRegion();
+ ASTContext &getContext() const;
public:
// virtual MemExtent getExtent(MemRegionManager& mrm) const = 0;
virtual void Profile(llvm::FoldingSetNodeID& ID) const = 0;
-
+
+ virtual MemRegionManager* getMemRegionManager() const = 0;
+
std::string getString() const;
virtual void print(llvm::raw_ostream& os) const;
@@ -72,7 +75,7 @@ public:
template<typename RegionTy> const RegionTy* getAs() const;
- virtual bool isBoundable(ASTContext&) const { return true; }
+ virtual bool isBoundable() const { return true; }
static bool classof(const MemRegion*) { return true; }
};
@@ -81,14 +84,23 @@ public:
/// for example, the set of global variables, the stack frame, etc.
class MemSpaceRegion : public MemRegion {
friend class MemRegionManager;
- MemSpaceRegion() : MemRegion(MemSpaceRegionKind) {}
+
+protected:
+ MemRegionManager *Mgr;
+
+ MemSpaceRegion(MemRegionManager *mgr) : MemRegion(MemSpaceRegionKind),
+ Mgr(mgr) {}
+ MemRegionManager* getMemRegionManager() const {
+ return Mgr;
+ }
+
public:
//RegionExtent getExtent() const { return UndefinedExtent(); }
void Profile(llvm::FoldingSetNodeID& ID) const;
- bool isBoundable(ASTContext &) const { return false; }
+ bool isBoundable() const { return false; }
static bool classof(const MemRegion* R) {
return R->getKind() == MemSpaceRegionKind;
@@ -101,11 +113,12 @@ class SubRegion : public MemRegion {
protected:
const MemRegion* superRegion;
SubRegion(const MemRegion* sReg, Kind k) : MemRegion(k), superRegion(sReg) {}
-
public:
const MemRegion* getSuperRegion() const {
return superRegion;
}
+
+ MemRegionManager* getMemRegionManager() const;
bool isSubRegionOf(const MemRegion* R) const;
@@ -123,7 +136,7 @@ protected:
// memory allocated by alloca at the same call site.
const Expr* Ex;
- AllocaRegion(const Expr* ex, unsigned cnt, const MemRegion* superRegion)
+ AllocaRegion(const Expr* ex, unsigned cnt, const MemRegion *superRegion)
: SubRegion(superRegion, AllocaRegionKind), Cnt(cnt), Ex(ex) {}
public:
@@ -133,7 +146,7 @@ public:
void Profile(llvm::FoldingSetNodeID& ID) const;
static void ProfileRegion(llvm::FoldingSetNodeID& ID, const Expr* Ex,
- unsigned Cnt);
+ unsigned Cnt, const MemRegion *superRegion);
void print(llvm::raw_ostream& os) const;
@@ -164,8 +177,8 @@ public:
return getLocationType(C)->getDesugaredType();
}
- bool isBoundable(ASTContext &C) const {
- return !getValueType(C).isNull();
+ bool isBoundable() const {
+ return !getValueType(getContext()).isNull();
}
static bool classof(const MemRegion* R) {
@@ -229,14 +242,14 @@ public:
return const_cast<SymbolRef>(static_cast<const SymbolRef>(Data));
}
- bool isBoundable(ASTContext&) const { return false; }
+ bool isBoundable() const { return false; }
virtual void print(llvm::raw_ostream& os) const;
void Profile(llvm::FoldingSetNodeID& ID) const;
static void ProfileRegion(llvm::FoldingSetNodeID& ID,
- const void* data, QualType t);
+ const void* data, QualType t, const MemRegion*);
static bool classof(const MemRegion* R) {
return R->getKind() == CodeTextRegionKind;
@@ -262,7 +275,9 @@ public:
void Profile(llvm::FoldingSetNodeID& ID) const;
- static void ProfileRegion(llvm::FoldingSetNodeID& ID, SymbolRef sym);
+ static void ProfileRegion(llvm::FoldingSetNodeID& ID,
+ SymbolRef sym,
+ const MemRegion* superRegion);
void print(llvm::raw_ostream& os) const;
@@ -277,7 +292,7 @@ class StringRegion : public TypedRegion {
const StringLiteral* Str;
protected:
- StringRegion(const StringLiteral* str, MemRegion* sreg)
+ StringRegion(const StringLiteral* str, const MemRegion* sreg)
: TypedRegion(sreg, StringRegionKind), Str(str) {}
static void ProfileRegion(llvm::FoldingSetNodeID& ID,
@@ -327,7 +342,7 @@ public:
return PTy->getPointeeType();
}
- bool isBoundable(ASTContext &C) const {
+ bool isBoundable() const {
return isa<PointerType>(LValueType);
}
@@ -399,8 +414,8 @@ class VarRegion : public DeclRegion {
VarRegion(const VarDecl* vd, const MemRegion* sReg)
: DeclRegion(vd, sReg, VarRegionKind) {}
- static void ProfileRegion(llvm::FoldingSetNodeID& ID, VarDecl* VD,
- const MemRegion* superRegion) {
+ static void ProfileRegion(llvm::FoldingSetNodeID& ID, const VarDecl* VD,
+ const MemRegion* superRegion) {
DeclRegion::ProfileRegion(ID, VD, superRegion, VarRegionKind);
}
@@ -436,8 +451,8 @@ public:
return C.getCanonicalType(getDecl()->getType());
}
- static void ProfileRegion(llvm::FoldingSetNodeID& ID, FieldDecl* FD,
- const MemRegion* superRegion) {
+ static void ProfileRegion(llvm::FoldingSetNodeID& ID, const FieldDecl* FD,
+ const MemRegion* superRegion) {
DeclRegion::ProfileRegion(ID, FD, superRegion, FieldRegionKind);
}
@@ -453,7 +468,8 @@ class ObjCObjectRegion : public DeclRegion {
ObjCObjectRegion(const ObjCInterfaceDecl* ivd, const MemRegion* sReg)
: DeclRegion(ivd, sReg, ObjCObjectRegionKind) {}
- static void ProfileRegion(llvm::FoldingSetNodeID& ID, ObjCInterfaceDecl* ivd,
+ static void ProfileRegion(llvm::FoldingSetNodeID& ID,
+ const ObjCInterfaceDecl* ivd,
const MemRegion* superRegion) {
DeclRegion::ProfileRegion(ID, ivd, superRegion, ObjCObjectRegionKind);
}
@@ -479,8 +495,8 @@ class ObjCIvarRegion : public DeclRegion {
ObjCIvarRegion(const ObjCIvarDecl* ivd, const MemRegion* sReg)
: DeclRegion(ivd, sReg, ObjCIvarRegionKind) {}
- static void ProfileRegion(llvm::FoldingSetNodeID& ID, ObjCIvarDecl* ivd,
- const MemRegion* superRegion) {
+ static void ProfileRegion(llvm::FoldingSetNodeID& ID, const ObjCIvarDecl* ivd,
+ const MemRegion* superRegion) {
DeclRegion::ProfileRegion(ID, ivd, superRegion, ObjCIvarRegionKind);
}
@@ -556,6 +572,7 @@ const RegionTy* MemRegion::getAs() const {
//===----------------------------------------------------------------------===//
class MemRegionManager {
+ ASTContext &C;
llvm::BumpPtrAllocator& A;
llvm::FoldingSet<MemRegion> Regions;
@@ -566,11 +583,13 @@ class MemRegionManager {
MemSpaceRegion* code;
public:
- MemRegionManager(llvm::BumpPtrAllocator& a)
- : A(a), globals(0), stack(0), heap(0), unknown(0), code(0) {}
+ MemRegionManager(ASTContext &c, llvm::BumpPtrAllocator& a)
+ : C(c), A(a), globals(0), stack(0), heap(0), unknown(0), code(0) {}
~MemRegionManager() {}
+ ASTContext &getContext() { return C; }
+
/// getStackRegion - Retrieve the memory region associated with the
/// current stack frame.
MemSpaceRegion* getStackRegion();
@@ -589,17 +608,6 @@ public:
MemSpaceRegion* getCodeRegion();
- bool isGlobalsRegion(const MemRegion* R) {
- assert(R);
- return R == globals;
- }
-
- /// onStack - check if the region is allocated on the stack.
- bool onStack(const MemRegion* R);
-
- /// onHeap - check if the region is allocated on the heap, usually by malloc.
- bool onHeap(const MemRegion* R);
-
/// getAllocaRegion - Retrieve a region associated with a call to alloca().
AllocaRegion* getAllocaRegion(const Expr* Ex, unsigned Cnt);
@@ -646,14 +654,164 @@ public:
CodeTextRegion* getCodeTextRegion(SymbolRef sym, QualType t);
CodeTextRegion* getCodeTextRegion(const FunctionDecl* fd, QualType t);
+
+ template <typename RegionTy, typename A1>
+ RegionTy* getRegion(const A1 a1);
+
+ template <typename RegionTy, typename A1>
+ RegionTy* getRegion(const A1 a1, const MemRegion* superRegion);
+
+ template <typename RegionTy, typename A1, typename A2>
+ RegionTy* getRegion(const A1 a1, const A2 a2);
+
+ bool isGlobalsRegion(const MemRegion* R) {
+ assert(R);
+ return R == globals;
+ }
bool hasStackStorage(const MemRegion* R);
+ bool hasHeapStorage(const MemRegion* R);
+
private:
MemSpaceRegion* LazyAllocate(MemSpaceRegion*& region);
};
+
+//===----------------------------------------------------------------------===//
+// Out-of-line member definitions.
+//===----------------------------------------------------------------------===//
+
+inline ASTContext& MemRegion::getContext() const {
+ return getMemRegionManager()->getContext();
+}
+
+template<typename RegionTy> struct MemRegionManagerTrait;
+
+template <typename RegionTy, typename A1>
+RegionTy* MemRegionManager::getRegion(const A1 a1) {
+
+ const typename MemRegionManagerTrait<RegionTy>::SuperRegionTy *superRegion =
+ MemRegionManagerTrait<RegionTy>::getSuperRegion(*this, a1);
+
+ llvm::FoldingSetNodeID ID;
+ RegionTy::ProfileRegion(ID, a1, superRegion);
+ void* InsertPos;
+ RegionTy* R = cast_or_null<RegionTy>(Regions.FindNodeOrInsertPos(ID,
+ InsertPos));
+
+ if (!R) {
+ R = (RegionTy*) A.Allocate<RegionTy>();
+ new (R) RegionTy(a1, superRegion);
+ Regions.InsertNode(R, InsertPos);
+ }
+
+ return R;
+}
+
+template <typename RegionTy, typename A1>
+RegionTy* MemRegionManager::getRegion(const A1 a1, const MemRegion *superRegion)
+{
+ llvm::FoldingSetNodeID ID;
+ RegionTy::ProfileRegion(ID, a1, superRegion);
+ void* InsertPos;
+ RegionTy* R = cast_or_null<RegionTy>(Regions.FindNodeOrInsertPos(ID,
+ InsertPos));
+
+ if (!R) {
+ R = (RegionTy*) A.Allocate<RegionTy>();
+ new (R) RegionTy(a1, superRegion);
+ Regions.InsertNode(R, InsertPos);
+ }
+
+ return R;
+}
+
+template <typename RegionTy, typename A1, typename A2>
+RegionTy* MemRegionManager::getRegion(const A1 a1, const A2 a2) {
+
+ const typename MemRegionManagerTrait<RegionTy>::SuperRegionTy *superRegion =
+ MemRegionManagerTrait<RegionTy>::getSuperRegion(*this, a1, a2);
+
+ llvm::FoldingSetNodeID ID;
+ RegionTy::ProfileRegion(ID, a1, a2, superRegion);
+ void* InsertPos;
+ RegionTy* R = cast_or_null<RegionTy>(Regions.FindNodeOrInsertPos(ID,
+ InsertPos));
+
+ if (!R) {
+ R = (RegionTy*) A.Allocate<RegionTy>();
+ new (R) RegionTy(a1, a2, superRegion);
+ Regions.InsertNode(R, InsertPos);
+ }
+
+ return R;
+}
+
+//===----------------------------------------------------------------------===//
+// Traits for constructing regions.
+//===----------------------------------------------------------------------===//
+
+template <> struct MemRegionManagerTrait<AllocaRegion> {
+ typedef MemRegion SuperRegionTy;
+ static const SuperRegionTy* getSuperRegion(MemRegionManager& MRMgr,
+ const Expr *, unsigned) {
+ return MRMgr.getStackRegion();
+ }
+};
+
+template <> struct MemRegionManagerTrait<CompoundLiteralRegion> {
+ typedef MemRegion SuperRegionTy;
+ static const SuperRegionTy* getSuperRegion(MemRegionManager& MRMgr,
+ const CompoundLiteralExpr *CL) {
+
+ return CL->isFileScope() ? MRMgr.getGlobalsRegion()
+ : MRMgr.getStackRegion();
+ }
+};
+
+template <> struct MemRegionManagerTrait<StringRegion> {
+ typedef MemSpaceRegion SuperRegionTy;
+ static const SuperRegionTy* getSuperRegion(MemRegionManager& MRMgr,
+ const StringLiteral*) {
+ return MRMgr.getGlobalsRegion();
+ }
+};
+
+template <> struct MemRegionManagerTrait<VarRegion> {
+ typedef MemRegion SuperRegionTy;
+ static const SuperRegionTy* getSuperRegion(MemRegionManager& MRMgr,
+ const VarDecl *d) {
+ return d->hasLocalStorage() ? MRMgr.getStackRegion()
+ : MRMgr.getGlobalsRegion();
+ }
+};
+
+template <> struct MemRegionManagerTrait<SymbolicRegion> {
+ typedef MemRegion SuperRegionTy;
+ static const SuperRegionTy* getSuperRegion(MemRegionManager& MRMgr,
+ SymbolRef) {
+ return MRMgr.getUnknownRegion();
+ }
+};
+
+template<> struct MemRegionManagerTrait<CodeTextRegion> {
+ typedef MemSpaceRegion SuperRegionTy;
+ static const SuperRegionTy* getSuperRegion(MemRegionManager& MRMgr,
+ const FunctionDecl*, QualType) {
+ return MRMgr.getCodeRegion();
+ }
+ static const SuperRegionTy* getSuperRegion(MemRegionManager& MRMgr,
+ SymbolRef, QualType) {
+ return MRMgr.getCodeRegion();
+ }
+};
+
} // end clang namespace
+//===----------------------------------------------------------------------===//
+// Pretty-printing regions.
+//===----------------------------------------------------------------------===//
+
namespace llvm {
static inline raw_ostream& operator<<(raw_ostream& O,
const clang::MemRegion* R) {
diff --git a/include/clang/Analysis/PathSensitive/SVals.h b/include/clang/Analysis/PathSensitive/SVals.h
index c9d1e25..de74dbd 100644
--- a/include/clang/Analysis/PathSensitive/SVals.h
+++ b/include/clang/Analysis/PathSensitive/SVals.h
@@ -30,6 +30,7 @@ class BasicValueFactory;
class MemRegion;
class MemRegionManager;
class GRStateManager;
+class ValueManager;
class SVal {
public:
@@ -171,28 +172,6 @@ protected:
public:
void print(llvm::raw_ostream& Out) const;
- // Utility methods to create NonLocs.
-
- static NonLoc MakeIntVal(BasicValueFactory& BasicVals, uint64_t X,
- bool isUnsigned);
-
- static NonLoc MakeVal(BasicValueFactory& BasicVals, uint64_t X,
- unsigned BitWidth, bool isUnsigned);
-
- static NonLoc MakeVal(BasicValueFactory& BasicVals, uint64_t X, QualType T);
-
- static NonLoc MakeVal(BasicValueFactory& BasicVals, const IntegerLiteral *I);
-
- static NonLoc MakeVal(BasicValueFactory& BasicVals, const llvm::APInt& I,
- bool isUnsigned);
-
- static NonLoc MakeVal(BasicValueFactory& BasicVals, const llvm::APSInt& I);
-
- static NonLoc MakeIntTruthVal(BasicValueFactory& BasicVals, bool b);
-
- static NonLoc MakeCompoundVal(QualType T, llvm::ImmutableList<SVal> Vals,
- BasicValueFactory& BasicVals);
-
// Implement isa<T> support.
static inline bool classof(const SVal* V) {
return V->getBaseKind() == NonLocKind;
@@ -210,12 +189,6 @@ public:
Loc(const Loc& X) : SVal(X.Data, true, X.getSubKind()) {}
Loc& operator=(const Loc& X) { memcpy(this, &X, sizeof(Loc)); return *this; }
- static Loc MakeVal(const MemRegion* R);
-
- static Loc MakeVal(const AddrLabelExpr* E);
-
- static Loc MakeNull(BasicValueFactory &BasicVals);
-
// Implement isa<T> support.
static inline bool classof(const SVal* V) {
return V->getBaseKind() == LocKind;
@@ -301,6 +274,8 @@ public:
};
class LocAsInteger : public NonLoc {
+ friend class clang::ValueManager;
+
LocAsInteger(const std::pair<SVal, uintptr_t>& data) :
NonLoc(LocAsIntegerKind, &data) {
assert (isa<Loc>(data.first));
@@ -330,12 +305,10 @@ public:
static inline bool classof(const NonLoc* V) {
return V->getSubKind() == LocAsIntegerKind;
}
-
- static LocAsInteger Make(BasicValueFactory& Vals, Loc V, unsigned Bits);
};
class CompoundVal : public NonLoc {
- friend class NonLoc;
+ friend class clang::ValueManager;
CompoundVal(const CompoundValData* D) : NonLoc(CompoundValKind, D) {}
diff --git a/include/clang/Analysis/PathSensitive/ValueManager.h b/include/clang/Analysis/PathSensitive/ValueManager.h
index b86f4e8..d8e557f 100644
--- a/include/clang/Analysis/PathSensitive/ValueManager.h
+++ b/include/clang/Analysis/PathSensitive/ValueManager.h
@@ -9,7 +9,7 @@
//
// This file defines ValueManager, a class that manages symbolic values
// and SVals created for use by GRExprEngine and related classes. It
-// wraps SymbolManager, MemRegionManager, and BasicValueFactory.
+// wraps and owns SymbolManager, MemRegionManager, and BasicValueFactory.
//
//===----------------------------------------------------------------------===//
@@ -39,7 +39,7 @@ public:
ValueManager(llvm::BumpPtrAllocator &alloc, ASTContext &context)
: Context(context), BasicVals(Context, alloc),
SymMgr(Context, BasicVals, alloc),
- MemMgr(alloc) {}
+ MemMgr(Context, alloc) {}
// Accessors to submanagers.
@@ -68,17 +68,8 @@ public:
return SymMgr.getConjuredSymbol(E, VisitCount, SymbolTag);
}
- // Aggregation methods that use multiple submanagers.
-
- Loc makeRegionVal(SymbolRef Sym) {
- return Loc::MakeVal(MemMgr.getSymbolicRegion(Sym));
- }
-
/// makeZeroVal - Construct an SVal representing '0' for the specified type.
SVal makeZeroVal(QualType T);
- /// makeZeroArrayIndex - Construct an SVal representing '0' index for array
- /// elements.
- SVal makeZeroArrayIndex();
/// GetRegionValueSymbolVal - make a unique symbol for value of R.
SVal getRegionValueSymbolVal(const MemRegion* R, QualType T = QualType());
@@ -87,16 +78,77 @@ public:
SVal getConjuredSymbolVal(const Expr* E, QualType T, unsigned Count);
SVal getFunctionPointer(const FunctionDecl* FD);
-
- NonLoc makeNonLoc(SymbolRef sym);
-
+
+ NonLoc makeCompoundVal(QualType T, llvm::ImmutableList<SVal> Vals) {
+ return nonloc::CompoundVal(BasicVals.getCompoundValData(T, Vals));
+ }
+
+ NonLoc makeZeroArrayIndex() {
+ return nonloc::ConcreteInt(BasicVals.getZeroWithPtrWidth(false));
+ }
+
+ NonLoc makeIntVal(const IntegerLiteral* I) {
+ return nonloc::ConcreteInt(BasicVals.getValue(I->getValue(),
+ I->getType()->isUnsignedIntegerType()));
+ }
+
+ NonLoc makeIntVal(const llvm::APSInt& V) {
+ return nonloc::ConcreteInt(BasicVals.getValue(V));
+ }
+
+ NonLoc makeIntVal(const llvm::APInt& V, bool isUnsigned) {
+ return nonloc::ConcreteInt(BasicVals.getValue(V, isUnsigned));
+ }
+
+ NonLoc makeIntVal(uint64_t X, QualType T) {
+ return nonloc::ConcreteInt(BasicVals.getValue(X, T));
+ }
+
+ NonLoc makeIntVal(uint64_t X, bool isUnsigned) {
+ return nonloc::ConcreteInt(BasicVals.getIntValue(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);
+ 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));
+ }
};
} // end clang namespace
#endif
OpenPOWER on IntegriCloud