[cfe-commits] r84071 - in /cfe/trunk: include/clang/Analysis/PathSensitive/GRState.h include/clang/Analysis/PathSensitive/Store.h lib/Analysis/BasicStore.cpp lib/Analysis/GRExprEngine.cpp lib/Analysis/RegionStore.cpp
Ted Kremenek
kremenek at apple.com
Tue Oct 13 21:02:13 PDT 2009
Thanks Zhongxing!
On Oct 13, 2009, at 8:33 PM, Zhongxing Xu wrote:
> Author: zhongxingxu
> Date: Tue Oct 13 22:33:08 2009
> New Revision: 84071
>
> URL: http://llvm.org/viewvc/llvm-project?rev=84071&view=rev
> Log:
> * Remove unused GRState* parameter
> * Make all Base value the last argument.
>
> Modified:
> cfe/trunk/include/clang/Analysis/PathSensitive/GRState.h
> cfe/trunk/include/clang/Analysis/PathSensitive/Store.h
> cfe/trunk/lib/Analysis/BasicStore.cpp
> cfe/trunk/lib/Analysis/GRExprEngine.cpp
> cfe/trunk/lib/Analysis/RegionStore.cpp
>
> Modified: cfe/trunk/include/clang/Analysis/PathSensitive/GRState.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/GRState.h?rev=84071&r1=84070&r2=84071&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/include/clang/Analysis/PathSensitive/GRState.h
> (original)
> +++ cfe/trunk/include/clang/Analysis/PathSensitive/GRState.h Tue Oct
> 13 22:33:08 2009
> @@ -243,10 +243,10 @@
> SVal getLValue(const ObjCIvarDecl *decl, SVal base) const;
>
> /// Get the lvalue for a field reference.
> - SVal getLValue(SVal Base, const FieldDecl *decl) const;
> + SVal getLValue(const FieldDecl *decl, SVal Base) const;
>
> /// Get the lvalue for an array index.
> - SVal getLValue(QualType ElementType, SVal Base, SVal Idx) const;
> + SVal getLValue(QualType ElementType, SVal Idx, SVal Base) const;
>
> const llvm::APSInt *getSymVal(SymbolRef sym) const;
>
> @@ -623,27 +623,27 @@
>
> inline SVal GRState::getLValue(const VarDecl* VD,
> const LocationContext *LC) const {
> - return getStateManager().StoreMgr->getLValueVar(this, VD, LC);
> + return getStateManager().StoreMgr->getLValueVar(VD, LC);
> }
>
> inline SVal GRState::getLValue(const StringLiteral *literal) const {
> - return getStateManager().StoreMgr->getLValueString(this, literal);
> + return getStateManager().StoreMgr->getLValueString(literal);
> }
>
> inline SVal GRState::getLValue(const CompoundLiteralExpr *literal)
> const {
> - return getStateManager().StoreMgr->getLValueCompoundLiteral(this,
> literal);
> + return getStateManager().StoreMgr->getLValueCompoundLiteral
> (literal);
> }
>
> inline SVal GRState::getLValue(const ObjCIvarDecl *D, SVal Base)
> const {
> - return getStateManager().StoreMgr->getLValueIvar(this, D, Base);
> + return getStateManager().StoreMgr->getLValueIvar(D, Base);
> }
>
> -inline SVal GRState::getLValue(SVal Base, const FieldDecl* D) const {
> - return getStateManager().StoreMgr->getLValueField(this, Base, D);
> +inline SVal GRState::getLValue(const FieldDecl* D, SVal Base) const {
> + return getStateManager().StoreMgr->getLValueField(D, Base);
> }
>
> -inline SVal GRState::getLValue(QualType ElementType, SVal Base,
> SVal Idx) const{
> - return getStateManager().StoreMgr->getLValueElement(this,
> ElementType, Base, Idx);
> +inline SVal GRState::getLValue(QualType ElementType, SVal Idx, SVal
> Base) const{
> + return getStateManager().StoreMgr->getLValueElement(ElementType,
> Idx, Base);
> }
>
> inline const llvm::APSInt *GRState::getSymVal(SymbolRef sym) const {
>
> Modified: cfe/trunk/include/clang/Analysis/PathSensitive/Store.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/Store.h?rev=84071&r1=84070&r2=84071&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/include/clang/Analysis/PathSensitive/Store.h (original)
> +++ cfe/trunk/include/clang/Analysis/PathSensitive/Store.h Tue Oct
> 13 22:33:08 2009
> @@ -89,23 +89,17 @@
> // caller's responsibility to 'delete' the returned map.
> virtual SubRegionMap *getSubRegionMap(const GRState *state) = 0;
>
> - virtual SVal getLValueVar(const GRState *ST, const VarDecl *VD,
> - const LocationContext *LC) = 0;
> + virtual SVal getLValueVar(const VarDecl *VD, const
> LocationContext *LC) = 0;
>
> - virtual SVal getLValueString(const GRState *state,
> - const StringLiteral* sl) = 0;
> + virtual SVal getLValueString(const StringLiteral* sl) = 0;
>
> - virtual SVal getLValueCompoundLiteral(const GRState *state,
> - const CompoundLiteralExpr*
> cl) = 0;
> + virtual SVal getLValueCompoundLiteral(const CompoundLiteralExpr*
> cl) = 0;
>
> - virtual SVal getLValueIvar(const GRState *state, const
> ObjCIvarDecl* decl,
> - SVal base) = 0;
> + virtual SVal getLValueIvar(const ObjCIvarDecl* decl, SVal base) =
> 0;
>
> - virtual SVal getLValueField(const GRState *state, SVal base,
> - const FieldDecl* D) = 0;
> + virtual SVal getLValueField(const FieldDecl* D, SVal Base) = 0;
>
> - virtual SVal getLValueElement(const GRState *state, QualType
> elementType,
> - SVal base, SVal offset) = 0;
> + virtual SVal getLValueElement(QualType elementType, SVal offset,
> SVal Base)=0;
>
> // FIXME: Make out-of-line.
> virtual SVal getSizeInElements(const GRState *state, const
> MemRegion *region){
>
> Modified: cfe/trunk/lib/Analysis/BasicStore.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/BasicStore.cpp?rev=84071&r1=84070&r2=84071&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/lib/Analysis/BasicStore.cpp (original)
> +++ cfe/trunk/lib/Analysis/BasicStore.cpp Tue Oct 13 22:33:08 2009
> @@ -73,15 +73,12 @@
> return state;
> }
>
> - SVal getLValueVar(const GRState *state, const VarDecl *VD,
> - const LocationContext *LC);
> - SVal getLValueString(const GRState *state, const StringLiteral *S);
> - SVal getLValueCompoundLiteral(const GRState *state,
> - const CompoundLiteralExpr *CL);
> - SVal getLValueIvar(const GRState *state, const ObjCIvarDecl* D,
> SVal Base);
> - SVal getLValueField(const GRState *state, SVal Base, const
> FieldDecl *D);
> - SVal getLValueElement(const GRState *state, QualType elementType,
> - SVal Base, SVal Offset);
> + SVal getLValueVar(const VarDecl *VD, const LocationContext *LC);
> + SVal getLValueString(const StringLiteral *S);
> + SVal getLValueCompoundLiteral(const CompoundLiteralExpr *CL);
> + SVal getLValueIvar(const ObjCIvarDecl* D, SVal Base);
> + SVal getLValueField(const FieldDecl *D, SVal Base);
> + SVal getLValueElement(QualType elementType, SVal Offset, SVal
> Base);
>
> /// ArrayToPointer - Used by GRExprEngine::VistCast to handle
> implicit
> /// conversions between arrays and pointers.
> @@ -126,24 +123,20 @@
> return new BasicStoreManager(StMgr);
> }
>
> -SVal BasicStoreManager::getLValueVar(const GRState *state, const
> VarDecl* VD,
> +SVal BasicStoreManager::getLValueVar(const VarDecl* VD,
> const LocationContext *LC) {
> return ValMgr.makeLoc(MRMgr.getVarRegion(VD, LC));
> }
>
> -SVal BasicStoreManager::getLValueString(const GRState *state,
> - const StringLiteral* S) {
> +SVal BasicStoreManager::getLValueString(const StringLiteral* S) {
> return ValMgr.makeLoc(MRMgr.getStringRegion(S));
> }
>
> -SVal BasicStoreManager::getLValueCompoundLiteral(const GRState
> *state,
> - const
> CompoundLiteralExpr* CL){
> +SVal BasicStoreManager::getLValueCompoundLiteral(const
> CompoundLiteralExpr* CL){
> return ValMgr.makeLoc(MRMgr.getCompoundLiteralRegion(CL));
> }
>
> -SVal BasicStoreManager::getLValueIvar(const GRState *state,
> - const ObjCIvarDecl* D,
> - SVal Base) {
> +SVal BasicStoreManager::getLValueIvar(const ObjCIvarDecl* D, SVal
> Base) {
>
> if (Base.isUnknownOrUndef())
> return Base;
> @@ -158,8 +151,7 @@
> return UnknownVal();
> }
>
> -SVal BasicStoreManager::getLValueField(const GRState *state, SVal
> Base,
> - const FieldDecl* D) {
> +SVal BasicStoreManager::getLValueField(const FieldDecl* D, SVal
> Base) {
>
> if (Base.isUnknownOrUndef())
> return Base;
> @@ -190,9 +182,8 @@
> return ValMgr.makeLoc(MRMgr.getFieldRegion(D, BaseR));
> }
>
> -SVal BasicStoreManager::getLValueElement(const GRState *state,
> - QualType elementType,
> - SVal Base, SVal Offset) {
> +SVal BasicStoreManager::getLValueElement(QualType elementType,
> + SVal Offset, SVal Base) {
>
> if (Base.isUnknownOrUndef())
> return Base;
>
> Modified: cfe/trunk/lib/Analysis/GRExprEngine.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/GRExprEngine.cpp?rev=84071&r1=84070&r2=84071&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/lib/Analysis/GRExprEngine.cpp (original)
> +++ cfe/trunk/lib/Analysis/GRExprEngine.cpp Tue Oct 13 22:33:08 2009
> @@ -1042,8 +1042,8 @@
>
> for (ExplodedNodeSet::iterator I2=Tmp2.begin(),E2=Tmp2.end();I2!
> =E2; ++I2) {
> const GRState* state = GetState(*I2);
> - SVal V = state->getLValue(A->getType(), state->getSVal(Base),
> - state->getSVal(Idx));
> + SVal V = state->getLValue(A->getType(), state->getSVal(Idx),
> + state->getSVal(Base));
>
> if (asLValue)
> MakeNode(Dst, A, *I2, state->BindExpr(A, V),
> @@ -1075,7 +1075,7 @@
> // FIXME: Should we insert some assumption logic in here to
> determine
> // if "Base" is a valid piece of memory? Before we put this
> assumption
> // later when using FieldOffset lvals (which we no longer have).
> - SVal L = state->getLValue(state->getSVal(Base), Field);
> + SVal L = state->getLValue(Field, state->getSVal(Base));
>
> if (asLValue)
> MakeNode(Dst, M, *I, state->BindExpr(M, L),
>
> Modified: cfe/trunk/lib/Analysis/RegionStore.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/RegionStore.cpp?rev=84071&r1=84070&r2=84071&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/lib/Analysis/RegionStore.cpp (original)
> +++ cfe/trunk/lib/Analysis/RegionStore.cpp Tue Oct 13 22:33:08 2009
> @@ -220,28 +220,26 @@
> /// StringLiteral. Within RegionStore a StringLiteral has an
> /// associated StringRegion, and the lvalue of a StringLiteral is
> /// the lvalue of that region.
> - SVal getLValueString(const GRState *state, const StringLiteral* S);
> + SVal getLValueString(const StringLiteral* S);
>
> /// getLValueCompoundLiteral - Returns an SVal representing the
> /// lvalue of a compound literal. Within RegionStore a compound
> /// literal has an associated region, and the lvalue of the
> /// compound literal is the lvalue of that region.
> - SVal getLValueCompoundLiteral(const GRState *state, const
> CompoundLiteralExpr*);
> + SVal getLValueCompoundLiteral(const CompoundLiteralExpr*);
>
> /// getLValueVar - Returns an SVal that represents the lvalue of a
> /// variable. Within RegionStore a variable has an associated
> /// VarRegion, and the lvalue of the variable is the lvalue of
> that region.
> - SVal getLValueVar(const GRState *ST, const VarDecl *VD,
> - const LocationContext *LC);
> + SVal getLValueVar(const VarDecl *VD, const LocationContext *LC);
>
> - SVal getLValueIvar(const GRState *state, const ObjCIvarDecl* D,
> SVal Base);
> + SVal getLValueIvar(const ObjCIvarDecl* D, SVal Base);
>
> - SVal getLValueField(const GRState *state, SVal Base, const
> FieldDecl* D);
> + SVal getLValueField(const FieldDecl* D, SVal Base);
>
> - SVal getLValueFieldOrIvar(const GRState *state, SVal Base, const
> Decl* D);
> + SVal getLValueFieldOrIvar(const Decl* D, SVal Base);
>
> - SVal getLValueElement(const GRState *state, QualType elementType,
> - SVal Base, SVal Offset);
> + SVal getLValueElement(QualType elementType, SVal Offset, SVal
> Base);
>
>
> /// ArrayToPointer - Emulates the "decay" of an array to a pointer
> @@ -561,15 +559,14 @@
> /// StringLiteral. Within RegionStore a StringLiteral has an
> /// associated StringRegion, and the lvalue of a StringLiteral is the
> /// lvalue of that region.
> -SVal RegionStoreManager::getLValueString(const GRState *St,
> - const StringLiteral* S) {
> +SVal RegionStoreManager::getLValueString(const StringLiteral* S) {
> return loc::MemRegionVal(MRMgr.getStringRegion(S));
> }
>
> /// getLValueVar - Returns an SVal that represents the lvalue of a
> /// variable. Within RegionStore a variable has an associated
> /// VarRegion, and the lvalue of the variable is the lvalue of that
> region.
> -SVal RegionStoreManager::getLValueVar(const GRState *ST, const
> VarDecl *VD,
> +SVal RegionStoreManager::getLValueVar(const VarDecl *VD,
> const LocationContext *LC) {
> return loc::MemRegionVal(MRMgr.getVarRegion(VD, LC));
> }
> @@ -578,23 +575,20 @@
> /// of a compound literal. Within RegionStore a compound literal
> /// has an associated region, and the lvalue of the compound literal
> /// is the lvalue of that region.
> -SVal RegionStoreManager::getLValueCompoundLiteral(const GRState *St,
> - const
> CompoundLiteralExpr* CL) {
> +SVal
> +RegionStoreManager::getLValueCompoundLiteral(const
> CompoundLiteralExpr* CL) {
> return loc::MemRegionVal(MRMgr.getCompoundLiteralRegion(CL));
> }
>
> -SVal RegionStoreManager::getLValueIvar(const GRState *St, const
> ObjCIvarDecl* D,
> - SVal Base) {
> - return getLValueFieldOrIvar(St, Base, D);
> +SVal RegionStoreManager::getLValueIvar(const ObjCIvarDecl* D, SVal
> Base) {
> + return getLValueFieldOrIvar(D, Base);
> }
>
> -SVal RegionStoreManager::getLValueField(const GRState *St, SVal Base,
> - const FieldDecl* D) {
> - return getLValueFieldOrIvar(St, Base, D);
> +SVal RegionStoreManager::getLValueField(const FieldDecl* D, SVal
> Base) {
> + return getLValueFieldOrIvar(D, Base);
> }
>
> -SVal RegionStoreManager::getLValueFieldOrIvar(const GRState *St,
> SVal Base,
> - const Decl* D) {
> +SVal RegionStoreManager::getLValueFieldOrIvar(const Decl* D, SVal
> Base) {
> if (Base.isUnknownOrUndef())
> return Base;
>
> @@ -630,9 +624,8 @@
> return loc::MemRegionVal(MRMgr.getFieldRegion(cast<FieldDecl>(D),
> BaseR));
> }
>
> -SVal RegionStoreManager::getLValueElement(const GRState *St,
> - QualType elementType,
> - SVal Base, SVal Offset) {
> +SVal RegionStoreManager::getLValueElement(QualType elementType,
> SVal Offset,
> + SVal Base) {
>
> // If the base is an unknown or undefined value, just return it
> back.
> // FIXME: For absolute pointer addresses, we just return that
> value back as
>
>
> _______________________________________________
> 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