From 6960f6e53b0d9a69a460c99ec199470271ff9603 Mon Sep 17 00:00:00 2001 From: Anna Zaks Date: Thu, 9 Aug 2012 21:02:41 +0000 Subject: [PATCH] [analyzer] Clarify the values in Dyn. Dispatch Bifurcation map. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161616 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../Core/ExprEngineCallAndReturn.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp b/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp index 2b0ac1d967..37c48d406e 100644 --- a/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp +++ b/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp @@ -287,13 +287,17 @@ bool ExprEngine::shouldInlineDecl(const Decl *D, ExplodedNode *Pred) { /// consider this region's information precise or not along the given path. namespace clang { namespace ento { +enum DynamicDispatchMode { DynamicDispatchModeInlined = 1, + DynamicDispatchModeConservative }; + struct DynamicDispatchBifurcationMap {}; typedef llvm::ImmutableMap DynamicDispatchBifur; + unsigned int> DynamicDispatchBifur; template<> struct ProgramStateTrait : public ProgramStatePartialTrait { static void *GDMIndex() { static int index; return &index; } }; + }} bool ExprEngine::inlineCall(const CallEvent &Call, const Decl *D, @@ -575,10 +579,11 @@ void ExprEngine::BifurcateCall(const MemRegion *BifurReg, // Check if we've performed the split already - note, we only want // to split the path once per memory region. ProgramStateRef State = Pred->getState(); - const int *BState = State->get(BifurReg); + const unsigned int *BState = + State->get(BifurReg); if (BState) { // If we are on "inline path", keep inlining if possible. - if (*BState == true) + if (*BState == DynamicDispatchModeInlined) if (inlineCall(Call, D, Bldr, Pred, State)) return; // If inline failed, or we are on the path where we assume we @@ -591,11 +596,13 @@ void ExprEngine::BifurcateCall(const MemRegion *BifurReg, // If we got here, this is the first time we process a message to this // region, so split the path. ProgramStateRef IState = - State->set(BifurReg, true); + State->set(BifurReg, + DynamicDispatchModeInlined); inlineCall(Call, D, Bldr, Pred, IState); ProgramStateRef NoIState = - State->set(BifurReg, false); + State->set(BifurReg, + DynamicDispatchModeConservative); conservativeEvalCall(Call, Bldr, Pred, NoIState); NumOfDynamicDispatchPathSplits++; -- 2.40.0