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 | 00c69a597cd9ca62c392f8e09c2698e2740d7241 (patch) | |
| tree | 37f66222837410d0e4d507404a79b21f049891ed /clang/lib/StaticAnalyzer | |
| parent | e9eb13aba3f684947962af9fc2ae0bc1e59a9f85 (diff) | |
| download | bcm5719-llvm-00c69a597cd9ca62c392f8e09c2698e2740d7241.tar.gz bcm5719-llvm-00c69a597cd9ca62c392f8e09c2698e2740d7241.zip | |
[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.
llvm-svn: 174245
Diffstat (limited to 'clang/lib/StaticAnalyzer')
| -rw-r--r-- | clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp index 2c1f6c1d8f9..1d006b09ccb 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp @@ -733,13 +733,27 @@ void ExprEngine::conservativeEvalCall(const CallEvent &Call, NodeBuilder &Bldr, Bldr.generateNode(Call.getProgramPoint(), State, Pred); } +static bool isEssentialToInline(const CallEvent &Call) { + const Decl *D = Call.getDecl(); + if (D) { + AnalysisDeclContext *AD = + Call.getLocationContext()->getAnalysisDeclContext()-> + getManager()->getContext(D); + + // The auto-synthesized bodies are essential to inline as they are + // usually small and commonly used. + return AD->isBodyAutosynthesized(); + } + return false; +} + void ExprEngine::defaultEvalCall(NodeBuilder &Bldr, ExplodedNode *Pred, const CallEvent &CallTemplate) { // Make sure we have the most recent state attached to the call. ProgramStateRef State = Pred->getState(); CallEventRef<> Call = CallTemplate.cloneWithState(State); - if (HowToInline == Inline_None) { + if (HowToInline == Inline_None && !isEssentialToInline(CallTemplate)) { conservativeEvalCall(*Call, Bldr, Pred, State); return; } |

