ExprEngine.h revision 1655bcd052a67a3050fc55df8ecce57342352e68
1//===-- ExprEngine.h - Path-Sensitive Expression-Level Dataflow ---*- C++ -*-=//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10//  This file defines a meta-engine for path-sensitive dataflow analysis that
11//  is built on CoreEngine, but provides the boilerplate to execute transfer
12//  functions and build the ExplodedGraph at the expression level.
13//
14//===----------------------------------------------------------------------===//
15
16#ifndef LLVM_CLANG_GR_EXPRENGINE
17#define LLVM_CLANG_GR_EXPRENGINE
18
19#include "clang/AST/Expr.h"
20#include "clang/AST/Type.h"
21#include "clang/Analysis/DomainSpecific/ObjCNoReturn.h"
22#include "clang/StaticAnalyzer/Core/BugReporter/BugReporter.h"
23#include "clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h"
24#include "clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h"
25#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
26#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
27#include "clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h"
28
29namespace clang {
30
31class AnalysisDeclContextManager;
32class CXXCatchStmt;
33class CXXConstructExpr;
34class CXXDeleteExpr;
35class CXXNewExpr;
36class CXXTemporaryObjectExpr;
37class CXXThisExpr;
38class MaterializeTemporaryExpr;
39class ObjCAtSynchronizedStmt;
40class ObjCForCollectionStmt;
41
42namespace ento {
43
44class AnalysisManager;
45class CallEvent;
46class SimpleCall;
47
48class ExprEngine : public SubEngine {
49public:
50  /// The modes of inlining.
51  enum InliningModes {
52    /// Do not inline any of the callees.
53    Inline_None = 0,
54    /// Inline all callees.
55    Inline_All = 0x1
56  } ;
57
58private:
59  AnalysisManager &AMgr;
60
61  AnalysisDeclContextManager &AnalysisDeclContexts;
62
63  CoreEngine Engine;
64
65  /// G - the simulation graph.
66  ExplodedGraph& G;
67
68  /// StateMgr - Object that manages the data for all created states.
69  ProgramStateManager StateMgr;
70
71  /// SymMgr - Object that manages the symbol information.
72  SymbolManager& SymMgr;
73
74  /// svalBuilder - SValBuilder object that creates SVals from expressions.
75  SValBuilder &svalBuilder;
76
77  unsigned int currStmtIdx;
78  const NodeBuilderContext *currBldrCtx;
79
80  /// Helper object to determine if an Objective-C message expression
81  /// implicitly never returns.
82  ObjCNoReturn ObjCNoRet;
83
84  /// Whether or not GC is enabled in this analysis.
85  bool ObjCGCEnabled;
86
87  /// The BugReporter associated with this engine.  It is important that
88  ///  this object be placed at the very end of member variables so that its
89  ///  destructor is called before the rest of the ExprEngine is destroyed.
90  GRBugReporter BR;
91
92  /// The functions which have been analyzed through inlining. This is owned by
93  /// AnalysisConsumer. It can be null.
94  SetOfConstDecls *VisitedCallees;
95
96  /// The flag, which specifies the mode of inlining for the engine.
97  InliningModes HowToInline;
98
99public:
100  ExprEngine(AnalysisManager &mgr, bool gcEnabled,
101             SetOfConstDecls *VisitedCalleesIn,
102             FunctionSummariesTy *FS,
103             InliningModes HowToInlineIn);
104
105  ~ExprEngine();
106
107  /// Returns true if there is still simulation state on the worklist.
108  bool ExecuteWorkList(const LocationContext *L, unsigned Steps = 150000) {
109    return Engine.ExecuteWorkList(L, Steps, 0);
110  }
111
112  /// Execute the work list with an initial state. Nodes that reaches the exit
113  /// of the function are added into the Dst set, which represent the exit
114  /// state of the function call. Returns true if there is still simulation
115  /// state on the worklist.
116  bool ExecuteWorkListWithInitialState(const LocationContext *L, unsigned Steps,
117                                       ProgramStateRef InitState,
118                                       ExplodedNodeSet &Dst) {
119    return Engine.ExecuteWorkListWithInitialState(L, Steps, InitState, Dst);
120  }
121
122  /// getContext - Return the ASTContext associated with this analysis.
123  ASTContext &getContext() const { return AMgr.getASTContext(); }
124
125  virtual AnalysisManager &getAnalysisManager() { return AMgr; }
126
127  CheckerManager &getCheckerManager() const {
128    return *AMgr.getCheckerManager();
129  }
130
131  SValBuilder &getSValBuilder() { return svalBuilder; }
132
133  BugReporter& getBugReporter() { return BR; }
134
135  const NodeBuilderContext &getBuilderContext() {
136    assert(currBldrCtx);
137    return *currBldrCtx;
138  }
139
140  bool isObjCGCEnabled() { return ObjCGCEnabled; }
141
142  const Stmt *getStmt() const;
143
144  void GenerateAutoTransition(ExplodedNode *N);
145  void enqueueEndOfPath(ExplodedNodeSet &S);
146  void GenerateCallExitNode(ExplodedNode *N);
147
148  /// ViewGraph - Visualize the ExplodedGraph created by executing the
149  ///  simulation.
150  void ViewGraph(bool trim = false);
151
152  void ViewGraph(ExplodedNode** Beg, ExplodedNode** End);
153
154  /// getInitialState - Return the initial state used for the root vertex
155  ///  in the ExplodedGraph.
156  ProgramStateRef getInitialState(const LocationContext *InitLoc);
157
158  ExplodedGraph& getGraph() { return G; }
159  const ExplodedGraph& getGraph() const { return G; }
160
161  /// \brief Run the analyzer's garbage collection - remove dead symbols and
162  /// bindings from the state.
163  ///
164  /// Checkers can participate in this process with two callbacks:
165  /// \c checkLiveSymbols and \c checkDeadSymbols. See the CheckerDocumentation
166  /// class for more information.
167  ///
168  /// \param Node The predecessor node, from which the processing should start.
169  /// \param Out The returned set of output nodes.
170  /// \param ReferenceStmt The statement which is about to be processed.
171  ///        Everything needed for this statement should be considered live.
172  ///        A null statement means that everything in child LocationContexts
173  ///        is dead.
174  /// \param LC The location context of the \p ReferenceStmt. A null location
175  ///        context means that we have reached the end of analysis and that
176  ///        all statements and local variables should be considered dead.
177  /// \param DiagnosticStmt Used as a location for any warnings that should
178  ///        occur while removing the dead (e.g. leaks). By default, the
179  ///        \p ReferenceStmt is used.
180  /// \param K Denotes whether this is a pre- or post-statement purge. This
181  ///        must only be ProgramPoint::PostStmtPurgeDeadSymbolsKind if an
182  ///        entire location context is being cleared, in which case the
183  ///        \p ReferenceStmt must either be a ReturnStmt or \c NULL. Otherwise,
184  ///        it must be ProgramPoint::PreStmtPurgeDeadSymbolsKind (the default)
185  ///        and \p ReferenceStmt must be valid (non-null).
186  void removeDead(ExplodedNode *Node, ExplodedNodeSet &Out,
187            const Stmt *ReferenceStmt, const LocationContext *LC,
188            const Stmt *DiagnosticStmt = 0,
189            ProgramPoint::Kind K = ProgramPoint::PreStmtPurgeDeadSymbolsKind);
190
191  /// processCFGElement - Called by CoreEngine. Used to generate new successor
192  ///  nodes by processing the 'effects' of a CFG element.
193  void processCFGElement(const CFGElement E, ExplodedNode *Pred,
194                         unsigned StmtIdx, NodeBuilderContext *Ctx);
195
196  void ProcessStmt(const CFGStmt S, ExplodedNode *Pred);
197
198  void ProcessInitializer(const CFGInitializer I, ExplodedNode *Pred);
199
200  void ProcessImplicitDtor(const CFGImplicitDtor D, ExplodedNode *Pred);
201
202  void ProcessAutomaticObjDtor(const CFGAutomaticObjDtor D,
203                               ExplodedNode *Pred, ExplodedNodeSet &Dst);
204  void ProcessBaseDtor(const CFGBaseDtor D,
205                       ExplodedNode *Pred, ExplodedNodeSet &Dst);
206  void ProcessMemberDtor(const CFGMemberDtor D,
207                         ExplodedNode *Pred, ExplodedNodeSet &Dst);
208  void ProcessTemporaryDtor(const CFGTemporaryDtor D,
209                            ExplodedNode *Pred, ExplodedNodeSet &Dst);
210
211  /// Called by CoreEngine when processing the entrance of a CFGBlock.
212  virtual void processCFGBlockEntrance(const BlockEdge &L,
213                                       NodeBuilderWithSinks &nodeBuilder,
214                                       ExplodedNode *Pred);
215
216  /// ProcessBranch - Called by CoreEngine.  Used to generate successor
217  ///  nodes by processing the 'effects' of a branch condition.
218  void processBranch(const Stmt *Condition, const Stmt *Term,
219                     NodeBuilderContext& BuilderCtx,
220                     ExplodedNode *Pred,
221                     ExplodedNodeSet &Dst,
222                     const CFGBlock *DstT,
223                     const CFGBlock *DstF);
224
225  /// processIndirectGoto - Called by CoreEngine.  Used to generate successor
226  ///  nodes by processing the 'effects' of a computed goto jump.
227  void processIndirectGoto(IndirectGotoNodeBuilder& builder);
228
229  /// ProcessSwitch - Called by CoreEngine.  Used to generate successor
230  ///  nodes by processing the 'effects' of a switch statement.
231  void processSwitch(SwitchNodeBuilder& builder);
232
233  /// ProcessEndPath - Called by CoreEngine.  Used to generate end-of-path
234  ///  nodes when the control reaches the end of a function.
235  void processEndOfFunction(NodeBuilderContext& BC,
236                            ExplodedNode *Pred);
237
238  /// Remove dead bindings/symbols before exiting a function.
239  void removeDeadOnEndOfFunction(NodeBuilderContext& BC,
240                                 ExplodedNode *Pred,
241                                 ExplodedNodeSet &Dst);
242
243  /// Generate the entry node of the callee.
244  void processCallEnter(CallEnter CE, ExplodedNode *Pred);
245
246  /// Generate the sequence of nodes that simulate the call exit and the post
247  /// visit for CallExpr.
248  void processCallExit(ExplodedNode *Pred);
249
250  /// Called by CoreEngine when the analysis worklist has terminated.
251  void processEndWorklist(bool hasWorkRemaining);
252
253  /// evalAssume - Callback function invoked by the ConstraintManager when
254  ///  making assumptions about state values.
255  ProgramStateRef processAssume(ProgramStateRef state, SVal cond,bool assumption);
256
257  /// wantsRegionChangeUpdate - Called by ProgramStateManager to determine if a
258  ///  region change should trigger a processRegionChanges update.
259  bool wantsRegionChangeUpdate(ProgramStateRef state);
260
261  /// processRegionChanges - Called by ProgramStateManager whenever a change is made
262  ///  to the store. Used to update checkers that track region values.
263  ProgramStateRef
264  processRegionChanges(ProgramStateRef state,
265                       const InvalidatedSymbols *invalidated,
266                       ArrayRef<const MemRegion *> ExplicitRegions,
267                       ArrayRef<const MemRegion *> Regions,
268                       const CallEvent *Call);
269
270  /// printState - Called by ProgramStateManager to print checker-specific data.
271  void printState(raw_ostream &Out, ProgramStateRef State,
272                  const char *NL, const char *Sep);
273
274  virtual ProgramStateManager& getStateManager() { return StateMgr; }
275
276  StoreManager& getStoreManager() { return StateMgr.getStoreManager(); }
277
278  ConstraintManager& getConstraintManager() {
279    return StateMgr.getConstraintManager();
280  }
281
282  // FIXME: Remove when we migrate over to just using SValBuilder.
283  BasicValueFactory& getBasicVals() {
284    return StateMgr.getBasicVals();
285  }
286
287  // FIXME: Remove when we migrate over to just using ValueManager.
288  SymbolManager& getSymbolManager() { return SymMgr; }
289  const SymbolManager& getSymbolManager() const { return SymMgr; }
290
291  // Functions for external checking of whether we have unfinished work
292  bool wasBlocksExhausted() const { return Engine.wasBlocksExhausted(); }
293  bool hasEmptyWorkList() const { return !Engine.getWorkList()->hasWork(); }
294  bool hasWorkRemaining() const { return Engine.hasWorkRemaining(); }
295
296  const CoreEngine &getCoreEngine() const { return Engine; }
297
298public:
299  /// Visit - Transfer function logic for all statements.  Dispatches to
300  ///  other functions that handle specific kinds of statements.
301  void Visit(const Stmt *S, ExplodedNode *Pred, ExplodedNodeSet &Dst);
302
303  /// VisitArraySubscriptExpr - Transfer function for array accesses.
304  void VisitLvalArraySubscriptExpr(const ArraySubscriptExpr *Ex,
305                                   ExplodedNode *Pred,
306                                   ExplodedNodeSet &Dst);
307
308  /// VisitGCCAsmStmt - Transfer function logic for inline asm.
309  void VisitGCCAsmStmt(const GCCAsmStmt *A, ExplodedNode *Pred,
310                       ExplodedNodeSet &Dst);
311
312  /// VisitMSAsmStmt - Transfer function logic for MS inline asm.
313  void VisitMSAsmStmt(const MSAsmStmt *A, ExplodedNode *Pred,
314                      ExplodedNodeSet &Dst);
315
316  /// VisitBlockExpr - Transfer function logic for BlockExprs.
317  void VisitBlockExpr(const BlockExpr *BE, ExplodedNode *Pred,
318                      ExplodedNodeSet &Dst);
319
320  /// VisitBinaryOperator - Transfer function logic for binary operators.
321  void VisitBinaryOperator(const BinaryOperator* B, ExplodedNode *Pred,
322                           ExplodedNodeSet &Dst);
323
324
325  /// VisitCall - Transfer function for function calls.
326  void VisitCallExpr(const CallExpr *CE, ExplodedNode *Pred,
327                     ExplodedNodeSet &Dst);
328
329  /// VisitCast - Transfer function logic for all casts (implicit and explicit).
330  void VisitCast(const CastExpr *CastE, const Expr *Ex, ExplodedNode *Pred,
331                ExplodedNodeSet &Dst);
332
333  /// VisitCompoundLiteralExpr - Transfer function logic for compound literals.
334  void VisitCompoundLiteralExpr(const CompoundLiteralExpr *CL,
335                                ExplodedNode *Pred, ExplodedNodeSet &Dst);
336
337  /// Transfer function logic for DeclRefExprs and BlockDeclRefExprs.
338  void VisitCommonDeclRefExpr(const Expr *DR, const NamedDecl *D,
339                              ExplodedNode *Pred, ExplodedNodeSet &Dst);
340
341  /// VisitDeclStmt - Transfer function logic for DeclStmts.
342  void VisitDeclStmt(const DeclStmt *DS, ExplodedNode *Pred,
343                     ExplodedNodeSet &Dst);
344
345  /// VisitGuardedExpr - Transfer function logic for ?, __builtin_choose
346  void VisitGuardedExpr(const Expr *Ex, const Expr *L, const Expr *R,
347                        ExplodedNode *Pred, ExplodedNodeSet &Dst);
348
349  void VisitInitListExpr(const InitListExpr *E, ExplodedNode *Pred,
350                         ExplodedNodeSet &Dst);
351
352  /// VisitLogicalExpr - Transfer function logic for '&&', '||'
353  void VisitLogicalExpr(const BinaryOperator* B, ExplodedNode *Pred,
354                        ExplodedNodeSet &Dst);
355
356  /// VisitMemberExpr - Transfer function for member expressions.
357  void VisitMemberExpr(const MemberExpr *M, ExplodedNode *Pred,
358                           ExplodedNodeSet &Dst);
359
360  /// Transfer function logic for ObjCAtSynchronizedStmts.
361  void VisitObjCAtSynchronizedStmt(const ObjCAtSynchronizedStmt *S,
362                                   ExplodedNode *Pred, ExplodedNodeSet &Dst);
363
364  /// Transfer function logic for computing the lvalue of an Objective-C ivar.
365  void VisitLvalObjCIvarRefExpr(const ObjCIvarRefExpr *DR, ExplodedNode *Pred,
366                                ExplodedNodeSet &Dst);
367
368  /// VisitObjCForCollectionStmt - Transfer function logic for
369  ///  ObjCForCollectionStmt.
370  void VisitObjCForCollectionStmt(const ObjCForCollectionStmt *S,
371                                  ExplodedNode *Pred, ExplodedNodeSet &Dst);
372
373  void VisitObjCMessage(const ObjCMessageExpr *ME, ExplodedNode *Pred,
374                        ExplodedNodeSet &Dst);
375
376  /// VisitReturnStmt - Transfer function logic for return statements.
377  void VisitReturnStmt(const ReturnStmt *R, ExplodedNode *Pred,
378                       ExplodedNodeSet &Dst);
379
380  /// VisitOffsetOfExpr - Transfer function for offsetof.
381  void VisitOffsetOfExpr(const OffsetOfExpr *Ex, ExplodedNode *Pred,
382                         ExplodedNodeSet &Dst);
383
384  /// VisitUnaryExprOrTypeTraitExpr - Transfer function for sizeof.
385  void VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *Ex,
386                              ExplodedNode *Pred, ExplodedNodeSet &Dst);
387
388  /// VisitUnaryOperator - Transfer function logic for unary operators.
389  void VisitUnaryOperator(const UnaryOperator* B, ExplodedNode *Pred,
390                          ExplodedNodeSet &Dst);
391
392  /// Handle ++ and -- (both pre- and post-increment).
393  void VisitIncrementDecrementOperator(const UnaryOperator* U,
394                                       ExplodedNode *Pred,
395                                       ExplodedNodeSet &Dst);
396
397  void VisitCXXCatchStmt(const CXXCatchStmt *CS, ExplodedNode *Pred,
398                         ExplodedNodeSet &Dst);
399
400  void VisitCXXThisExpr(const CXXThisExpr *TE, ExplodedNode *Pred,
401                        ExplodedNodeSet & Dst);
402
403  void VisitCXXConstructExpr(const CXXConstructExpr *E, ExplodedNode *Pred,
404                             ExplodedNodeSet &Dst);
405
406  void VisitCXXDestructor(QualType ObjectType, const MemRegion *Dest,
407                          const Stmt *S, bool IsBaseDtor,
408                          ExplodedNode *Pred, ExplodedNodeSet &Dst);
409
410  void VisitCXXNewExpr(const CXXNewExpr *CNE, ExplodedNode *Pred,
411                       ExplodedNodeSet &Dst);
412
413  void VisitCXXDeleteExpr(const CXXDeleteExpr *CDE, ExplodedNode *Pred,
414                          ExplodedNodeSet &Dst);
415
416  /// Create a C++ temporary object for an rvalue.
417  void CreateCXXTemporaryObject(const MaterializeTemporaryExpr *ME,
418                                ExplodedNode *Pred,
419                                ExplodedNodeSet &Dst);
420
421  /// evalEagerlyAssumeBinOpBifurcation - Given the nodes in 'Src', eagerly assume symbolic
422  ///  expressions of the form 'x != 0' and generate new nodes (stored in Dst)
423  ///  with those assumptions.
424  void evalEagerlyAssumeBinOpBifurcation(ExplodedNodeSet &Dst, ExplodedNodeSet &Src,
425                         const Expr *Ex);
426
427  std::pair<const ProgramPointTag *, const ProgramPointTag*>
428    geteagerlyAssumeBinOpBifurcationTags();
429
430  SVal evalMinus(SVal X) {
431    return X.isValid() ? svalBuilder.evalMinus(cast<NonLoc>(X)) : X;
432  }
433
434  SVal evalComplement(SVal X) {
435    return X.isValid() ? svalBuilder.evalComplement(cast<NonLoc>(X)) : X;
436  }
437
438public:
439
440  SVal evalBinOp(ProgramStateRef state, BinaryOperator::Opcode op,
441                 NonLoc L, NonLoc R, QualType T) {
442    return svalBuilder.evalBinOpNN(state, op, L, R, T);
443  }
444
445  SVal evalBinOp(ProgramStateRef state, BinaryOperator::Opcode op,
446                 NonLoc L, SVal R, QualType T) {
447    return R.isValid() ? svalBuilder.evalBinOpNN(state,op,L, cast<NonLoc>(R), T) : R;
448  }
449
450  SVal evalBinOp(ProgramStateRef ST, BinaryOperator::Opcode Op,
451                 SVal LHS, SVal RHS, QualType T) {
452    return svalBuilder.evalBinOp(ST, Op, LHS, RHS, T);
453  }
454
455protected:
456  /// evalBind - Handle the semantics of binding a value to a specific location.
457  ///  This method is used by evalStore, VisitDeclStmt, and others.
458  void evalBind(ExplodedNodeSet &Dst, const Stmt *StoreE, ExplodedNode *Pred,
459                SVal location, SVal Val, bool atDeclInit = false,
460                const ProgramPoint *PP = 0);
461
462  /// Call PointerEscape callback when a value escapes as a result of bind.
463  ProgramStateRef processPointerEscapedOnBind(ProgramStateRef State,
464                                              SVal Loc, SVal Val);
465  /// Call PointerEscape callback when a value escapes as a result of
466  /// region invalidation.
467  ProgramStateRef processPointerEscapedOnInvalidateRegions(
468                            ProgramStateRef State,
469                            const InvalidatedSymbols *Invalidated,
470                            ArrayRef<const MemRegion *> ExplicitRegions,
471                            ArrayRef<const MemRegion *> Regions,
472                            const CallEvent *Call);
473
474public:
475  // FIXME: 'tag' should be removed, and a LocationContext should be used
476  // instead.
477  // FIXME: Comment on the meaning of the arguments, when 'St' may not
478  // be the same as Pred->state, and when 'location' may not be the
479  // same as state->getLValue(Ex).
480  /// Simulate a read of the result of Ex.
481  void evalLoad(ExplodedNodeSet &Dst,
482                const Expr *NodeEx,  /* Eventually will be a CFGStmt */
483                const Expr *BoundExpr,
484                ExplodedNode *Pred,
485                ProgramStateRef St,
486                SVal location,
487                const ProgramPointTag *tag = 0,
488                QualType LoadTy = QualType());
489
490  // FIXME: 'tag' should be removed, and a LocationContext should be used
491  // instead.
492  void evalStore(ExplodedNodeSet &Dst, const Expr *AssignE, const Expr *StoreE,
493                 ExplodedNode *Pred, ProgramStateRef St, SVal TargetLV, SVal Val,
494                 const ProgramPointTag *tag = 0);
495
496  /// \brief Create a new state in which the call return value is binded to the
497  /// call origin expression.
498  ProgramStateRef bindReturnValue(const CallEvent &Call,
499                                  const LocationContext *LCtx,
500                                  ProgramStateRef State);
501
502  /// Evaluate a call, running pre- and post-call checks and allowing checkers
503  /// to be responsible for handling the evaluation of the call itself.
504  void evalCall(ExplodedNodeSet &Dst, ExplodedNode *Pred,
505                const CallEvent &Call);
506
507  /// \brief Default implementation of call evaluation.
508  void defaultEvalCall(NodeBuilder &B, ExplodedNode *Pred,
509                       const CallEvent &Call);
510private:
511  void evalLoadCommon(ExplodedNodeSet &Dst,
512                      const Expr *NodeEx,  /* Eventually will be a CFGStmt */
513                      const Expr *BoundEx,
514                      ExplodedNode *Pred,
515                      ProgramStateRef St,
516                      SVal location,
517                      const ProgramPointTag *tag,
518                      QualType LoadTy);
519
520  // FIXME: 'tag' should be removed, and a LocationContext should be used
521  // instead.
522  void evalLocation(ExplodedNodeSet &Dst,
523                    const Stmt *NodeEx, /* This will eventually be a CFGStmt */
524                    const Stmt *BoundEx,
525                    ExplodedNode *Pred,
526                    ProgramStateRef St, SVal location,
527                    const ProgramPointTag *tag, bool isLoad);
528
529  /// Count the stack depth and determine if the call is recursive.
530  void examineStackFrames(const Decl *D, const LocationContext *LCtx,
531                          bool &IsRecursive, unsigned &StackDepth);
532
533  bool shouldInlineDecl(const Decl *D, ExplodedNode *Pred);
534  bool inlineCall(const CallEvent &Call, const Decl *D, NodeBuilder &Bldr,
535                  ExplodedNode *Pred, ProgramStateRef State);
536
537  /// \brief Conservatively evaluate call by invalidating regions and binding
538  /// a conjured return value.
539  void conservativeEvalCall(const CallEvent &Call, NodeBuilder &Bldr,
540                            ExplodedNode *Pred, ProgramStateRef State);
541
542  /// \brief Either inline or process the call conservatively (or both), based
543  /// on DynamicDispatchBifurcation data.
544  void BifurcateCall(const MemRegion *BifurReg,
545                     const CallEvent &Call, const Decl *D, NodeBuilder &Bldr,
546                     ExplodedNode *Pred);
547
548  bool replayWithoutInlining(ExplodedNode *P, const LocationContext *CalleeLC);
549};
550
551/// Traits for storing the call processing policy inside GDM.
552/// The GDM stores the corresponding CallExpr pointer.
553// FIXME: This does not use the nice trait macros because it must be accessible
554// from multiple translation units.
555struct ReplayWithoutInlining{};
556template <>
557struct ProgramStateTrait<ReplayWithoutInlining> :
558  public ProgramStatePartialTrait<void*> {
559  static void *GDMIndex() { static int index = 0; return &index; }
560};
561
562} // end ento namespace
563
564} // end clang namespace
565
566#endif
567