From: Ted Kremenek Date: Tue, 3 Mar 2009 19:02:42 +0000 (+0000) Subject: Don't use std::auto_ptr with getSubRegionMap(). X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=14453bf723c025034823e4d4005a98ee176753a0;p=clang Don't use std::auto_ptr with getSubRegionMap(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65957 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Analysis/PathSensitive/Store.h b/include/clang/Analysis/PathSensitive/Store.h index ac0625dd01..4514de752d 100644 --- a/include/clang/Analysis/PathSensitive/Store.h +++ b/include/clang/Analysis/PathSensitive/Store.h @@ -81,8 +81,9 @@ public: MemRegionManager& getRegionManager() { return MRMgr; } /// getSubRegionMap - Returns an opaque map object that clients can query - /// to get the subregions of a given MemRegion object. - virtual std::auto_ptr getSubRegionMap(const GRState *state) = 0; + /// to get the subregions of a given MemRegion object. It is the + // caller's responsibility to 'delete' the returned map. + virtual SubRegionMap* getSubRegionMap(const GRState *state) = 0; virtual SVal getLValueVar(const GRState* St, const VarDecl* VD) = 0; diff --git a/lib/Analysis/BasicStore.cpp b/lib/Analysis/BasicStore.cpp index 35c6652fe5..2e619baf2f 100644 --- a/lib/Analysis/BasicStore.cpp +++ b/lib/Analysis/BasicStore.cpp @@ -47,8 +47,8 @@ public: ~BasicStoreManager() {} - std::auto_ptr getSubRegionMap(const GRState *state) { - return std::auto_ptr(new BasicStoreSubRegionMap()); + SubRegionMap* getSubRegionMap(const GRState *state) { + return new BasicStoreSubRegionMap(); } SVal Retrieve(const GRState *state, Loc loc, QualType T = QualType()); diff --git a/lib/Analysis/GRState.cpp b/lib/Analysis/GRState.cpp index 28e819085a..eb6b1b5cfa 100644 --- a/lib/Analysis/GRState.cpp +++ b/lib/Analysis/GRState.cpp @@ -278,7 +278,7 @@ bool ScanReachableSymbols::scan(const MemRegion *R) { // Now look at the subregions. if (!SRM.get()) - SRM.reset(state.getManager().getStoreManager().getSubRegionMap(state).get()); + SRM.reset(state.getManager().getStoreManager().getSubRegionMap(state)); return SRM->iterSubRegions(R, *this); } diff --git a/lib/Analysis/RegionStore.cpp b/lib/Analysis/RegionStore.cpp index 6238ff20ed..f3d1f0a44f 100644 --- a/lib/Analysis/RegionStore.cpp +++ b/lib/Analysis/RegionStore.cpp @@ -161,7 +161,7 @@ public: MemRegionManager& getRegionManager() { return MRMgr; } - std::auto_ptr getSubRegionMap(const GRState *state); + SubRegionMap* getSubRegionMap(const GRState *state); const GRState* BindCompoundLiteral(const GRState* St, const CompoundLiteralExpr* CL, SVal V); @@ -303,8 +303,7 @@ StoreManager* clang::CreateRegionStoreManager(GRStateManager& StMgr) { return new RegionStoreManager(StMgr); } -std::auto_ptr -RegionStoreManager::getSubRegionMap(const GRState *state) { +SubRegionMap* RegionStoreManager::getSubRegionMap(const GRState *state) { RegionBindingsTy B = GetRegionBindings(state->getStore()); RegionStoreSubRegionMap *M = new RegionStoreSubRegionMap(); @@ -313,7 +312,7 @@ RegionStoreManager::getSubRegionMap(const GRState *state) { M->add(R->getSuperRegion(), R); } - return std::auto_ptr(M); + return M; } /// getLValueString - Returns an SVal representing the lvalue of a