diff options
| author | Devin Coughlin <dcoughlin@apple.com> | 2016-03-28 23:55:58 +0000 |
|---|---|---|
| committer | Devin Coughlin <dcoughlin@apple.com> | 2016-03-28 23:55:58 +0000 |
| commit | 7646ebe6f9a56ddade39bbb5c685b72be948fa37 (patch) | |
| tree | 123b228ae60c75207e38cb2010b6c83c0a344db3 /clang/lib/Analysis | |
| parent | 6f4903d985e7829fa6208a469f78086d2e6ab280 (diff) | |
| download | bcm5719-llvm-7646ebe6f9a56ddade39bbb5c685b72be948fa37.tar.gz bcm5719-llvm-7646ebe6f9a56ddade39bbb5c685b72be948fa37.zip | |
[analyzer] Use BodyFarm-synthesized body even when actual body available.
Change body autosynthesis to use the BodyFarm-synthesized body even when
an actual body exists. This enables the analyzer to use the simpler,
analyzer-provided body to model the behavior of the function rather than trying
to understand the actual body. Further, this makes the analyzer robust against
changes in headers that expose the implementations of those bodies.
rdar://problem/25145950
llvm-svn: 264687
Diffstat (limited to 'clang/lib/Analysis')
| -rw-r--r-- | clang/lib/Analysis/AnalysisDeclContext.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/clang/lib/Analysis/AnalysisDeclContext.cpp b/clang/lib/Analysis/AnalysisDeclContext.cpp index fe8021b7966..6bbe8f86d48 100644 --- a/clang/lib/Analysis/AnalysisDeclContext.cpp +++ b/clang/lib/Analysis/AnalysisDeclContext.cpp @@ -94,19 +94,25 @@ Stmt *AnalysisDeclContext::getBody(bool &IsAutosynthesized) const { IsAutosynthesized = false; if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) { Stmt *Body = FD->getBody(); - if (!Body && Manager && Manager->synthesizeBodies()) { - Body = getBodyFarm(getASTContext(), Manager->Injector.get()).getBody(FD); - if (Body) + if (Manager && Manager->synthesizeBodies()) { + Stmt *SynthesizedBody = + getBodyFarm(getASTContext(), Manager->Injector.get()).getBody(FD); + if (SynthesizedBody) { + Body = SynthesizedBody; IsAutosynthesized = true; + } } return Body; } else if (const ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(D)) { Stmt *Body = MD->getBody(); - if (!Body && Manager && Manager->synthesizeBodies()) { - Body = getBodyFarm(getASTContext(), Manager->Injector.get()).getBody(MD); - if (Body) + if (Manager && Manager->synthesizeBodies()) { + Stmt *SynthesizedBody = + getBodyFarm(getASTContext(), Manager->Injector.get()).getBody(MD); + if (SynthesizedBody) { + Body = SynthesizedBody; IsAutosynthesized = true; + } } return Body; } else if (const BlockDecl *BD = dyn_cast<BlockDecl>(D)) |

