ExprEngine.h revision bf53dfac8195835028bd6347433f7dbebcc29fc1
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 ProgramStateRef processPointerEscapedOnBind(ProgramStateRef State, 463 SVal Loc, SVal Val); 464 465 ProgramStateRef processPointerEscapedOnInvalidateRegions( 466 ProgramStateRef State, 467 const InvalidatedSymbols *Invalidated, 468 ArrayRef<const MemRegion *> ExplicitRegions, 469 ArrayRef<const MemRegion *> Regions, 470 const CallEvent *Call); 471 472public: 473 // FIXME: 'tag' should be removed, and a LocationContext should be used 474 // instead. 475 // FIXME: Comment on the meaning of the arguments, when 'St' may not 476 // be the same as Pred->state, and when 'location' may not be the 477 // same as state->getLValue(Ex). 478 /// Simulate a read of the result of Ex. 479 void evalLoad(ExplodedNodeSet &Dst, 480 const Expr *NodeEx, /* Eventually will be a CFGStmt */ 481 const Expr *BoundExpr, 482 ExplodedNode *Pred, 483 ProgramStateRef St, 484 SVal location, 485 const ProgramPointTag *tag = 0, 486 QualType LoadTy = QualType()); 487 488 // FIXME: 'tag' should be removed, and a LocationContext should be used 489 // instead. 490 void evalStore(ExplodedNodeSet &Dst, const Expr *AssignE, const Expr *StoreE, 491 ExplodedNode *Pred, ProgramStateRef St, SVal TargetLV, SVal Val, 492 const ProgramPointTag *tag = 0); 493 494 /// \brief Create a new state in which the call return value is binded to the 495 /// call origin expression. 496 ProgramStateRef bindReturnValue(const CallEvent &Call, 497 const LocationContext *LCtx, 498 ProgramStateRef State); 499 500 /// Evaluate a call, running pre- and post-call checks and allowing checkers 501 /// to be responsible for handling the evaluation of the call itself. 502 void evalCall(ExplodedNodeSet &Dst, ExplodedNode *Pred, 503 const CallEvent &Call); 504 505 /// \brief Default implementation of call evaluation. 506 void defaultEvalCall(NodeBuilder &B, ExplodedNode *Pred, 507 const CallEvent &Call); 508private: 509 void evalLoadCommon(ExplodedNodeSet &Dst, 510 const Expr *NodeEx, /* Eventually will be a CFGStmt */ 511 const Expr *BoundEx, 512 ExplodedNode *Pred, 513 ProgramStateRef St, 514 SVal location, 515 const ProgramPointTag *tag, 516 QualType LoadTy); 517 518 // FIXME: 'tag' should be removed, and a LocationContext should be used 519 // instead. 520 void evalLocation(ExplodedNodeSet &Dst, 521 const Stmt *NodeEx, /* This will eventually be a CFGStmt */ 522 const Stmt *BoundEx, 523 ExplodedNode *Pred, 524 ProgramStateRef St, SVal location, 525 const ProgramPointTag *tag, bool isLoad); 526 527 /// Count the stack depth and determine if the call is recursive. 528 void examineStackFrames(const Decl *D, const LocationContext *LCtx, 529 bool &IsRecursive, unsigned &StackDepth); 530 531 bool shouldInlineDecl(const Decl *D, ExplodedNode *Pred); 532 bool inlineCall(const CallEvent &Call, const Decl *D, NodeBuilder &Bldr, 533 ExplodedNode *Pred, ProgramStateRef State); 534 535 /// \brief Conservatively evaluate call by invalidating regions and binding 536 /// a conjured return value. 537 void conservativeEvalCall(const CallEvent &Call, NodeBuilder &Bldr, 538 ExplodedNode *Pred, ProgramStateRef State); 539 540 /// \brief Either inline or process the call conservatively (or both), based 541 /// on DynamicDispatchBifurcation data. 542 void BifurcateCall(const MemRegion *BifurReg, 543 const CallEvent &Call, const Decl *D, NodeBuilder &Bldr, 544 ExplodedNode *Pred); 545 546 bool replayWithoutInlining(ExplodedNode *P, const LocationContext *CalleeLC); 547}; 548 549/// Traits for storing the call processing policy inside GDM. 550/// The GDM stores the corresponding CallExpr pointer. 551// FIXME: This does not use the nice trait macros because it must be accessible 552// from multiple translation units. 553struct ReplayWithoutInlining{}; 554template <> 555struct ProgramStateTrait<ReplayWithoutInlining> : 556 public ProgramStatePartialTrait<void*> { 557 static void *GDMIndex() { static int index = 0; return &index; } 558}; 559 560} // end ento namespace 561 562} // end clang namespace 563 564#endif 565