]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/clang/include/clang/Checker/PathSensitive/GRSubEngine.h
Improve the Xen para-virtualized device infrastructure of FreeBSD:
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / clang / include / clang / Checker / PathSensitive / GRSubEngine.h
1 //== GRSubEngine.h - Interface of the subengine of GRCoreEngine ----*- 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 the interface of a subengine of the GRCoreEngine.
11 //
12 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_CLANG_ANALYSIS_GRSUBENGINE_H
14 #define LLVM_CLANG_ANALYSIS_GRSUBENGINE_H
15
16 #include "clang/Checker/PathSensitive/SVals.h"
17
18 namespace clang {
19
20 class AnalysisManager;
21 class CFGBlock;
22 class CFGElement;
23 class ExplodedNode;
24 class GRState;
25 class GRStateManager;
26 class GRBlockCounter;
27 class GRStmtNodeBuilder;
28 class GRBranchNodeBuilder;
29 class GRIndirectGotoNodeBuilder;
30 class GRSwitchNodeBuilder;
31 class GREndPathNodeBuilder;
32 class GRCallEnterNodeBuilder;
33 class GRCallExitNodeBuilder;
34 class LocationContext;
35 class MemRegion;
36 class Stmt;
37
38 class GRSubEngine {
39 public:
40   virtual ~GRSubEngine() {}
41
42   virtual const GRState* getInitialState(const LocationContext *InitLoc) = 0;
43
44   virtual AnalysisManager &getAnalysisManager() = 0;
45
46   virtual GRStateManager &getStateManager() = 0;
47
48   /// Called by GRCoreEngine. Used to generate new successor
49   /// nodes by processing the 'effects' of a block-level statement.
50   virtual void ProcessStmt(const CFGElement E, GRStmtNodeBuilder& builder) = 0;
51
52   /// Called by GRCoreEngine when start processing
53   /// a CFGBlock.  This method returns true if the analysis should continue
54   /// exploring the given path, and false otherwise.
55   virtual bool ProcessBlockEntrance(const CFGBlock* B, const ExplodedNode *Pred,
56                                     GRBlockCounter BC) = 0;
57
58   /// Called by GRCoreEngine.  Used to generate successor
59   ///  nodes by processing the 'effects' of a branch condition.
60   virtual void ProcessBranch(const Stmt* Condition, const Stmt* Term,
61                              GRBranchNodeBuilder& builder) = 0;
62
63   /// Called by GRCoreEngine.  Used to generate successor
64   /// nodes by processing the 'effects' of a computed goto jump.
65   virtual void ProcessIndirectGoto(GRIndirectGotoNodeBuilder& builder) = 0;
66
67   /// Called by GRCoreEngine.  Used to generate successor
68   /// nodes by processing the 'effects' of a switch statement.
69   virtual void ProcessSwitch(GRSwitchNodeBuilder& builder) = 0;
70
71   /// ProcessEndPath - Called by GRCoreEngine.  Used to generate end-of-path
72   ///  nodes when the control reaches the end of a function.
73   virtual void ProcessEndPath(GREndPathNodeBuilder& builder) = 0;
74
75   // Generate the entry node of the callee.
76   virtual void ProcessCallEnter(GRCallEnterNodeBuilder &builder) = 0;
77
78   // Generate the first post callsite node.
79   virtual void ProcessCallExit(GRCallExitNodeBuilder &builder) = 0;
80
81   /// Called by ConstraintManager. Used to call checker-specific
82   /// logic for handling assumptions on symbolic values.
83   virtual const GRState* ProcessAssume(const GRState *state,
84                                        SVal cond, bool assumption) = 0;
85
86   /// WantsRegionChangeUpdate - Called by GRStateManager to determine if a
87   ///  region change should trigger a ProcessRegionChanges update.
88   virtual bool WantsRegionChangeUpdate(const GRState* state) = 0;
89
90   /// ProcessRegionChanges - Called by GRStateManager whenever a change is made
91   ///  to the store. Used to update checkers that track region values.
92   virtual const GRState* ProcessRegionChanges(const GRState* state,
93                                               const MemRegion* const *Begin,
94                                               const MemRegion* const *End) = 0;
95
96   inline const GRState* ProcessRegionChange(const GRState* state,
97                                             const MemRegion* MR) {
98     return ProcessRegionChanges(state, &MR, &MR+1);
99   }
100
101   /// Called by GRCoreEngine when the analysis worklist is either empty or the
102   //  maximum number of analysis steps have been reached.
103   virtual void ProcessEndWorklist(bool hasWorkRemaining) = 0;
104 };
105 }
106
107 #endif