[cfe-commits] r110784 - in /cfe/trunk: include/clang/Checker/PathSensitive/ lib/Checker/
Ted Kremenek
kremenek at apple.com
Tue Aug 10 23:22:28 PDT 2010
Nice!
On Aug 10, 2010, at 11:10 PM, Zhongxing Xu wrote:
> Author: zhongxingxu
> Date: Wed Aug 11 01:10:55 2010
> New Revision: 110784
>
> URL: http://llvm.org/viewvc/llvm-project?rev=110784&view=rev
> Log:
> MemRegion can refer to ASTContext without external help.
>
> Modified:
> cfe/trunk/include/clang/Checker/PathSensitive/MemRegion.h
> cfe/trunk/lib/Checker/AdjustedReturnValueChecker.cpp
> cfe/trunk/lib/Checker/ArrayBoundChecker.cpp
> cfe/trunk/lib/Checker/BasicObjCFoundationChecks.cpp
> cfe/trunk/lib/Checker/BasicStore.cpp
> cfe/trunk/lib/Checker/BugReporterVisitors.cpp
> cfe/trunk/lib/Checker/CStringChecker.cpp
> cfe/trunk/lib/Checker/CallAndMessageChecker.cpp
> cfe/trunk/lib/Checker/FlatStore.cpp
> cfe/trunk/lib/Checker/GRExprEngine.cpp
> cfe/trunk/lib/Checker/GRState.cpp
> cfe/trunk/lib/Checker/MemRegion.cpp
> cfe/trunk/lib/Checker/OSAtomicChecker.cpp
> cfe/trunk/lib/Checker/RegionStore.cpp
> cfe/trunk/lib/Checker/ReturnPointerRangeChecker.cpp
> cfe/trunk/lib/Checker/Store.cpp
> cfe/trunk/lib/Checker/SymbolManager.cpp
> cfe/trunk/lib/Checker/ValueManager.cpp
>
> Modified: cfe/trunk/include/clang/Checker/PathSensitive/MemRegion.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Checker/PathSensitive/MemRegion.h?rev=110784&r1=110783&r2=110784&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Checker/PathSensitive/MemRegion.h (original)
> +++ cfe/trunk/include/clang/Checker/PathSensitive/MemRegion.h Wed Aug 11 01:10:55 2010
> @@ -349,24 +349,24 @@
> 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 @@
> 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 @@
> 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 @@
> : CodeTextRegion(sreg, BlockTextRegionKind), BD(bd), AC(ac), locTy(lTy) {}
>
> public:
> - QualType getLocationType(ASTContext &C) const {
> + QualType getLocationType() const {
> return locTy;
> }
>
> @@ -577,7 +576,7 @@
>
> const StringLiteral* getStringLiteral() const { return Str; }
>
> - QualType getValueType(ASTContext& C) const {
> + QualType getValueType() const {
> return Str->getType();
> }
>
> @@ -611,8 +610,8 @@
> 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 @@
>
> 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 @@
> void Profile(llvm::FoldingSetNodeID &ID) const;
>
> public:
> - QualType getValueType(ASTContext &C) const {
> + QualType getValueType() const {
> return QualType(ThisPointerTy, 0);
> }
>
> @@ -723,9 +722,9 @@
>
> 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 @@
>
> 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 @@
>
> SVal getIndex() const { return Index; }
>
> - QualType getValueType(ASTContext&) const {
> + QualType getValueType() const {
> return ElementType;
> }
>
> @@ -840,7 +839,7 @@
> Expr const *E, const MemRegion *sReg);
>
> public:
> - QualType getValueType(ASTContext& C) const {
> + QualType getValueType() const {
> return Ex->getType();
> }
>
>
> Modified: cfe/trunk/lib/Checker/AdjustedReturnValueChecker.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/AdjustedReturnValueChecker.cpp?rev=110784&r1=110783&r2=110784&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Checker/AdjustedReturnValueChecker.cpp (original)
> +++ cfe/trunk/lib/Checker/AdjustedReturnValueChecker.cpp Wed Aug 11 01:10:55 2010
> @@ -70,8 +70,7 @@
> }
> 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();
> }
>
> Modified: cfe/trunk/lib/Checker/ArrayBoundChecker.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/ArrayBoundChecker.cpp?rev=110784&r1=110783&r2=110784&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Checker/ArrayBoundChecker.cpp (original)
> +++ cfe/trunk/lib/Checker/ArrayBoundChecker.cpp Wed Aug 11 01:10:55 2010
> @@ -58,7 +58,7 @@
> // 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);
>
> Modified: cfe/trunk/lib/Checker/BasicObjCFoundationChecks.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/BasicObjCFoundationChecks.cpp?rev=110784&r1=110783&r2=110784&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Checker/BasicObjCFoundationChecks.cpp (original)
> +++ cfe/trunk/lib/Checker/BasicObjCFoundationChecks.cpp Wed Aug 11 01:10:55 2010
> @@ -358,7 +358,7 @@
> 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.
>
> Modified: cfe/trunk/lib/Checker/BasicStore.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/BasicStore.cpp?rev=110784&r1=110783&r2=110784&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Checker/BasicStore.cpp (original)
> +++ cfe/trunk/lib/Checker/BasicStore.cpp Wed Aug 11 01:10:55 2010
> @@ -236,7 +236,7 @@
> 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 @@
>
> // 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 @@
> // 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 @@
> }
> }
>
> - 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);
> }
>
> Modified: cfe/trunk/lib/Checker/BugReporterVisitors.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/BugReporterVisitors.cpp?rev=110784&r1=110783&r2=110784&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Checker/BugReporterVisitors.cpp (original)
> +++ cfe/trunk/lib/Checker/BugReporterVisitors.cpp Wed Aug 11 01:10:55 2010
> @@ -143,10 +143,9 @@
>
> 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 @@
> 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;
> }
>
> Modified: cfe/trunk/lib/Checker/CStringChecker.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/CStringChecker.cpp?rev=110784&r1=110783&r2=110784&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Checker/CStringChecker.cpp (original)
> +++ cfe/trunk/lib/Checker/CStringChecker.cpp Wed Aug 11 01:10:55 2010
> @@ -145,7 +145,7 @@
> 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 @@
> 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;
>
> Modified: cfe/trunk/lib/Checker/CallAndMessageChecker.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/CallAndMessageChecker.cpp?rev=110784&r1=110783&r2=110784&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Checker/CallAndMessageChecker.cpp (original)
> +++ cfe/trunk/lib/Checker/CallAndMessageChecker.cpp Wed Aug 11 01:10:55 2010
> @@ -114,7 +114,7 @@
> : 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");
>
> Modified: cfe/trunk/lib/Checker/FlatStore.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/FlatStore.cpp?rev=110784&r1=110783&r2=110784&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Checker/FlatStore.cpp (original)
> +++ cfe/trunk/lib/Checker/FlatStore.cpp Wed Aug 11 01:10:55 2010
> @@ -175,7 +175,7 @@
> 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 @@
> 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);
> }
>
>
> Modified: cfe/trunk/lib/Checker/GRExprEngine.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/GRExprEngine.cpp?rev=110784&r1=110783&r2=110784&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Checker/GRExprEngine.cpp (original)
> +++ cfe/trunk/lib/Checker/GRExprEngine.cpp Wed Aug 11 01:10:55 2010
> @@ -1830,7 +1830,7 @@
> 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 @@
> // 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);
>
> Modified: cfe/trunk/lib/Checker/GRState.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/GRState.cpp?rev=110784&r1=110783&r2=110784&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Checker/GRState.cpp (original)
> +++ cfe/trunk/lib/Checker/GRState.cpp Wed Aug 11 01:10:55 2010
> @@ -88,7 +88,7 @@
> 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);
> }
>
> Modified: cfe/trunk/lib/Checker/MemRegion.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/MemRegion.cpp?rev=110784&r1=110783&r2=110784&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Checker/MemRegion.cpp (original)
> +++ cfe/trunk/lib/Checker/MemRegion.cpp Wed Aug 11 01:10:55 2010
> @@ -178,7 +178,7 @@
>
> 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 @@
> // 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 @@
> 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);
>
> Modified: cfe/trunk/lib/Checker/OSAtomicChecker.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/OSAtomicChecker.cpp?rev=110784&r1=110783&r2=110784&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Checker/OSAtomicChecker.cpp (original)
> +++ cfe/trunk/lib/Checker/OSAtomicChecker.cpp Wed Aug 11 01:10:55 2010
> @@ -110,7 +110,7 @@
> 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 @@
> // 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,
>
> Modified: cfe/trunk/lib/Checker/RegionStore.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/RegionStore.cpp?rev=110784&r1=110783&r2=110784&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Checker/RegionStore.cpp (original)
> +++ cfe/trunk/lib/Checker/RegionStore.cpp Wed Aug 11 01:10:55 2010
> @@ -663,7 +663,7 @@
> 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 @@
> 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 @@
> 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 @@
> // 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 @@
> // 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 @@
> // 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 @@
> 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 @@
> // 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::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 @@
>
> // 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 @@
> 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 @@
> 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 @@
> if (!Features.supportsFields())
> return store;
>
> - QualType T = R->getValueType(getContext());
> + QualType T = R->getValueType();
> assert(T->isStructureOrClassType());
>
> const RecordType* RT = T->getAs<RecordType>();
>
> Modified: cfe/trunk/lib/Checker/ReturnPointerRangeChecker.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/ReturnPointerRangeChecker.cpp?rev=110784&r1=110783&r2=110784&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Checker/ReturnPointerRangeChecker.cpp (original)
> +++ cfe/trunk/lib/Checker/ReturnPointerRangeChecker.cpp Wed Aug 11 01:10:55 2010
> @@ -66,7 +66,7 @@
>
> 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);
>
> Modified: cfe/trunk/lib/Checker/Store.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/Store.cpp?rev=110784&r1=110783&r2=110784&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Checker/Store.cpp (original)
> +++ cfe/trunk/lib/Checker/Store.cpp Wed Aug 11 01:10:55 2010
> @@ -83,7 +83,7 @@
> // 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 @@
> // 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 @@
>
> 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());
>
>
> Modified: cfe/trunk/lib/Checker/SymbolManager.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/SymbolManager.cpp?rev=110784&r1=110783&r2=110784&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Checker/SymbolManager.cpp (original)
> +++ cfe/trunk/lib/Checker/SymbolManager.cpp Wed Aug 11 01:10:55 2010
> @@ -191,7 +191,7 @@
> }
>
> QualType SymbolDerived::getType(ASTContext& Ctx) const {
> - return R->getValueType(Ctx);
> + return R->getValueType();
> }
>
> QualType SymbolExtent::getType(ASTContext& Ctx) const {
> @@ -199,7 +199,7 @@
> }
>
> QualType SymbolRegionValue::getType(ASTContext& C) const {
> - return R->getValueType(C);
> + return R->getValueType();
> }
>
> SymbolManager::~SymbolManager() {}
>
> Modified: cfe/trunk/lib/Checker/ValueManager.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/ValueManager.cpp?rev=110784&r1=110783&r2=110784&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Checker/ValueManager.cpp (original)
> +++ cfe/trunk/lib/Checker/ValueManager.cpp Wed Aug 11 01:10:55 2010
> @@ -72,7 +72,7 @@
>
> 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::getDerivedRegionValueSymbolVal(SymbolRef parentSymbol,
> const TypedRegion *R) {
> - QualType T = R->getValueType(R->getContext());
> + QualType T = R->getValueType();
>
> if (!SymbolManager::canSymbolicate(T))
> return UnknownVal();
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list