mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-09 10:55:03 +00:00
[Analysis] Use unique_ptr in AnalyaisDeclContextManager's ContextMap.
Reviewers: timshen Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25426 llvm-svn: 283774
This commit is contained in:
parent
82380d8eb4
commit
5cb35e1676
@ -406,7 +406,8 @@ private:
|
||||
};
|
||||
|
||||
class AnalysisDeclContextManager {
|
||||
typedef llvm::DenseMap<const Decl*, AnalysisDeclContext*> ContextMap;
|
||||
typedef llvm::DenseMap<const Decl *, std::unique_ptr<AnalysisDeclContext>>
|
||||
ContextMap;
|
||||
|
||||
ContextMap Contexts;
|
||||
LocationContextManager LocContexts;
|
||||
|
@ -81,9 +81,7 @@ AnalysisDeclContextManager::AnalysisDeclContextManager(bool useUnoptimizedCFG,
|
||||
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 @@ AnalysisDeclContext *AnalysisDeclContextManager::getContext(const Decl *D) {
|
||||
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 @@ AnalysisDeclContext::~AnalysisDeclContext() {
|
||||
}
|
||||
}
|
||||
|
||||
AnalysisDeclContextManager::~AnalysisDeclContextManager() {
|
||||
llvm::DeleteContainerSeconds(Contexts);
|
||||
}
|
||||
AnalysisDeclContextManager::~AnalysisDeclContextManager() {}
|
||||
|
||||
LocationContext::~LocationContext() {}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user