summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorGeorge Karpenkov <ekarpenkov@apple.com>2017-11-01 01:36:01 +0000
committerGeorge Karpenkov <ekarpenkov@apple.com>2017-11-01 01:36:01 +0000
commited017b634cc2fb6761dc292cb05f01cd12b0164f (patch)
treedaa99596e866bb83d7c7855cbef822a4284c099b /clang/lib
parent13e6e61bae9545bdd172ae0a7ab6828d7b82b229 (diff)
downloadbcm5719-llvm-ed017b634cc2fb6761dc292cb05f01cd12b0164f.tar.gz
bcm5719-llvm-ed017b634cc2fb6761dc292cb05f01cd12b0164f.zip
[Analyzer] Use value storage for BodyFarm
Differential Revision: https://reviews.llvm.org/D39428 llvm-svn: 317065
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Analysis/AnalysisDeclContext.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/clang/lib/Analysis/AnalysisDeclContext.cpp b/clang/lib/Analysis/AnalysisDeclContext.cpp
index c7c720eb77f..f54e7c1654a 100644
--- a/clang/lib/Analysis/AnalysisDeclContext.cpp
+++ b/clang/lib/Analysis/AnalysisDeclContext.cpp
@@ -68,7 +68,8 @@ AnalysisDeclContextManager::AnalysisDeclContextManager(
bool addInitializers, bool addTemporaryDtors, bool addLifetime,
bool addLoopExit, bool synthesizeBodies, bool addStaticInitBranch,
bool addCXXNewAllocator, CodeInjector *injector)
- : ASTCtx(ASTCtx), Injector(injector), SynthesizeBodies(synthesizeBodies) {
+ : ASTCtx(ASTCtx), Injector(injector), FunctionBodyFarm(ASTCtx, injector),
+ SynthesizeBodies(synthesizeBodies) {
cfgBuildOptions.PruneTriviallyFalseEdges = !useUnoptimizedCFG;
cfgBuildOptions.AddImplicitDtors = addImplicitDtors;
cfgBuildOptions.AddInitializers = addInitializers;
@@ -88,7 +89,7 @@ Stmt *AnalysisDeclContext::getBody(bool &IsAutosynthesized) const {
if (auto *CoroBody = dyn_cast_or_null<CoroutineBodyStmt>(Body))
Body = CoroBody->getBody();
if (Manager && Manager->synthesizeBodies()) {
- Stmt *SynthesizedBody = Manager->getBodyFarm()->getBody(FD);
+ Stmt *SynthesizedBody = Manager->getBodyFarm().getBody(FD);
if (SynthesizedBody) {
Body = SynthesizedBody;
IsAutosynthesized = true;
@@ -99,7 +100,7 @@ Stmt *AnalysisDeclContext::getBody(bool &IsAutosynthesized) const {
else if (const ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(D)) {
Stmt *Body = MD->getBody();
if (Manager && Manager->synthesizeBodies()) {
- Stmt *SynthesizedBody = Manager->getBodyFarm()->getBody(MD);
+ Stmt *SynthesizedBody = Manager->getBodyFarm().getBody(MD);
if (SynthesizedBody) {
Body = SynthesizedBody;
IsAutosynthesized = true;
@@ -304,11 +305,7 @@ AnalysisDeclContext *AnalysisDeclContextManager::getContext(const Decl *D) {
return AC.get();
}
-BodyFarm *AnalysisDeclContextManager::getBodyFarm() {
- if (!FunctionBodyFarm)
- FunctionBodyFarm = llvm::make_unique<BodyFarm>(ASTCtx, Injector.get());
- return FunctionBodyFarm.get();
-}
+BodyFarm &AnalysisDeclContextManager::getBodyFarm() { return FunctionBodyFarm; }
const StackFrameContext *
AnalysisDeclContext::getStackFrame(LocationContext const *Parent, const Stmt *S,
OpenPOWER on IntegriCloud