1 //== GRState.h - Path-sensitive "State" for tracking values -----*- C++ -*--==//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines SymbolRef, ExprBindKey, and GRState*.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CLANG_GR_VALUESTATE_H
15 #define LLVM_CLANG_GR_VALUESTATE_H
17 #include "clang/StaticAnalyzer/PathSensitive/ConstraintManager.h"
18 #include "clang/StaticAnalyzer/PathSensitive/Environment.h"
19 #include "clang/StaticAnalyzer/PathSensitive/Store.h"
20 #include "clang/StaticAnalyzer/PathSensitive/SValBuilder.h"
21 #include "llvm/ADT/FoldingSet.h"
22 #include "llvm/ADT/ImmutableMap.h"
23 #include "llvm/Support/Casting.h"
27 class BumpPtrAllocator
;
39 typedef ConstraintManager
* (*ConstraintManagerCreator
)(GRStateManager
&,
41 typedef StoreManager
* (*StoreManagerCreator
)(GRStateManager
&);
43 //===----------------------------------------------------------------------===//
44 // GRStateTrait - Traits used by the Generic Data Map of a GRState.
45 //===----------------------------------------------------------------------===//
47 template <typename T
> struct GRStatePartialTrait
;
49 template <typename T
> struct GRStateTrait
{
50 typedef typename
T::data_type data_type
;
51 static inline void* GDMIndex() { return &T::TagInt
; }
52 static inline void* MakeVoidPtr(data_type D
) { return (void*) D
; }
53 static inline data_type
MakeData(void* const* P
) {
54 return P
? (data_type
) *P
: (data_type
) 0;
60 /// GRState - This class encapsulates:
62 /// 1. A mapping from expressions to values (Environment)
63 /// 2. A mapping from locations to values (Store)
64 /// 3. Constraints on symbolic values (GenericDataMap)
66 /// Together these represent the "abstract state" of a program.
68 /// GRState is intended to be used as a functional object; that is,
69 /// once it is created and made "persistent" in a FoldingSet, its
70 /// values will never change.
71 class GRState
: public llvm::FoldingSetNode
{
73 typedef llvm::ImmutableSet
<llvm::APSInt
*> IntSetTy
;
74 typedef llvm::ImmutableMap
<void*, void*> GenericDataMap
;
77 void operator=(const GRState
& R
) const; // Do not implement.
79 friend class GRStateManager
;
81 GRStateManager
*StateMgr
;
82 Environment Env
; // Maps a Stmt to its current SVal.
83 Store St
; // Maps a location to its current value.
84 GenericDataMap GDM
; // Custom data stored by a client of this class.
86 /// makeWithStore - Return a GRState with the same values as the current
87 /// state with the exception of using the specified Store.
88 const GRState
*makeWithStore(Store store
) const;
92 /// This ctor is used when creating the first GRState object.
93 GRState(GRStateManager
*mgr
, const Environment
& env
,
94 Store st
, GenericDataMap gdm
)
100 /// Copy ctor - We must explicitly define this or else the "Next" ptr
101 /// in FoldingSetNode will also get copied.
102 GRState(const GRState
& RHS
)
103 : llvm::FoldingSetNode(),
104 StateMgr(RHS
.StateMgr
),
109 /// getStateManager - Return the GRStateManager associated with this state.
110 GRStateManager
&getStateManager() const {
114 /// getEnvironment - Return the environment associated with this state.
115 /// The environment is the mapping from expressions to values.
116 const Environment
& getEnvironment() const { return Env
; }
118 /// getStore - Return the store associated with this state. The store
119 /// is a mapping from locations to values.
120 Store
getStore() const { return St
; }
122 void setStore(Store s
) { St
= s
; }
124 /// getGDM - Return the generic data map associated with this state.
125 GenericDataMap
getGDM() const { return GDM
; }
127 void setGDM(GenericDataMap gdm
) { GDM
= gdm
; }
129 /// Profile - Profile the contents of a GRState object for use in a
130 /// FoldingSet. Two GRState objects are considered equal if they
131 /// have the same Environment, Store, and GenericDataMap.
132 static void Profile(llvm::FoldingSetNodeID
& ID
, const GRState
* V
) {
134 ID
.AddPointer(V
->St
);
138 /// Profile - Used to profile the contents of this object for inclusion
140 void Profile(llvm::FoldingSetNodeID
& ID
) const {
144 BasicValueFactory
&getBasicVals() const;
145 SymbolManager
&getSymbolManager() const;
147 //==---------------------------------------------------------------------==//
148 // Constraints on values.
149 //==---------------------------------------------------------------------==//
151 // Each GRState records constraints on symbolic values. These constraints
152 // are managed using the ConstraintManager associated with a GRStateManager.
153 // As constraints gradually accrue on symbolic values, added constraints
154 // may conflict and indicate that a state is infeasible (as no real values
155 // could satisfy all the constraints). This is the principal mechanism
156 // for modeling path-sensitivity in ExprEngine/GRState.
158 // Various "assume" methods form the interface for adding constraints to
159 // symbolic values. A call to 'assume' indicates an assumption being placed
160 // on one or symbolic values. 'assume' methods take the following inputs:
162 // (1) A GRState object representing the current state.
164 // (2) The assumed constraint (which is specific to a given "assume" method).
166 // (3) A binary value "Assumption" that indicates whether the constraint is
167 // assumed to be true or false.
169 // The output of "assume*" is a new GRState object with the added constraints.
170 // If no new state is feasible, NULL is returned.
173 const GRState
*assume(DefinedOrUnknownSVal cond
, bool assumption
) const;
175 /// This method assumes both "true" and "false" for 'cond', and
176 /// returns both corresponding states. It's shorthand for doing
178 std::pair
<const GRState
*, const GRState
*>
179 assume(DefinedOrUnknownSVal cond
) const;
181 const GRState
*assumeInBound(DefinedOrUnknownSVal idx
,
182 DefinedOrUnknownSVal upperBound
,
183 bool assumption
) const;
185 //==---------------------------------------------------------------------==//
186 // Utility methods for getting regions.
187 //==---------------------------------------------------------------------==//
189 const VarRegion
* getRegion(const VarDecl
*D
, const LocationContext
*LC
) const;
191 //==---------------------------------------------------------------------==//
192 // Binding and retrieving values to/from the environment and symbolic store.
193 //==---------------------------------------------------------------------==//
195 /// BindCompoundLiteral - Return the state that has the bindings currently
196 /// in this state plus the bindings for the CompoundLiteral.
197 const GRState
*bindCompoundLiteral(const CompoundLiteralExpr
* CL
,
198 const LocationContext
*LC
,
201 /// Create a new state by binding the value 'V' to the statement 'S' in the
202 /// state's environment.
203 const GRState
*BindExpr(const Stmt
*S
, SVal V
, bool Invalidate
= true) const;
205 /// Create a new state by binding the value 'V' and location 'locaton' to the
206 /// statement 'S' in the state's environment.
207 const GRState
*bindExprAndLocation(const Stmt
*S
, SVal location
, SVal V
)
210 const GRState
*bindDecl(const VarRegion
*VR
, SVal V
) const;
212 const GRState
*bindDeclWithNoInit(const VarRegion
*VR
) const;
214 const GRState
*bindLoc(Loc location
, SVal V
) const;
216 const GRState
*bindLoc(SVal location
, SVal V
) const;
218 const GRState
*bindDefault(SVal loc
, SVal V
) const;
220 const GRState
*unbindLoc(Loc LV
) const;
222 /// InvalidateRegion - Returns the state with bindings for the given region
223 /// cleared from the store. See InvalidateRegions.
224 const GRState
*InvalidateRegion(const MemRegion
*R
,
225 const Expr
*E
, unsigned BlockCount
,
226 StoreManager::InvalidatedSymbols
*IS
= NULL
)
228 return InvalidateRegions(&R
, &R
+1, E
, BlockCount
, IS
, false);
231 /// InvalidateRegions - Returns the state with bindings for the given regions
232 /// cleared from the store. The regions are provided as a continuous array
233 /// from Begin to End. Optionally invalidates global regions as well.
234 const GRState
*InvalidateRegions(const MemRegion
* const *Begin
,
235 const MemRegion
* const *End
,
236 const Expr
*E
, unsigned BlockCount
,
237 StoreManager::InvalidatedSymbols
*IS
,
238 bool invalidateGlobals
) const;
240 /// EnterStackFrame - Returns the state for entry to the given stack frame,
241 /// preserving the current state.
242 const GRState
*EnterStackFrame(const StackFrameContext
*frame
) const;
244 /// Get the lvalue for a variable reference.
245 Loc
getLValue(const VarDecl
*D
, const LocationContext
*LC
) const;
247 /// Get the lvalue for a StringLiteral.
248 Loc
getLValue(const StringLiteral
*literal
) const;
250 Loc
getLValue(const CompoundLiteralExpr
*literal
,
251 const LocationContext
*LC
) const;
253 /// Get the lvalue for an ivar reference.
254 SVal
getLValue(const ObjCIvarDecl
*decl
, SVal base
) const;
256 /// Get the lvalue for a field reference.
257 SVal
getLValue(const FieldDecl
*decl
, SVal Base
) const;
259 /// Get the lvalue for an array index.
260 SVal
getLValue(QualType ElementType
, SVal Idx
, SVal Base
) const;
262 const llvm::APSInt
*getSymVal(SymbolRef sym
) const;
264 /// Returns the SVal bound to the statement 'S' in the state's environment.
265 SVal
getSVal(const Stmt
* S
) const;
267 SVal
getSValAsScalarOrLoc(const Stmt
*Ex
) const;
269 SVal
getSVal(Loc LV
, QualType T
= QualType()) const;
271 /// Returns the "raw" SVal bound to LV before any value simplfication.
272 SVal
getRawSVal(Loc LV
, QualType T
= QualType()) const;
274 SVal
getSVal(const MemRegion
* R
) const;
276 SVal
getSValAsScalarOrLoc(const MemRegion
*R
) const;
278 const llvm::APSInt
*getSymVal(SymbolRef sym
);
280 bool scanReachableSymbols(SVal val
, SymbolVisitor
& visitor
) const;
282 bool scanReachableSymbols(const SVal
*I
, const SVal
*E
,
283 SymbolVisitor
&visitor
) const;
285 bool scanReachableSymbols(const MemRegion
* const *I
,
286 const MemRegion
* const *E
,
287 SymbolVisitor
&visitor
) const;
289 template <typename CB
> CB
scanReachableSymbols(SVal val
) const;
290 template <typename CB
> CB
scanReachableSymbols(const SVal
*beg
,
291 const SVal
*end
) const;
293 template <typename CB
> CB
294 scanReachableSymbols(const MemRegion
* const *beg
,
295 const MemRegion
* const *end
) const;
297 //==---------------------------------------------------------------------==//
298 // Accessing the Generic Data Map (GDM).
299 //==---------------------------------------------------------------------==//
301 void* const* FindGDM(void* K
) const;
304 const GRState
*add(typename GRStateTrait
<T
>::key_type K
) const;
306 template <typename T
>
307 typename GRStateTrait
<T
>::data_type
309 return GRStateTrait
<T
>::MakeData(FindGDM(GRStateTrait
<T
>::GDMIndex()));
313 typename GRStateTrait
<T
>::lookup_type
314 get(typename GRStateTrait
<T
>::key_type key
) const {
315 void* const* d
= FindGDM(GRStateTrait
<T
>::GDMIndex());
316 return GRStateTrait
<T
>::Lookup(GRStateTrait
<T
>::MakeData(d
), key
);
319 template <typename T
>
320 typename GRStateTrait
<T
>::context_type
get_context() const;
324 const GRState
*remove(typename GRStateTrait
<T
>::key_type K
) const;
327 const GRState
*remove(typename GRStateTrait
<T
>::key_type K
,
328 typename GRStateTrait
<T
>::context_type C
) const;
329 template <typename T
>
330 const GRState
*remove() const;
333 const GRState
*set(typename GRStateTrait
<T
>::data_type D
) const;
336 const GRState
*set(typename GRStateTrait
<T
>::key_type K
,
337 typename GRStateTrait
<T
>::value_type E
) const;
340 const GRState
*set(typename GRStateTrait
<T
>::key_type K
,
341 typename GRStateTrait
<T
>::value_type E
,
342 typename GRStateTrait
<T
>::context_type C
) const;
345 bool contains(typename GRStateTrait
<T
>::key_type key
) const {
346 void* const* d
= FindGDM(GRStateTrait
<T
>::GDMIndex());
347 return GRStateTrait
<T
>::Contains(GRStateTrait
<T
>::MakeData(d
), key
);
350 // State pretty-printing.
353 virtual ~Printer() {}
354 virtual void Print(llvm::raw_ostream
& Out
, const GRState
* state
,
355 const char* nl
, const char* sep
) = 0;
359 void print(llvm::raw_ostream
& Out
, CFG
&C
, const char *nl
= "\n",
360 const char *sep
= "") const;
362 void printStdErr(CFG
&C
) const;
364 void printDOT(llvm::raw_ostream
& Out
, CFG
&C
) const;
368 typedef llvm::SmallPtrSet
<const GRState
*,5> ImplTy
;
373 inline void Add(const GRState
* St
) {
377 typedef ImplTy::const_iterator iterator
;
379 inline unsigned size() const { return Impl
.size(); }
380 inline bool empty() const { return Impl
.empty(); }
382 inline iterator
begin() const { return Impl
.begin(); }
383 inline iterator
end() const { return Impl
.end(); }
390 AutoPopulate(GRStateSet
& s
, const GRState
* st
)
391 : S(s
), StartSize(S
.size()), St(st
) {}
394 if (StartSize
== S
.size())
400 //===----------------------------------------------------------------------===//
401 // GRStateManager - Factory object for GRStates.
402 //===----------------------------------------------------------------------===//
404 class GRStateManager
{
405 friend class GRState
;
406 friend class ExprEngine
; // FIXME: Remove.
408 /// Eng - The SubEngine that owns this state manager.
411 EnvironmentManager EnvMgr
;
412 llvm::OwningPtr
<StoreManager
> StoreMgr
;
413 llvm::OwningPtr
<ConstraintManager
> ConstraintMgr
;
415 GRState::GenericDataMap::Factory GDMFactory
;
417 typedef llvm::DenseMap
<void*,std::pair
<void*,void (*)(void*)> > GDMContextsTy
;
418 GDMContextsTy GDMContexts
;
420 /// Printers - A set of printer objects used for pretty-printing a GRState.
421 /// GRStateManager owns these objects.
422 std::vector
<GRState::Printer
*> Printers
;
424 /// StateSet - FoldingSet containing all the states created for analyzing
425 /// a particular function. This is used to unique states.
426 llvm::FoldingSet
<GRState
> StateSet
;
428 /// Object that manages the data for all created SVals.
429 llvm::OwningPtr
<SValBuilder
> svalBuilder
;
431 /// Alloc - A BumpPtrAllocator to allocate states.
432 llvm::BumpPtrAllocator
&Alloc
;
435 GRStateManager(ASTContext
& Ctx
,
436 StoreManagerCreator CreateStoreManager
,
437 ConstraintManagerCreator CreateConstraintManager
,
438 llvm::BumpPtrAllocator
& alloc
,
443 svalBuilder(createSimpleSValBuilder(alloc
, Ctx
, *this)),
445 StoreMgr
.reset((*CreateStoreManager
)(*this));
446 ConstraintMgr
.reset((*CreateConstraintManager
)(*this, subeng
));
451 const GRState
*getInitialState(const LocationContext
*InitLoc
);
453 ASTContext
&getContext() { return svalBuilder
->getContext(); }
454 const ASTContext
&getContext() const { return svalBuilder
->getContext(); }
456 BasicValueFactory
&getBasicVals() {
457 return svalBuilder
->getBasicValueFactory();
459 const BasicValueFactory
& getBasicVals() const {
460 return svalBuilder
->getBasicValueFactory();
463 SValBuilder
&getSValBuilder() {
467 SymbolManager
&getSymbolManager() {
468 return svalBuilder
->getSymbolManager();
470 const SymbolManager
&getSymbolManager() const {
471 return svalBuilder
->getSymbolManager();
474 llvm::BumpPtrAllocator
& getAllocator() { return Alloc
; }
476 MemRegionManager
& getRegionManager() {
477 return svalBuilder
->getRegionManager();
479 const MemRegionManager
& getRegionManager() const {
480 return svalBuilder
->getRegionManager();
483 StoreManager
& getStoreManager() { return *StoreMgr
; }
484 ConstraintManager
& getConstraintManager() { return *ConstraintMgr
; }
485 SubEngine
& getOwningEngine() { return Eng
; }
487 const GRState
* RemoveDeadBindings(const GRState
* St
,
488 const StackFrameContext
*LCtx
,
489 SymbolReaper
& SymReaper
);
491 /// Marshal a new state for the callee in another translation unit.
492 /// 'state' is owned by the caller's engine.
493 const GRState
*MarshalState(const GRState
*state
, const StackFrameContext
*L
);
497 SVal
ArrayToPointer(Loc Array
) {
498 return StoreMgr
->ArrayToPointer(Array
);
501 // Methods that manipulate the GDM.
502 const GRState
* addGDM(const GRState
* St
, void* Key
, void* Data
);
503 const GRState
*removeGDM(const GRState
*state
, void *Key
);
505 // Methods that query & manipulate the Store.
507 void iterBindings(const GRState
* state
, StoreManager::BindingsHandler
& F
) {
508 StoreMgr
->iterBindings(state
->getStore(), F
);
511 const GRState
* getPersistentState(GRState
& Impl
);
513 //==---------------------------------------------------------------------==//
514 // Generic Data Map methods.
515 //==---------------------------------------------------------------------==//
517 // GRStateManager and GRState support a "generic data map" that allows
518 // different clients of GRState objects to embed arbitrary data within a
519 // GRState object. The generic data map is essentially an immutable map
520 // from a "tag" (that acts as the "key" for a client) and opaque values.
521 // Tags/keys and values are simply void* values. The typical way that clients
522 // generate unique tags are by taking the address of a static variable.
523 // Clients are responsible for ensuring that data values referred to by a
524 // the data pointer are immutable (and thus are essentially purely functional
527 // The templated methods below use the GRStateTrait<T> class
528 // to resolve keys into the GDM and to return data values to clients.
531 // Trait based GDM dispatch.
532 template <typename T
>
533 const GRState
* set(const GRState
* st
, typename GRStateTrait
<T
>::data_type D
) {
534 return addGDM(st
, GRStateTrait
<T
>::GDMIndex(),
535 GRStateTrait
<T
>::MakeVoidPtr(D
));
539 const GRState
* set(const GRState
* st
,
540 typename GRStateTrait
<T
>::key_type K
,
541 typename GRStateTrait
<T
>::value_type V
,
542 typename GRStateTrait
<T
>::context_type C
) {
544 return addGDM(st
, GRStateTrait
<T
>::GDMIndex(),
545 GRStateTrait
<T
>::MakeVoidPtr(GRStateTrait
<T
>::Set(st
->get
<T
>(), K
, V
, C
)));
548 template <typename T
>
549 const GRState
* add(const GRState
* st
,
550 typename GRStateTrait
<T
>::key_type K
,
551 typename GRStateTrait
<T
>::context_type C
) {
552 return addGDM(st
, GRStateTrait
<T
>::GDMIndex(),
553 GRStateTrait
<T
>::MakeVoidPtr(GRStateTrait
<T
>::Add(st
->get
<T
>(), K
, C
)));
556 template <typename T
>
557 const GRState
* remove(const GRState
* st
,
558 typename GRStateTrait
<T
>::key_type K
,
559 typename GRStateTrait
<T
>::context_type C
) {
561 return addGDM(st
, GRStateTrait
<T
>::GDMIndex(),
562 GRStateTrait
<T
>::MakeVoidPtr(GRStateTrait
<T
>::Remove(st
->get
<T
>(), K
, C
)));
565 template <typename T
>
566 const GRState
*remove(const GRState
*st
) {
567 return removeGDM(st
, GRStateTrait
<T
>::GDMIndex());
570 void* FindGDMContext(void* index
,
571 void* (*CreateContext
)(llvm::BumpPtrAllocator
&),
572 void (*DeleteContext
)(void*));
574 template <typename T
>
575 typename GRStateTrait
<T
>::context_type
get_context() {
576 void* p
= FindGDMContext(GRStateTrait
<T
>::GDMIndex(),
577 GRStateTrait
<T
>::CreateContext
,
578 GRStateTrait
<T
>::DeleteContext
);
580 return GRStateTrait
<T
>::MakeContext(p
);
583 const llvm::APSInt
* getSymVal(const GRState
* St
, SymbolRef sym
) {
584 return ConstraintMgr
->getSymVal(St
, sym
);
587 void EndPath(const GRState
* St
) {
588 ConstraintMgr
->EndPath(St
);
593 //===----------------------------------------------------------------------===//
594 // Out-of-line method definitions for GRState.
595 //===----------------------------------------------------------------------===//
597 inline const llvm::APSInt
*GRState::getSymVal(SymbolRef sym
) {
598 return getStateManager().getSymVal(this, sym
);
601 inline const VarRegion
* GRState::getRegion(const VarDecl
*D
,
602 const LocationContext
*LC
) const {
603 return getStateManager().getRegionManager().getVarRegion(D
, LC
);
606 inline const GRState
*GRState::assume(DefinedOrUnknownSVal Cond
,
607 bool Assumption
) const {
608 if (Cond
.isUnknown())
611 return getStateManager().ConstraintMgr
->assume(this, cast
<DefinedSVal
>(Cond
),
615 inline std::pair
<const GRState
*, const GRState
*>
616 GRState::assume(DefinedOrUnknownSVal Cond
) const {
617 if (Cond
.isUnknown())
618 return std::make_pair(this, this);
620 return getStateManager().ConstraintMgr
->assumeDual(this,
621 cast
<DefinedSVal
>(Cond
));
624 inline const GRState
*GRState::bindLoc(SVal LV
, SVal V
) const {
625 return !isa
<Loc
>(LV
) ? this : bindLoc(cast
<Loc
>(LV
), V
);
628 inline Loc
GRState::getLValue(const VarDecl
* VD
,
629 const LocationContext
*LC
) const {
630 return getStateManager().StoreMgr
->getLValueVar(VD
, LC
);
633 inline Loc
GRState::getLValue(const StringLiteral
*literal
) const {
634 return getStateManager().StoreMgr
->getLValueString(literal
);
637 inline Loc
GRState::getLValue(const CompoundLiteralExpr
*literal
,
638 const LocationContext
*LC
) const {
639 return getStateManager().StoreMgr
->getLValueCompoundLiteral(literal
, LC
);
642 inline SVal
GRState::getLValue(const ObjCIvarDecl
*D
, SVal Base
) const {
643 return getStateManager().StoreMgr
->getLValueIvar(D
, Base
);
646 inline SVal
GRState::getLValue(const FieldDecl
* D
, SVal Base
) const {
647 return getStateManager().StoreMgr
->getLValueField(D
, Base
);
650 inline SVal
GRState::getLValue(QualType ElementType
, SVal Idx
, SVal Base
) const{
651 if (NonLoc
*N
= dyn_cast
<NonLoc
>(&Idx
))
652 return getStateManager().StoreMgr
->getLValueElement(ElementType
, *N
, Base
);
656 inline const llvm::APSInt
*GRState::getSymVal(SymbolRef sym
) const {
657 return getStateManager().getSymVal(this, sym
);
660 inline SVal
GRState::getSVal(const Stmt
* Ex
) const {
661 return Env
.getSVal(Ex
, *getStateManager().svalBuilder
);
664 inline SVal
GRState::getSValAsScalarOrLoc(const Stmt
*S
) const {
665 if (const Expr
*Ex
= dyn_cast
<Expr
>(S
)) {
666 QualType T
= Ex
->getType();
667 if (Loc::IsLocType(T
) || T
->isIntegerType())
674 inline SVal
GRState::getRawSVal(Loc LV
, QualType T
) const {
675 return getStateManager().StoreMgr
->Retrieve(St
, LV
, T
);
678 inline SVal
GRState::getSVal(const MemRegion
* R
) const {
679 return getStateManager().StoreMgr
->Retrieve(St
, loc::MemRegionVal(R
));
682 inline BasicValueFactory
&GRState::getBasicVals() const {
683 return getStateManager().getBasicVals();
686 inline SymbolManager
&GRState::getSymbolManager() const {
687 return getStateManager().getSymbolManager();
691 const GRState
*GRState::add(typename GRStateTrait
<T
>::key_type K
) const {
692 return getStateManager().add
<T
>(this, K
, get_context
<T
>());
695 template <typename T
>
696 typename GRStateTrait
<T
>::context_type
GRState::get_context() const {
697 return getStateManager().get_context
<T
>();
701 const GRState
*GRState::remove(typename GRStateTrait
<T
>::key_type K
) const {
702 return getStateManager().remove
<T
>(this, K
, get_context
<T
>());
706 const GRState
*GRState::remove(typename GRStateTrait
<T
>::key_type K
,
707 typename GRStateTrait
<T
>::context_type C
) const {
708 return getStateManager().remove
<T
>(this, K
, C
);
711 template <typename T
>
712 const GRState
*GRState::remove() const {
713 return getStateManager().remove
<T
>(this);
717 const GRState
*GRState::set(typename GRStateTrait
<T
>::data_type D
) const {
718 return getStateManager().set
<T
>(this, D
);
722 const GRState
*GRState::set(typename GRStateTrait
<T
>::key_type K
,
723 typename GRStateTrait
<T
>::value_type E
) const {
724 return getStateManager().set
<T
>(this, K
, E
, get_context
<T
>());
728 const GRState
*GRState::set(typename GRStateTrait
<T
>::key_type K
,
729 typename GRStateTrait
<T
>::value_type E
,
730 typename GRStateTrait
<T
>::context_type C
) const {
731 return getStateManager().set
<T
>(this, K
, E
, C
);
734 template <typename CB
>
735 CB
GRState::scanReachableSymbols(SVal val
) const {
737 scanReachableSymbols(val
, cb
);
741 template <typename CB
>
742 CB
GRState::scanReachableSymbols(const SVal
*beg
, const SVal
*end
) const {
744 scanReachableSymbols(beg
, end
, cb
);
748 template <typename CB
>
749 CB
GRState::scanReachableSymbols(const MemRegion
* const *beg
,
750 const MemRegion
* const *end
) const {
752 scanReachableSymbols(beg
, end
, cb
);
756 } // end GR namespace
758 } // end clang namespace