diff options
author | Anna Zaks <ganna@apple.com> | 2013-02-02 00:30:04 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2013-02-02 00:30:04 +0000 |
commit | 453cb859a3c8dcafe79ae840dfc35ff8eae1b4b3 (patch) | |
tree | 984e38c6799e9ed6ebfa8f4a72590c7719d8db56 /lib/Analysis/AnalysisDeclContext.cpp | |
parent | a5245a51593aa45c2a5ef38a10861697d29c7789 (diff) |
[analyzer] Always inline functions with bodies generated by BodyFarm.
Inlining these functions is essential for correctness. We often have
cases where we do not inline calls. For example, the shallow mode and
when reanalyzing previously inlined ObjC methods as top level.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174245 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/AnalysisDeclContext.cpp')
-rw-r--r-- | lib/Analysis/AnalysisDeclContext.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/Analysis/AnalysisDeclContext.cpp b/lib/Analysis/AnalysisDeclContext.cpp index bcaad9b0db..20cc3d55f3 100644 --- a/lib/Analysis/AnalysisDeclContext.cpp +++ b/lib/Analysis/AnalysisDeclContext.cpp @@ -86,11 +86,13 @@ static BodyFarm &getBodyFarm(ASTContext &C) { return *BF; } -Stmt *AnalysisDeclContext::getBody() const { +Stmt *AnalysisDeclContext::getBody(bool &IsAutosynthesized) const { if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) { Stmt *Body = FD->getBody(); - if (!Body && Manager && Manager->synthesizeBodies()) + if (!Body && Manager && Manager->synthesizeBodies()) { + IsAutosynthesized = true; return getBodyFarm(getASTContext()).getBody(FD); + } return Body; } else if (const ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(D)) @@ -104,6 +106,17 @@ Stmt *AnalysisDeclContext::getBody() const { llvm_unreachable("unknown code decl"); } +Stmt *AnalysisDeclContext::getBody() const { + bool Tmp; + return getBody(Tmp); +} + +bool AnalysisDeclContext::isBodyAutosynthesized() const { + bool Tmp; + getBody(Tmp); + return Tmp; +} + const ImplicitParamDecl *AnalysisDeclContext::getSelfDecl() const { if (const ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(D)) return MD->getSelfDecl(); |