jlebar created this revision. jlebar added a reviewer: timshen. jlebar added a subscriber: cfe-commits.
https://reviews.llvm.org/D25426 Files: clang/include/clang/Analysis/AnalysisContext.h clang/lib/Analysis/AnalysisDeclContext.cpp Index: clang/lib/Analysis/AnalysisDeclContext.cpp =================================================================== --- clang/lib/Analysis/AnalysisDeclContext.cpp +++ clang/lib/Analysis/AnalysisDeclContext.cpp @@ -81,9 +81,7 @@ cfgBuildOptions.AddCXXNewAllocator = addCXXNewAllocator; } -void AnalysisDeclContextManager::clear() { - llvm::DeleteContainerSeconds(Contexts); -} +void AnalysisDeclContextManager::clear() { Contexts.clear(); } static BodyFarm &getBodyFarm(ASTContext &C, CodeInjector *injector = nullptr) { static BodyFarm *BF = new BodyFarm(C, injector); @@ -307,10 +305,10 @@ D = FD; } - AnalysisDeclContext *&AC = Contexts[D]; + std::unique_ptr<AnalysisDeclContext> &AC = Contexts[D]; if (!AC) - AC = new AnalysisDeclContext(this, D, cfgBuildOptions); - return AC; + AC = llvm::make_unique<AnalysisDeclContext>(this, D, cfgBuildOptions); + return AC.get(); } const StackFrameContext * @@ -606,9 +604,7 @@ } } -AnalysisDeclContextManager::~AnalysisDeclContextManager() { - llvm::DeleteContainerSeconds(Contexts); -} +AnalysisDeclContextManager::~AnalysisDeclContextManager() {} LocationContext::~LocationContext() {} Index: clang/include/clang/Analysis/AnalysisContext.h =================================================================== --- clang/include/clang/Analysis/AnalysisContext.h +++ clang/include/clang/Analysis/AnalysisContext.h @@ -406,7 +406,8 @@ }; class AnalysisDeclContextManager { - typedef llvm::DenseMap<const Decl*, AnalysisDeclContext*> ContextMap; + typedef llvm::DenseMap<const Decl *, std::unique_ptr<AnalysisDeclContext>> + ContextMap; ContextMap Contexts; LocationContextManager LocContexts;
Index: clang/lib/Analysis/AnalysisDeclContext.cpp =================================================================== --- clang/lib/Analysis/AnalysisDeclContext.cpp +++ clang/lib/Analysis/AnalysisDeclContext.cpp @@ -81,9 +81,7 @@ cfgBuildOptions.AddCXXNewAllocator = addCXXNewAllocator; } -void AnalysisDeclContextManager::clear() { - llvm::DeleteContainerSeconds(Contexts); -} +void AnalysisDeclContextManager::clear() { Contexts.clear(); } static BodyFarm &getBodyFarm(ASTContext &C, CodeInjector *injector = nullptr) { static BodyFarm *BF = new BodyFarm(C, injector); @@ -307,10 +305,10 @@ D = FD; } - AnalysisDeclContext *&AC = Contexts[D]; + std::unique_ptr<AnalysisDeclContext> &AC = Contexts[D]; if (!AC) - AC = new AnalysisDeclContext(this, D, cfgBuildOptions); - return AC; + AC = llvm::make_unique<AnalysisDeclContext>(this, D, cfgBuildOptions); + return AC.get(); } const StackFrameContext * @@ -606,9 +604,7 @@ } } -AnalysisDeclContextManager::~AnalysisDeclContextManager() { - llvm::DeleteContainerSeconds(Contexts); -} +AnalysisDeclContextManager::~AnalysisDeclContextManager() {} LocationContext::~LocationContext() {} Index: clang/include/clang/Analysis/AnalysisContext.h =================================================================== --- clang/include/clang/Analysis/AnalysisContext.h +++ clang/include/clang/Analysis/AnalysisContext.h @@ -406,7 +406,8 @@ }; class AnalysisDeclContextManager { - typedef llvm::DenseMap<const Decl*, AnalysisDeclContext*> ContextMap; + typedef llvm::DenseMap<const Decl *, std::unique_ptr<AnalysisDeclContext>> + ContextMap; ContextMap Contexts; LocationContextManager LocContexts;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits