aboutsummaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer/Core
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2013-02-02 00:30:04 +0000
committerAnna Zaks <ganna@apple.com>2013-02-02 00:30:04 +0000
commit453cb859a3c8dcafe79ae840dfc35ff8eae1b4b3 (patch)
tree984e38c6799e9ed6ebfa8f4a72590c7719d8db56 /lib/StaticAnalyzer/Core
parenta5245a51593aa45c2a5ef38a10861697d29c7789 (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/StaticAnalyzer/Core')
-rw-r--r--lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp b/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
index 2c1f6c1d8f..1d006b09cc 100644
--- a/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
+++ b/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;
}