From: Zhongxing Xu Date: Sat, 9 May 2009 03:57:34 +0000 (+0000) Subject: As discussed with Ted, rename TypedRegion::getObjectType() to X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a82d8aa5b3b3d24998b4d98b9f45a43cc84cac6f;p=clang As discussed with Ted, rename TypedRegion::getObjectType() to TypedRegion::getValueType(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71321 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Analysis/PathSensitive/GRState.h b/include/clang/Analysis/PathSensitive/GRState.h index 2fc8b92388..d61feea481 100644 --- a/include/clang/Analysis/PathSensitive/GRState.h +++ b/include/clang/Analysis/PathSensitive/GRState.h @@ -513,7 +513,7 @@ public: return UnknownVal(); if (const TypedRegion *TR = dyn_cast(R)) { - QualType T = TR->getObjectType(getContext()); + QualType T = TR->getValueType(getContext()); if (Loc::IsLocType(T) || T->isIntegerType()) return GetSVal(state, R); } diff --git a/include/clang/Analysis/PathSensitive/MemRegion.h b/include/clang/Analysis/PathSensitive/MemRegion.h index 690ff555b7..831da268b1 100644 --- a/include/clang/Analysis/PathSensitive/MemRegion.h +++ b/include/clang/Analysis/PathSensitive/MemRegion.h @@ -148,15 +148,15 @@ protected: TypedRegion(const MemRegion* sReg, Kind k) : SubRegion(sReg, k) {} public: - virtual QualType getObjectType(ASTContext &C) const = 0; + virtual QualType getValueType(ASTContext &C) const = 0; virtual QualType getLocationType(ASTContext& C) const { // FIXME: We can possibly optimize this later to cache this value. - return C.getPointerType(getObjectType(C)); + return C.getPointerType(getValueType(C)); } - QualType getDesugaredObjectType(ASTContext& C) const { - QualType T = getObjectType(C); + QualType getDesugaredValueType(ASTContext& C) const { + QualType T = getValueType(C); return T.getTypePtr() ? T->getDesugaredType() : T; } @@ -165,7 +165,7 @@ public: } bool isBoundable(ASTContext &C) const { - return !getObjectType(C).isNull(); + return !getValueType(C).isNull(); } static bool classof(const MemRegion* R) { @@ -206,7 +206,7 @@ public: Data(sym), LocationType(t) {} - QualType getObjectType(ASTContext &C) const { + QualType getValueType(ASTContext &C) const { // Do not get the object type of a CodeTextRegion. assert(0); return QualType(); @@ -287,7 +287,7 @@ public: const StringLiteral* getStringLiteral() const { return Str; } - QualType getObjectType(ASTContext& C) const { + QualType getValueType(ASTContext& C) const { return Str->getType(); } @@ -320,7 +320,7 @@ public: return LValueType; } - QualType getObjectType(ASTContext&) const { + QualType getValueType(ASTContext&) const { const PointerType* PTy = LValueType->getAsPointerType(); assert(PTy); return PTy->getPointeeType(); @@ -357,7 +357,7 @@ private: const CompoundLiteralExpr* CL, const MemRegion* superRegion); public: - QualType getObjectType(ASTContext& C) const { + QualType getValueType(ASTContext& C) const { return C.getCanonicalType(CL->getType()); } @@ -406,7 +406,7 @@ class VarRegion : public DeclRegion { public: const VarDecl* getDecl() const { return cast(D); } - QualType getObjectType(ASTContext& C) const { + QualType getValueType(ASTContext& C) const { // FIXME: We can cache this if needed. return C.getCanonicalType(getDecl()->getType()); } @@ -430,7 +430,7 @@ public: const FieldDecl* getDecl() const { return cast(D); } - QualType getObjectType(ASTContext& C) const { + QualType getValueType(ASTContext& C) const { // FIXME: We can cache this if needed. return C.getCanonicalType(getDecl()->getType()); } @@ -462,7 +462,7 @@ public: return cast(D); } - QualType getObjectType(ASTContext& C) const { + QualType getValueType(ASTContext& C) const { return C.getObjCInterfaceType(getInterface()); } @@ -485,7 +485,7 @@ class ObjCIvarRegion : public DeclRegion { public: const ObjCIvarDecl* getDecl() const { return cast(D); } - QualType getObjectType(ASTContext&) const { return getDecl()->getType(); } + QualType getValueType(ASTContext&) const { return getDecl()->getType(); } static bool classof(const MemRegion* R) { return R->getKind() == ObjCIvarRegionKind; @@ -513,7 +513,7 @@ public: SVal getIndex() const { return Index; } - QualType getObjectType(ASTContext&) const { + QualType getValueType(ASTContext&) const { return ElementType; } diff --git a/lib/Analysis/BasicObjCFoundationChecks.cpp b/lib/Analysis/BasicObjCFoundationChecks.cpp index 112a3a1d66..98e9551d4b 100644 --- a/lib/Analysis/BasicObjCFoundationChecks.cpp +++ b/lib/Analysis/BasicObjCFoundationChecks.cpp @@ -417,7 +417,7 @@ bool AuditCFNumberCreate::Audit(ExplodedNode* N,GRStateManager&){ if (!R) return false; } - QualType T = Ctx.getCanonicalType(R->getObjectType(Ctx)); + QualType T = Ctx.getCanonicalType(R->getValueType(Ctx)); // FIXME: If the pointee isn't an integer type, should we flag a warning? // People can do weird stuff with pointers. diff --git a/lib/Analysis/BasicStore.cpp b/lib/Analysis/BasicStore.cpp index e4e0cfa983..b9eeb9f8bc 100644 --- a/lib/Analysis/BasicStore.cpp +++ b/lib/Analysis/BasicStore.cpp @@ -357,7 +357,7 @@ Store BasicStoreManager::BindInternal(Store store, Loc loc, SVal V) { // elsewhere. Food for thought. if (const TypedRegion *TyR = dyn_cast(R)) { if (TyR->isBoundable(C) && - Loc::IsLocType(TyR->getObjectType(C))) + Loc::IsLocType(TyR->getValueType(C))) V = X->getLoc(); } } diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp index 0f251b343d..7327887212 100644 --- a/lib/Analysis/CFRefCount.cpp +++ b/lib/Analysis/CFRefCount.cpp @@ -2661,7 +2661,7 @@ void CFRefCount::EvalSummary(ExplodedNodeSet& Dst, if (R->isBoundable(Ctx)) { // Set the value of the variable to be a conjured symbol. unsigned Count = Builder.getCurrentBlockCount(); - QualType T = R->getObjectType(Ctx); + QualType T = R->getValueType(Ctx); if (Loc::IsLocType(T) || (T->isIntegerType() && T->isScalarType())){ ValueManager &ValMgr = Eng.getValueManager(); diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp index b92705c3bc..bc6a36c747 100644 --- a/lib/Analysis/GRExprEngine.cpp +++ b/lib/Analysis/GRExprEngine.cpp @@ -1785,7 +1785,7 @@ void GRExprEngine::VisitObjCForCollectionStmtAux(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->getObjectType(getContext()); + QualType T = R->getValueType(getContext()); assert (Loc::IsLocType(T)); unsigned Count = Builder->getCurrentBlockCount(); SymbolRef Sym = SymMgr.getConjuredSymbol(elem, T, Count); diff --git a/lib/Analysis/RegionStore.cpp b/lib/Analysis/RegionStore.cpp index ff86708c35..6e9a1a684d 100644 --- a/lib/Analysis/RegionStore.cpp +++ b/lib/Analysis/RegionStore.cpp @@ -492,7 +492,7 @@ SVal RegionStoreManager::getSizeInElements(const GRState* St, const MemRegion* R) { if (const VarRegion* VR = dyn_cast(R)) { // Get the type of the variable. - QualType T = VR->getDesugaredObjectType(getContext()); + QualType T = VR->getDesugaredValueType(getContext()); // FIXME: Handle variable-length arrays. if (isa(T)) @@ -510,7 +510,7 @@ SVal RegionStoreManager::getSizeInElements(const GRState* St, // that type. if (CastTy) { QualType EleTy =cast(CastTy->getTypePtr())->getPointeeType(); - QualType VarTy = VR->getObjectType(getContext()); + QualType VarTy = VR->getValueType(getContext()); uint64_t EleSize = getContext().getTypeSize(EleTy); uint64_t VarSize = getContext().getTypeSize(VarTy); return NonLoc::MakeIntVal(getBasicVals(), VarSize / EleSize, false); @@ -605,8 +605,8 @@ SVal RegionStoreManager::ArrayToPointer(Loc Array) { if (!ArrayR) return UnknownVal(); - // Strip off typedefs from the ArrayRegion's ObjectType. - QualType T = ArrayR->getObjectType(getContext())->getDesugaredType(); + // Strip off typedefs from the ArrayRegion's ValueType. + QualType T = ArrayR->getValueType(getContext())->getDesugaredType(); ArrayType *AT = cast(T); T = AT->getElementType(); @@ -676,7 +676,7 @@ RegionStoreManager::CastRegion(const GRState* state, const MemRegion* R, return CastResult(state, R); } - QualType ObjTy = cast(R)->getObjectType(getContext()); + QualType ObjTy = cast(R)->getValueType(getContext()); uint64_t PointeeTySize = getContext().getTypeSize(PointeeTy); uint64_t ObjTySize = getContext().getTypeSize(ObjTy); @@ -722,7 +722,7 @@ SVal RegionStoreManager::EvalBinOp(BinaryOperator::Opcode Op, Loc L, NonLoc R) { // p += 3; // Note that p binds to a TypedViewRegion(SymbolicRegion). nonloc::ConcreteInt Idx(getBasicVals().getZeroWithPtrWidth(false)); - ER = MRMgr.getElementRegion(TR->getObjectType(getContext()), Idx, TR); + ER = MRMgr.getElementRegion(TR->getValueType(getContext()), Idx, TR); } SVal Idx = ER->getIndex(); @@ -782,7 +782,7 @@ SVal RegionStoreManager::Retrieve(const GRState* St, Loc L, QualType T) { // // Such funny addressing will occur due to layering of regions. - QualType RTy = R->getObjectType(getContext()); + QualType RTy = R->getValueType(getContext()); if (RTy->isStructureType()) return RetrieveStruct(St, R); @@ -868,7 +868,7 @@ SVal RegionStoreManager::Retrieve(const GRState* St, Loc L, QualType T) { } SVal RegionStoreManager::RetrieveStruct(const GRState* St,const TypedRegion* R){ - QualType T = R->getObjectType(getContext()); + QualType T = R->getValueType(getContext()); assert(T->isStructureType()); const RecordType* RT = cast(T.getTypePtr()); @@ -893,7 +893,7 @@ SVal RegionStoreManager::RetrieveStruct(const GRState* St,const TypedRegion* R){ } SVal RegionStoreManager::RetrieveArray(const GRState* St, const TypedRegion* R){ - QualType T = R->getObjectType(getContext()); + QualType T = R->getValueType(getContext()); ConstantArrayType* CAT = cast(T.getTypePtr()); llvm::ImmutableList ArrayVal = getBasicVals().getEmptySValList(); @@ -903,7 +903,7 @@ SVal RegionStoreManager::RetrieveArray(const GRState* St, const TypedRegion* R){ for (; i < Size; ++i) { SVal Idx = NonLoc::MakeVal(getBasicVals(), i); - ElementRegion* ER = MRMgr.getElementRegion(R->getObjectType(getContext()), + ElementRegion* ER = MRMgr.getElementRegion(R->getValueType(getContext()), Idx, R); QualType ETy = ER->getElementType(); SVal ElementVal = Retrieve(St, loc::MemRegionVal(ER), ETy); @@ -920,7 +920,7 @@ const GRState* RegionStoreManager::Bind(const GRState* St, Loc L, SVal V) { // Check if the region is a struct region. if (const TypedRegion* TR = dyn_cast(R)) - if (TR->getObjectType(getContext())->isStructureType()) + if (TR->getValueType(getContext())->isStructureType()) return BindStruct(St, TR, V); Store store = St->getStore(); @@ -1154,7 +1154,7 @@ void RegionStoreManager::print(Store store, std::ostream& Out, const GRState* RegionStoreManager::BindArray(const GRState* St, const TypedRegion* R, SVal Init) { - QualType T = R->getObjectType(getContext()); + QualType T = R->getValueType(getContext()); assert(T->isArrayType()); // When we are binding the whole array, it always has default value 0. @@ -1219,7 +1219,7 @@ const GRState* RegionStoreManager::BindArray(const GRState* St, const GRState* RegionStoreManager::BindStruct(const GRState* St, const TypedRegion* R, SVal V){ - QualType T = R->getObjectType(getContext()); + QualType T = R->getValueType(getContext()); assert(T->isStructureType()); const RecordType* RT = T->getAsRecordType(); diff --git a/lib/Analysis/SVals.cpp b/lib/Analysis/SVals.cpp index 1090aaa681..58a0b80aa6 100644 --- a/lib/Analysis/SVals.cpp +++ b/lib/Analysis/SVals.cpp @@ -301,7 +301,7 @@ SVal ValueManager::getRValueSymbolVal(const MemRegion* R) { SymbolRef sym = SymMgr.getRegionRValueSymbol(R); if (const TypedRegion* TR = dyn_cast(R)) { - QualType T = TR->getObjectType(SymMgr.getContext()); + QualType T = TR->getValueType(SymMgr.getContext()); // If T is of function pointer type, create a CodeTextRegion wrapping a // symbol. diff --git a/lib/Analysis/SymbolManager.cpp b/lib/Analysis/SymbolManager.cpp index ee18f2c9e4..84019fd8d5 100644 --- a/lib/Analysis/SymbolManager.cpp +++ b/lib/Analysis/SymbolManager.cpp @@ -167,7 +167,7 @@ QualType SymbolConjured::getType(ASTContext&) const { QualType SymbolRegionRValue::getType(ASTContext& C) const { if (const TypedRegion* TR = dyn_cast(R)) - return TR->getObjectType(C); + return TR->getValueType(C); return QualType(); }