forked from OSchip/llvm-project
MemRegion can refer to ASTContext without external help.
llvm-svn: 110784
This commit is contained in:
parent
5cd4d0f9ac
commit
8de0a3d8c3
|
@ -349,24 +349,24 @@ protected:
|
|||
TypedRegion(const MemRegion* sReg, Kind k) : SubRegion(sReg, k) {}
|
||||
|
||||
public:
|
||||
virtual QualType getValueType(ASTContext &C) const = 0;
|
||||
virtual QualType getValueType() const = 0;
|
||||
|
||||
virtual QualType getLocationType(ASTContext& C) const {
|
||||
virtual QualType getLocationType() const {
|
||||
// FIXME: We can possibly optimize this later to cache this value.
|
||||
return C.getPointerType(getValueType(C));
|
||||
return getContext().getPointerType(getValueType());
|
||||
}
|
||||
|
||||
QualType getDesugaredValueType(ASTContext& C) const {
|
||||
QualType T = getValueType(C);
|
||||
QualType getDesugaredValueType() const {
|
||||
QualType T = getValueType();
|
||||
return T.getTypePtr() ? T.getDesugaredType() : T;
|
||||
}
|
||||
|
||||
QualType getDesugaredLocationType(ASTContext& C) const {
|
||||
return getLocationType(C).getDesugaredType();
|
||||
QualType getDesugaredLocationType() const {
|
||||
return getLocationType().getDesugaredType();
|
||||
}
|
||||
|
||||
bool isBoundable() const {
|
||||
return !getValueType(getContext()).isNull();
|
||||
return !getValueType().isNull();
|
||||
}
|
||||
|
||||
static bool classof(const MemRegion* R) {
|
||||
|
@ -380,9 +380,8 @@ class CodeTextRegion : public TypedRegion {
|
|||
protected:
|
||||
CodeTextRegion(const MemRegion *sreg, Kind k) : TypedRegion(sreg, k) {}
|
||||
public:
|
||||
QualType getValueType(ASTContext &C) const {
|
||||
// Do not get the object type of a CodeTextRegion.
|
||||
assert(0);
|
||||
QualType getValueType() const {
|
||||
assert(0 && "Do not get the object type of a CodeTextRegion.");
|
||||
return QualType();
|
||||
}
|
||||
|
||||
|
@ -401,8 +400,8 @@ public:
|
|||
FunctionTextRegion(const FunctionDecl* fd, const MemRegion* sreg)
|
||||
: CodeTextRegion(sreg, FunctionTextRegionKind), FD(fd) {}
|
||||
|
||||
QualType getLocationType(ASTContext &C) const {
|
||||
return C.getPointerType(FD->getType());
|
||||
QualType getLocationType() const {
|
||||
return getContext().getPointerType(FD->getType());
|
||||
}
|
||||
|
||||
const FunctionDecl *getDecl() const {
|
||||
|
@ -440,7 +439,7 @@ class BlockTextRegion : public CodeTextRegion {
|
|||
: CodeTextRegion(sreg, BlockTextRegionKind), BD(bd), AC(ac), locTy(lTy) {}
|
||||
|
||||
public:
|
||||
QualType getLocationType(ASTContext &C) const {
|
||||
QualType getLocationType() const {
|
||||
return locTy;
|
||||
}
|
||||
|
||||
|
@ -577,7 +576,7 @@ public:
|
|||
|
||||
const StringLiteral* getStringLiteral() const { return Str; }
|
||||
|
||||
QualType getValueType(ASTContext& C) const {
|
||||
QualType getValueType() const {
|
||||
return Str->getType();
|
||||
}
|
||||
|
||||
|
@ -611,8 +610,8 @@ private:
|
|||
const CompoundLiteralExpr* CL,
|
||||
const MemRegion* superRegion);
|
||||
public:
|
||||
QualType getValueType(ASTContext& C) const {
|
||||
return C.getCanonicalType(CL->getType());
|
||||
QualType getValueType() const {
|
||||
return CL->getType();
|
||||
}
|
||||
|
||||
bool isBoundable() const { return !CL->isFileScope(); }
|
||||
|
@ -669,9 +668,9 @@ public:
|
|||
|
||||
const StackFrameContext *getStackFrame() const;
|
||||
|
||||
QualType getValueType(ASTContext& C) const {
|
||||
QualType getValueType() const {
|
||||
// FIXME: We can cache this if needed.
|
||||
return C.getCanonicalType(getDecl()->getType());
|
||||
return getDecl()->getType();
|
||||
}
|
||||
|
||||
void dumpToStream(llvm::raw_ostream& os) const;
|
||||
|
@ -697,7 +696,7 @@ class CXXThisRegion : public TypedRegion {
|
|||
void Profile(llvm::FoldingSetNodeID &ID) const;
|
||||
|
||||
public:
|
||||
QualType getValueType(ASTContext &C) const {
|
||||
QualType getValueType() const {
|
||||
return QualType(ThisPointerTy, 0);
|
||||
}
|
||||
|
||||
|
@ -723,9 +722,9 @@ public:
|
|||
|
||||
const FieldDecl* getDecl() const { return cast<FieldDecl>(D); }
|
||||
|
||||
QualType getValueType(ASTContext& C) const {
|
||||
QualType getValueType() const {
|
||||
// FIXME: We can cache this if needed.
|
||||
return C.getCanonicalType(getDecl()->getType());
|
||||
return getDecl()->getType();
|
||||
}
|
||||
|
||||
DefinedOrUnknownSVal getExtent(ValueManager& ValMgr) const;
|
||||
|
@ -754,7 +753,7 @@ class ObjCIvarRegion : public DeclRegion {
|
|||
|
||||
public:
|
||||
const ObjCIvarDecl* getDecl() const { return cast<ObjCIvarDecl>(D); }
|
||||
QualType getValueType(ASTContext&) const { return getDecl()->getType(); }
|
||||
QualType getValueType() const { return getDecl()->getType(); }
|
||||
|
||||
void dumpToStream(llvm::raw_ostream& os) const;
|
||||
|
||||
|
@ -808,7 +807,7 @@ public:
|
|||
|
||||
SVal getIndex() const { return Index; }
|
||||
|
||||
QualType getValueType(ASTContext&) const {
|
||||
QualType getValueType() const {
|
||||
return ElementType;
|
||||
}
|
||||
|
||||
|
@ -840,7 +839,7 @@ class CXXObjectRegion : public TypedRegion {
|
|||
Expr const *E, const MemRegion *sReg);
|
||||
|
||||
public:
|
||||
QualType getValueType(ASTContext& C) const {
|
||||
QualType getValueType() const {
|
||||
return Ex->getType();
|
||||
}
|
||||
|
||||
|
|
|
@ -70,8 +70,7 @@ void AdjustedReturnValueChecker::PostVisitCallExpr(CheckerContext &C,
|
|||
}
|
||||
else if (const BlockDataRegion *BD = dyn_cast<BlockDataRegion>(callee)) {
|
||||
const BlockTextRegion *BR = BD->getCodeRegion();
|
||||
const BlockPointerType *BT =
|
||||
BR->getLocationType(C.getASTContext())->getAs<BlockPointerType>();
|
||||
const BlockPointerType *BT=BR->getLocationType()->getAs<BlockPointerType>();
|
||||
const FunctionType *FT = BT->getPointeeType()->getAs<FunctionType>();
|
||||
actualResultTy = FT->getResultType();
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ void ArrayBoundChecker::VisitLocation(CheckerContext &C, const Stmt *S, SVal l){
|
|||
// Get the size of the array.
|
||||
DefinedOrUnknownSVal NumElements
|
||||
= C.getStoreManager().getSizeInElements(state, ER->getSuperRegion(),
|
||||
ER->getValueType(C.getASTContext()));
|
||||
ER->getValueType());
|
||||
|
||||
const GRState *StInBound = state->AssumeInBound(Idx, NumElements, true);
|
||||
const GRState *StOutBound = state->AssumeInBound(Idx, NumElements, false);
|
||||
|
|
|
@ -358,7 +358,7 @@ bool AuditCFNumberCreate::Audit(ExplodedNode* N,GRStateManager&){
|
|||
if (!R)
|
||||
return false;
|
||||
|
||||
QualType T = Ctx.getCanonicalType(R->getValueType(Ctx));
|
||||
QualType T = Ctx.getCanonicalType(R->getValueType());
|
||||
|
||||
// FIXME: If the pointee isn't an integer type, should we flag a warning?
|
||||
// People can do weird stuff with pointers.
|
||||
|
|
|
@ -236,7 +236,7 @@ Store BasicStoreManager::Bind(Store store, Loc loc, SVal V) {
|
|||
if (isa<Loc>(V) || isa<nonloc::LocAsInteger>(V))
|
||||
if (const ElementRegion *ER = dyn_cast<ElementRegion>(R)) {
|
||||
// FIXME: Should check for index 0.
|
||||
QualType T = ER->getLocationType(C);
|
||||
QualType T = ER->getLocationType();
|
||||
|
||||
if (isHigherOrderRawPtr(T, C))
|
||||
R = ER->getSuperRegion();
|
||||
|
@ -249,7 +249,7 @@ Store BasicStoreManager::Bind(Store store, Loc loc, SVal V) {
|
|||
|
||||
// Do not bind to arrays. We need to explicitly check for this so that
|
||||
// we do not encounter any weirdness of trying to load/store from arrays.
|
||||
if (TyR->isBoundable() && TyR->getValueType(C)->isArrayType())
|
||||
if (TyR->isBoundable() && TyR->getValueType()->isArrayType())
|
||||
return store;
|
||||
|
||||
if (nonloc::LocAsInteger *X = dyn_cast<nonloc::LocAsInteger>(&V)) {
|
||||
|
@ -259,7 +259,7 @@ Store BasicStoreManager::Bind(Store store, Loc loc, SVal V) {
|
|||
// a pointer. We may wish to flag a type error here if the types
|
||||
// are incompatible. This may also cause lots of breakage
|
||||
// elsewhere. Food for thought.
|
||||
if (TyR->isBoundable() && Loc::IsLocType(TyR->getValueType(C)))
|
||||
if (TyR->isBoundable() && Loc::IsLocType(TyR->getValueType()))
|
||||
V = X->getLoc();
|
||||
}
|
||||
|
||||
|
@ -580,7 +580,7 @@ Store BasicStoreManager::InvalidateRegion(Store store,
|
|||
}
|
||||
}
|
||||
|
||||
QualType T = cast<TypedRegion>(R)->getValueType(R->getContext());
|
||||
QualType T = cast<TypedRegion>(R)->getValueType();
|
||||
SVal V = ValMgr.getConjuredSymbolVal(R, E, T, Count);
|
||||
return Bind(store, loc::MemRegionVal(R), V);
|
||||
}
|
||||
|
|
|
@ -143,10 +143,9 @@ public:
|
|||
|
||||
if (isa<loc::ConcreteInt>(V)) {
|
||||
bool b = false;
|
||||
ASTContext &C = BRC.getASTContext();
|
||||
if (R->isBoundable()) {
|
||||
if (const TypedRegion *TR = dyn_cast<TypedRegion>(R)) {
|
||||
if (TR->getValueType(C)->isObjCObjectPointerType()) {
|
||||
if (TR->getValueType()->isObjCObjectPointerType()) {
|
||||
os << "initialized to nil";
|
||||
b = true;
|
||||
}
|
||||
|
@ -174,10 +173,9 @@ public:
|
|||
if (os.str().empty()) {
|
||||
if (isa<loc::ConcreteInt>(V)) {
|
||||
bool b = false;
|
||||
ASTContext &C = BRC.getASTContext();
|
||||
if (R->isBoundable()) {
|
||||
if (const TypedRegion *TR = dyn_cast<TypedRegion>(R)) {
|
||||
if (TR->getValueType(C)->isObjCObjectPointerType()) {
|
||||
if (TR->getValueType()->isObjCObjectPointerType()) {
|
||||
os << "nil object reference stored to ";
|
||||
b = true;
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ const GRState *CStringChecker::CheckLocation(CheckerContext &C,
|
|||
if (!ER)
|
||||
return state;
|
||||
|
||||
assert(ER->getValueType(C.getASTContext()) == C.getASTContext().CharTy &&
|
||||
assert(ER->getValueType() == C.getASTContext().CharTy &&
|
||||
"CheckLocation should only be called with char* ElementRegions");
|
||||
|
||||
// Get the size of the array.
|
||||
|
@ -518,20 +518,16 @@ bool CStringChecker::SummarizeRegion(llvm::raw_ostream& os, ASTContext& Ctx,
|
|||
return true;
|
||||
case MemRegion::CXXThisRegionKind:
|
||||
case MemRegion::CXXObjectRegionKind:
|
||||
os << "a C++ object of type "
|
||||
<< TR->getValueType(Ctx).getAsString();
|
||||
os << "a C++ object of type " << TR->getValueType().getAsString();
|
||||
return true;
|
||||
case MemRegion::VarRegionKind:
|
||||
os << "a variable of type"
|
||||
<< TR->getValueType(Ctx).getAsString();
|
||||
os << "a variable of type" << TR->getValueType().getAsString();
|
||||
return true;
|
||||
case MemRegion::FieldRegionKind:
|
||||
os << "a field of type "
|
||||
<< TR->getValueType(Ctx).getAsString();
|
||||
os << "a field of type " << TR->getValueType().getAsString();
|
||||
return true;
|
||||
case MemRegion::ObjCIvarRegionKind:
|
||||
os << "an instance variable of type "
|
||||
<< TR->getValueType(Ctx).getAsString();
|
||||
os << "an instance variable of type " << TR->getValueType().getAsString();
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
|
|
@ -114,7 +114,7 @@ bool CallAndMessageChecker::PreVisitProcessArg(CheckerContext &C,
|
|||
: C(c), StoreMgr(storeMgr), MrMgr(mrMgr), store(s) {}
|
||||
|
||||
bool Find(const TypedRegion *R) {
|
||||
QualType T = R->getValueType(C);
|
||||
QualType T = R->getValueType();
|
||||
if (const RecordType *RT = T->getAsStructureType()) {
|
||||
const RecordDecl *RD = RT->getDecl()->getDefinition();
|
||||
assert(RD && "Referred record has no definition");
|
||||
|
|
|
@ -175,7 +175,7 @@ FlatStoreManager::RegionInterval
|
|||
FlatStoreManager::RegionToInterval(const MemRegion *R) {
|
||||
switch (R->getKind()) {
|
||||
case MemRegion::VarRegionKind: {
|
||||
QualType T = cast<VarRegion>(R)->getValueType(Ctx);
|
||||
QualType T = cast<VarRegion>(R)->getValueType();
|
||||
int64_t Size = Ctx.getTypeSize(T);
|
||||
return RegionInterval(R, 0, Size-1);
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ FlatStoreManager::RegionToInterval(const MemRegion *R) {
|
|||
if (!Offset.getRegion())
|
||||
return RegionInterval(0, 0, 0);
|
||||
int64_t Start = Offset.getOffset();
|
||||
int64_t Size = Ctx.getTypeSize(cast<TypedRegion>(R)->getValueType(Ctx));
|
||||
int64_t Size = Ctx.getTypeSize(cast<TypedRegion>(R)->getValueType());
|
||||
return RegionInterval(Offset.getRegion(), Start, Start+Size);
|
||||
}
|
||||
|
||||
|
|
|
@ -1830,7 +1830,7 @@ void GRExprEngine::EvalLoad(ExplodedNodeSet& Dst, const Expr *Ex,
|
|||
if (const TypedRegion *TR =
|
||||
dyn_cast_or_null<TypedRegion>(location.getAsRegion())) {
|
||||
|
||||
QualType ValTy = TR->getValueType(getContext());
|
||||
QualType ValTy = TR->getValueType();
|
||||
if (const ReferenceType *RT = ValTy->getAs<ReferenceType>()) {
|
||||
static int loadReferenceTag = 0;
|
||||
ExplodedNodeSet Tmp;
|
||||
|
@ -2246,7 +2246,7 @@ void GRExprEngine::VisitObjCForCollectionStmtAux(const ObjCForCollectionStmt* S,
|
|||
// FIXME: The proper thing to do is to really iterate over the
|
||||
// container. We will do this with dispatch logic to the store.
|
||||
// For now, just 'conjure' up a symbolic value.
|
||||
QualType T = R->getValueType(getContext());
|
||||
QualType T = R->getValueType();
|
||||
assert(Loc::IsLocType(T));
|
||||
unsigned Count = Builder->getCurrentBlockCount();
|
||||
SymbolRef Sym = SymMgr.getConjuredSymbol(elem, T, Count);
|
||||
|
|
|
@ -88,7 +88,7 @@ SVal GRState::getSValAsScalarOrLoc(const MemRegion *R) const {
|
|||
return UnknownVal();
|
||||
|
||||
if (const TypedRegion *TR = dyn_cast<TypedRegion>(R)) {
|
||||
QualType T = TR->getValueType(getStateManager().getContext());
|
||||
QualType T = TR->getValueType();
|
||||
if (Loc::IsLocType(T) || T->isIntegerType())
|
||||
return getSVal(R);
|
||||
}
|
||||
|
|
|
@ -178,7 +178,7 @@ const StackFrameContext *VarRegion::getStackFrame() const {
|
|||
|
||||
DefinedOrUnknownSVal DeclRegion::getExtent(ValueManager& ValMgr) const {
|
||||
ASTContext& Ctx = ValMgr.getContext();
|
||||
QualType T = getDesugaredValueType(Ctx);
|
||||
QualType T = getDesugaredValueType();
|
||||
|
||||
if (isa<VariableArrayType>(T))
|
||||
return nonloc::SymbolVal(ValMgr.getSymbolManager().getExtentSymbol(this));
|
||||
|
@ -196,8 +196,7 @@ DefinedOrUnknownSVal FieldRegion::getExtent(ValueManager& ValMgr) const {
|
|||
// A zero-length array at the end of a struct often stands for dynamically-
|
||||
// allocated extra memory.
|
||||
if (Extent.isZeroConstant()) {
|
||||
ASTContext& Ctx = ValMgr.getContext();
|
||||
QualType T = getDesugaredValueType(Ctx);
|
||||
QualType T = getDesugaredValueType();
|
||||
|
||||
if (isa<ConstantArrayType>(T))
|
||||
return UnknownVal();
|
||||
|
@ -846,7 +845,7 @@ RegionOffset MemRegion::getAsOffset() const {
|
|||
goto Finish;
|
||||
case ElementRegionKind: {
|
||||
const ElementRegion *ER = cast<ElementRegion>(R);
|
||||
QualType EleTy = ER->getValueType(getContext());
|
||||
QualType EleTy = ER->getValueType();
|
||||
|
||||
if (!IsCompleteType(getContext(), EleTy))
|
||||
return RegionOffset(0);
|
||||
|
|
|
@ -110,7 +110,7 @@ bool OSAtomicChecker::EvalOSAtomicCompareAndSwap(CheckerContext &C,
|
|||
QualType LoadTy;
|
||||
if (const TypedRegion *TR =
|
||||
dyn_cast_or_null<TypedRegion>(location.getAsRegion())) {
|
||||
LoadTy = TR->getValueType(Ctx);
|
||||
LoadTy = TR->getValueType();
|
||||
}
|
||||
Engine.EvalLoad(Tmp, theValueExpr, C.getPredecessor(),
|
||||
state, location, OSAtomicLoadTag, LoadTy);
|
||||
|
@ -158,7 +158,7 @@ bool OSAtomicChecker::EvalOSAtomicCompareAndSwap(CheckerContext &C,
|
|||
// Handle implicit value casts.
|
||||
if (const TypedRegion *R =
|
||||
dyn_cast_or_null<TypedRegion>(location.getAsRegion())) {
|
||||
val = SVator.EvalCast(val,R->getValueType(Ctx),newValueExpr->getType());
|
||||
val = SVator.EvalCast(val,R->getValueType(), newValueExpr->getType());
|
||||
}
|
||||
|
||||
Engine.EvalStore(TmpStore, NULL, theValueExpr, N,
|
||||
|
|
|
@ -663,7 +663,7 @@ void InvalidateRegionsWorker::VisitBaseRegion(const MemRegion *baseR) {
|
|||
return;
|
||||
|
||||
const TypedRegion *TR = cast<TypedRegion>(baseR);
|
||||
QualType T = TR->getValueType(Ctx);
|
||||
QualType T = TR->getValueType();
|
||||
|
||||
// Invalidate the binding.
|
||||
if (const RecordType *RT = T->getAsStructureType()) {
|
||||
|
@ -774,7 +774,7 @@ SVal RegionStoreManager::ArrayToPointer(Loc Array) {
|
|||
return UnknownVal();
|
||||
|
||||
// Strip off typedefs from the ArrayRegion's ValueType.
|
||||
QualType T = ArrayR->getValueType(getContext()).getDesugaredType();
|
||||
QualType T = ArrayR->getValueType().getDesugaredType();
|
||||
ArrayType *AT = cast<ArrayType>(T);
|
||||
T = AT->getElementType();
|
||||
|
||||
|
@ -915,7 +915,7 @@ Optional<SVal> RegionStoreManager::getDefaultBinding(RegionBindings B,
|
|||
const MemRegion *R) {
|
||||
if (R->isBoundable())
|
||||
if (const TypedRegion *TR = dyn_cast<TypedRegion>(R))
|
||||
if (TR->getValueType(getContext())->isUnionType())
|
||||
if (TR->getValueType()->isUnionType())
|
||||
return UnknownVal();
|
||||
|
||||
if (const SVal *V = Lookup(B, R, BindingKey::Default))
|
||||
|
@ -983,7 +983,7 @@ SVal RegionStoreManager::Retrieve(Store store, Loc L, QualType T) {
|
|||
// FIXME: Perhaps this method should just take a 'const MemRegion*' argument
|
||||
// instead of 'Loc', and have the other Loc cases handled at a higher level.
|
||||
const TypedRegion *R = cast<TypedRegion>(MR);
|
||||
QualType RTy = R->getValueType(getContext());
|
||||
QualType RTy = R->getValueType();
|
||||
|
||||
// FIXME: We should eventually handle funny addressing. e.g.:
|
||||
//
|
||||
|
@ -1115,7 +1115,7 @@ SVal RegionStoreManager::RetrieveElement(Store store,
|
|||
// FIXME: Handle loads from strings where the literal is treated as
|
||||
// an integer, e.g., *((unsigned int*)"hello")
|
||||
ASTContext &Ctx = getContext();
|
||||
QualType T = Ctx.getAsArrayType(StrR->getValueType(Ctx))->getElementType();
|
||||
QualType T = Ctx.getAsArrayType(StrR->getValueType())->getElementType();
|
||||
if (T != Ctx.getCanonicalType(R->getElementType()))
|
||||
return UnknownVal();
|
||||
|
||||
|
@ -1141,7 +1141,7 @@ SVal RegionStoreManager::RetrieveElement(Store store,
|
|||
// FIXME: This is a hack, and doesn't do anything really intelligent yet.
|
||||
const RegionRawOffset &O = R->getAsArrayOffset();
|
||||
if (const TypedRegion *baseR = dyn_cast_or_null<TypedRegion>(O.getRegion())) {
|
||||
QualType baseT = baseR->getValueType(Ctx);
|
||||
QualType baseT = baseR->getValueType();
|
||||
if (baseT->isScalarType()) {
|
||||
QualType elemT = R->getElementType();
|
||||
if (elemT->isScalarType()) {
|
||||
|
@ -1171,7 +1171,7 @@ SVal RegionStoreManager::RetrieveField(Store store,
|
|||
if (const Optional<SVal> &V = getDirectBinding(B, R))
|
||||
return *V;
|
||||
|
||||
QualType Ty = R->getValueType(getContext());
|
||||
QualType Ty = R->getValueType();
|
||||
return RetrieveFieldOrElementCommon(store, R, Ty, R->getSuperRegion());
|
||||
}
|
||||
|
||||
|
@ -1238,7 +1238,7 @@ SVal RegionStoreManager::RetrieveFieldOrElementCommon(Store store,
|
|||
// Currently we don't reason specially about Clang-style vectors. Check
|
||||
// if superR is a vector and if so return Unknown.
|
||||
if (const TypedRegion *typedSuperR = dyn_cast<TypedRegion>(superR)) {
|
||||
if (typedSuperR->getValueType(getContext())->isVectorType())
|
||||
if (typedSuperR->getValueType()->isVectorType())
|
||||
return UnknownVal();
|
||||
}
|
||||
}
|
||||
|
@ -1323,21 +1323,18 @@ SVal RegionStoreManager::RetrieveVar(Store store, const VarRegion *R) {
|
|||
}
|
||||
|
||||
SVal RegionStoreManager::RetrieveLazySymbol(const TypedRegion *R) {
|
||||
|
||||
QualType valTy = R->getValueType(getContext());
|
||||
|
||||
// All other values are symbolic.
|
||||
return ValMgr.getRegionValueSymbolVal(R);
|
||||
}
|
||||
|
||||
SVal RegionStoreManager::RetrieveStruct(Store store, const TypedRegion* R) {
|
||||
QualType T = R->getValueType(getContext());
|
||||
QualType T = R->getValueType();
|
||||
assert(T->isStructureOrClassType());
|
||||
return ValMgr.makeLazyCompoundVal(store, R);
|
||||
}
|
||||
|
||||
SVal RegionStoreManager::RetrieveArray(Store store, const TypedRegion * R) {
|
||||
assert(isa<ConstantArrayType>(R->getValueType(getContext())));
|
||||
assert(isa<ConstantArrayType>(R->getValueType()));
|
||||
return ValMgr.makeLazyCompoundVal(store, R);
|
||||
}
|
||||
|
||||
|
@ -1362,7 +1359,7 @@ Store RegionStoreManager::Bind(Store store, Loc L, SVal V) {
|
|||
|
||||
// Check if the region is a struct region.
|
||||
if (const TypedRegion* TR = dyn_cast<TypedRegion>(R))
|
||||
if (TR->getValueType(getContext())->isStructureOrClassType())
|
||||
if (TR->getValueType()->isStructureOrClassType())
|
||||
return BindStruct(store, TR, V);
|
||||
|
||||
// Special case: the current region represents a cast and it and the super
|
||||
|
@ -1375,8 +1372,8 @@ Store RegionStoreManager::Bind(Store store, Loc L, SVal V) {
|
|||
if (const TypedRegion *superR =
|
||||
dyn_cast<TypedRegion>(ER->getSuperRegion())) {
|
||||
ASTContext &Ctx = getContext();
|
||||
QualType superTy = superR->getValueType(Ctx);
|
||||
QualType erTy = ER->getValueType(Ctx);
|
||||
QualType superTy = superR->getValueType();
|
||||
QualType erTy = ER->getValueType();
|
||||
|
||||
if (IsAnyPointerOrIntptr(superTy, Ctx) &&
|
||||
IsAnyPointerOrIntptr(erTy, Ctx)) {
|
||||
|
@ -1458,8 +1455,7 @@ Store RegionStoreManager::BindArray(Store store, const TypedRegion* R,
|
|||
SVal Init) {
|
||||
|
||||
ASTContext &Ctx = getContext();
|
||||
const ArrayType *AT =
|
||||
cast<ArrayType>(Ctx.getCanonicalType(R->getValueType(Ctx)));
|
||||
const ArrayType *AT =cast<ArrayType>(Ctx.getCanonicalType(R->getValueType()));
|
||||
QualType ElementTy = AT->getElementType();
|
||||
Optional<uint64_t> Size;
|
||||
|
||||
|
@ -1517,7 +1513,7 @@ Store RegionStoreManager::BindStruct(Store store, const TypedRegion* R,
|
|||
if (!Features.supportsFields())
|
||||
return store;
|
||||
|
||||
QualType T = R->getValueType(getContext());
|
||||
QualType T = R->getValueType();
|
||||
assert(T->isStructureOrClassType());
|
||||
|
||||
const RecordType* RT = T->getAs<RecordType>();
|
||||
|
|
|
@ -66,7 +66,7 @@ void ReturnPointerRangeChecker::PreVisitReturnStmt(CheckerContext &C,
|
|||
|
||||
DefinedOrUnknownSVal NumElements
|
||||
= C.getStoreManager().getSizeInElements(state, ER->getSuperRegion(),
|
||||
ER->getValueType(C.getASTContext()));
|
||||
ER->getValueType());
|
||||
|
||||
const GRState *StInBound = state->AssumeInBound(Idx, NumElements, true);
|
||||
const GRState *StOutBound = state->AssumeInBound(Idx, NumElements, false);
|
||||
|
|
|
@ -83,7 +83,7 @@ const MemRegion *StoreManager::CastRegion(const MemRegion *R, QualType CastToTy)
|
|||
// Handle casts from compatible types.
|
||||
if (R->isBoundable())
|
||||
if (const TypedRegion *TR = dyn_cast<TypedRegion>(R)) {
|
||||
QualType ObjTy = Ctx.getCanonicalType(TR->getValueType(Ctx));
|
||||
QualType ObjTy = Ctx.getCanonicalType(TR->getValueType());
|
||||
if (CanonPointeeTy == ObjTy)
|
||||
return R;
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ const MemRegion *StoreManager::CastRegion(const MemRegion *R, QualType CastToTy)
|
|||
// check to see if type we are casting to is the same as the base
|
||||
// region. If so, just return the base region.
|
||||
if (const TypedRegion *TR = dyn_cast<TypedRegion>(baseR)) {
|
||||
QualType ObjTy = Ctx.getCanonicalType(TR->getValueType(Ctx));
|
||||
QualType ObjTy = Ctx.getCanonicalType(TR->getValueType());
|
||||
QualType CanonPointeeTy = Ctx.getCanonicalType(PointeeTy);
|
||||
if (CanonPointeeTy == ObjTy)
|
||||
return baseR;
|
||||
|
@ -222,7 +222,7 @@ SVal StoreManager::CastRetrievedVal(SVal V, const TypedRegion *R,
|
|||
|
||||
if (performTestOnly) {
|
||||
// Automatically translate references to pointers.
|
||||
QualType T = R->getValueType(Ctx);
|
||||
QualType T = R->getValueType();
|
||||
if (const ReferenceType *RT = T->getAs<ReferenceType>())
|
||||
T = Ctx.getPointerType(RT->getPointeeType());
|
||||
|
||||
|
|
|
@ -191,7 +191,7 @@ QualType SymbolConjured::getType(ASTContext&) const {
|
|||
}
|
||||
|
||||
QualType SymbolDerived::getType(ASTContext& Ctx) const {
|
||||
return R->getValueType(Ctx);
|
||||
return R->getValueType();
|
||||
}
|
||||
|
||||
QualType SymbolExtent::getType(ASTContext& Ctx) const {
|
||||
|
@ -199,7 +199,7 @@ QualType SymbolExtent::getType(ASTContext& Ctx) const {
|
|||
}
|
||||
|
||||
QualType SymbolRegionValue::getType(ASTContext& C) const {
|
||||
return R->getValueType(C);
|
||||
return R->getValueType();
|
||||
}
|
||||
|
||||
SymbolManager::~SymbolManager() {}
|
||||
|
|
|
@ -72,7 +72,7 @@ SVal ValueManager::convertToArrayIndex(SVal V) {
|
|||
|
||||
DefinedOrUnknownSVal
|
||||
ValueManager::getRegionValueSymbolVal(const TypedRegion* R) {
|
||||
QualType T = R->getValueType(SymMgr.getContext());
|
||||
QualType T = R->getValueType();
|
||||
|
||||
if (!SymbolManager::canSymbolicate(T))
|
||||
return UnknownVal();
|
||||
|
@ -121,7 +121,7 @@ DefinedOrUnknownSVal ValueManager::getConjuredSymbolVal(const void *SymbolTag,
|
|||
DefinedOrUnknownSVal
|
||||
ValueManager::getDerivedRegionValueSymbolVal(SymbolRef parentSymbol,
|
||||
const TypedRegion *R) {
|
||||
QualType T = R->getValueType(R->getContext());
|
||||
QualType T = R->getValueType();
|
||||
|
||||
if (!SymbolManager::canSymbolicate(T))
|
||||
return UnknownVal();
|
||||
|
|
Loading…
Reference in New Issue