r316536 - [Analyzer] Store BodyFarm in std::unique_ptr
George Karpenkov via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 24 16:53:19 PDT 2017
Author: george.karpenkov
Date: Tue Oct 24 16:53:19 2017
New Revision: 316536
URL: http://llvm.org/viewvc/llvm-project?rev=316536&view=rev
Log:
[Analyzer] Store BodyFarm in std::unique_ptr
Differential Revision: https://reviews.llvm.org/D39220
Modified:
cfe/trunk/include/clang/Analysis/AnalysisDeclContext.h
cfe/trunk/lib/Analysis/AnalysisDeclContext.cpp
Modified: cfe/trunk/include/clang/Analysis/AnalysisDeclContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/AnalysisDeclContext.h?rev=316536&r1=316535&r2=316536&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/AnalysisDeclContext.h (original)
+++ cfe/trunk/include/clang/Analysis/AnalysisDeclContext.h Tue Oct 24 16:53:19 2017
@@ -421,7 +421,7 @@ class AnalysisDeclContextManager {
/// Pointer to a factory for creating and caching implementations for common
/// methods during the analysis.
- BodyFarm *BdyFrm = nullptr;
+ std::unique_ptr<BodyFarm> BdyFrm;
/// Flag to indicate whether or not bodies should be synthesized
/// for well-known functions.
@@ -438,8 +438,6 @@ public:
bool addCXXNewAllocator = true,
CodeInjector *injector = nullptr);
- ~AnalysisDeclContextManager();
-
AnalysisDeclContext *getContext(const Decl *D);
bool getUseUnoptimizedCFG() const {
Modified: cfe/trunk/lib/Analysis/AnalysisDeclContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/AnalysisDeclContext.cpp?rev=316536&r1=316535&r2=316536&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/AnalysisDeclContext.cpp (original)
+++ cfe/trunk/lib/Analysis/AnalysisDeclContext.cpp Tue Oct 24 16:53:19 2017
@@ -306,8 +306,8 @@ AnalysisDeclContext *AnalysisDeclContext
BodyFarm *AnalysisDeclContextManager::getBodyFarm() {
if (!BdyFrm)
- BdyFrm = new BodyFarm(ASTCtx, Injector.get());
- return BdyFrm;
+ BdyFrm = llvm::make_unique<BodyFarm>(ASTCtx, Injector.get());
+ return BdyFrm.get();
}
const StackFrameContext *
@@ -603,11 +603,6 @@ AnalysisDeclContext::~AnalysisDeclContex
}
}
-AnalysisDeclContextManager::~AnalysisDeclContextManager() {
- if (BdyFrm)
- delete BdyFrm;
-}
-
LocationContext::~LocationContext() {}
LocationContextManager::~LocationContextManager() {
More information about the cfe-commits
mailing list