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/Core/PathSensitive/ConstraintManager.h"
18 #include "clang/StaticAnalyzer/Core/PathSensitive/Environment.h"
19 #include "clang/StaticAnalyzer/Core/PathSensitive/Store.h"
20 #include "clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h"
21 #include "llvm/ADT/PointerIntPair.h"
22 #include "llvm/ADT/FoldingSet.h"
23 #include "llvm/ADT/ImmutableMap.h"
24 #include "llvm/Support/Casting.h"
28 class BumpPtrAllocator;
40 typedef ConstraintManager* (*ConstraintManagerCreator)(GRStateManager&,
42 typedef StoreManager* (*StoreManagerCreator)(GRStateManager&);
44 //===----------------------------------------------------------------------===//
45 // GRStateTrait - Traits used by the Generic Data Map of a GRState.
46 //===----------------------------------------------------------------------===//
48 template <typename T> struct GRStatePartialTrait;
50 template <typename T> struct GRStateTrait {
51 typedef typename T::data_type data_type;
52 static inline void* GDMIndex() { return &T::TagInt; }
53 static inline void* MakeVoidPtr(data_type D) { return (void*) D; }
54 static inline data_type MakeData(void* const* P) {
55 return P ? (data_type) *P : (data_type) 0;
61 /// GRState - This class encapsulates:
63 /// 1. A mapping from expressions to values (Environment)
64 /// 2. A mapping from locations to values (Store)
65 /// 3. Constraints on symbolic values (GenericDataMap)
67 /// Together these represent the "abstract state" of a program.
69 /// GRState is intended to be used as a functional object; that is,
70 /// once it is created and made "persistent" in a FoldingSet, its
71 /// values will never change.
72 class GRState : public llvm::FoldingSetNode {
74 typedef llvm::ImmutableSet<llvm::APSInt*> IntSetTy;
75 typedef llvm::ImmutableMap<void*, void*> GenericDataMap;
78 void operator=(const GRState& R) const; // Do not implement.
80 friend class GRStateManager;
81 friend class ExplodedGraph;
82 friend class ExplodedNode;
84 GRStateManager *stateMgr;
85 Environment Env; // Maps a Stmt to its current SVal.
86 Store store; // Maps a location to its current value.
87 GenericDataMap GDM; // Custom data stored by a client of this class.
90 /// makeWithStore - Return a GRState with the same values as the current
91 /// state with the exception of using the specified Store.
92 const GRState *makeWithStore(const StoreRef &store) const;
94 void setStore(const StoreRef &storeRef);
98 /// This ctor is used when creating the first GRState object.
99 GRState(GRStateManager *mgr, const Environment& env,
100 StoreRef st, GenericDataMap gdm);
102 /// Copy ctor - We must explicitly define this or else the "Next" ptr
103 /// in FoldingSetNode will also get copied.
104 GRState(const GRState& RHS);
108 /// Return the GRStateManager associated with this state.
109 GRStateManager &getStateManager() const { return *stateMgr; }
111 /// Return true if this state is referenced by a persistent ExplodedNode.
112 bool referencedByExplodedNode() const { return refCount > 0; }
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 /// Return the store associated with this state. The store
119 /// is a mapping from locations to values.
120 Store getStore() const { return store; }
123 /// getGDM - Return the generic data map associated with this state.
124 GenericDataMap getGDM() const { return GDM; }
126 void setGDM(GenericDataMap gdm) { GDM = gdm; }
128 /// Profile - Profile the contents of a GRState object for use in a
129 /// FoldingSet. Two GRState objects are considered equal if they
130 /// have the same Environment, Store, and GenericDataMap.
131 static void Profile(llvm::FoldingSetNodeID& ID, const GRState* V) {
133 ID.AddPointer(V->store);
137 /// Profile - Used to profile the contents of this object for inclusion
139 void Profile(llvm::FoldingSetNodeID& ID) const {
143 BasicValueFactory &getBasicVals() const;
144 SymbolManager &getSymbolManager() const;
146 //==---------------------------------------------------------------------==//
147 // Constraints on values.
148 //==---------------------------------------------------------------------==//
150 // Each GRState records constraints on symbolic values. These constraints
151 // are managed using the ConstraintManager associated with a GRStateManager.
152 // As constraints gradually accrue on symbolic values, added constraints
153 // may conflict and indicate that a state is infeasible (as no real values
154 // could satisfy all the constraints). This is the principal mechanism
155 // for modeling path-sensitivity in ExprEngine/GRState.
157 // Various "assume" methods form the interface for adding constraints to
158 // symbolic values. A call to 'assume' indicates an assumption being placed
159 // on one or symbolic values. 'assume' methods take the following inputs:
161 // (1) A GRState object representing the current state.
163 // (2) The assumed constraint (which is specific to a given "assume" method).
165 // (3) A binary value "Assumption" that indicates whether the constraint is
166 // assumed to be true or false.
168 // The output of "assume*" is a new GRState object with the added constraints.
169 // If no new state is feasible, NULL is returned.
172 const GRState *assume(DefinedOrUnknownSVal cond, bool assumption) const;
174 /// This method assumes both "true" and "false" for 'cond', and
175 /// returns both corresponding states. It's shorthand for doing
177 std::pair<const GRState*, const GRState*>
178 assume(DefinedOrUnknownSVal cond) const;
180 const GRState *assumeInBound(DefinedOrUnknownSVal idx,
181 DefinedOrUnknownSVal upperBound,
182 bool assumption) const;
184 //==---------------------------------------------------------------------==//
185 // Utility methods for getting regions.
186 //==---------------------------------------------------------------------==//
188 const VarRegion* getRegion(const VarDecl *D, const LocationContext *LC) const;
190 //==---------------------------------------------------------------------==//
191 // Binding and retrieving values to/from the environment and symbolic store.
192 //==---------------------------------------------------------------------==//
194 /// BindCompoundLiteral - Return the state that has the bindings currently
195 /// in this state plus the bindings for the CompoundLiteral.
196 const GRState *bindCompoundLiteral(const CompoundLiteralExpr* CL,
197 const LocationContext *LC,
200 /// Create a new state by binding the value 'V' to the statement 'S' in the
201 /// state's environment.
202 const GRState *BindExpr(const Stmt *S, SVal V, bool Invalidate = true) const;
204 /// Create a new state by binding the value 'V' and location 'locaton' to the
205 /// statement 'S' in the state's environment.
206 const GRState *bindExprAndLocation(const Stmt *S, SVal location, SVal V)
209 const GRState *bindDecl(const VarRegion *VR, SVal V) const;
211 const GRState *bindDeclWithNoInit(const VarRegion *VR) const;
213 const GRState *bindLoc(Loc location, SVal V) const;
215 const GRState *bindLoc(SVal location, SVal V) const;
217 const GRState *bindDefault(SVal loc, SVal V) const;
219 const GRState *unbindLoc(Loc LV) const;
221 /// invalidateRegion - Returns the state with bindings for the given region
222 /// cleared from the store. See invalidateRegions.
223 const GRState *invalidateRegion(const MemRegion *R,
224 const Expr *E, unsigned BlockCount,
225 StoreManager::InvalidatedSymbols *IS = NULL)
227 return invalidateRegions(&R, &R+1, E, BlockCount, IS, false);
230 /// invalidateRegions - Returns the state with bindings for the given regions
231 /// cleared from the store. The regions are provided as a continuous array
232 /// from Begin to End. Optionally invalidates global regions as well.
233 const GRState *invalidateRegions(const MemRegion * const *Begin,
234 const MemRegion * const *End,
235 const Expr *E, unsigned BlockCount,
236 StoreManager::InvalidatedSymbols *IS,
237 bool invalidateGlobals) const;
239 /// enterStackFrame - Returns the state for entry to the given stack frame,
240 /// preserving the current state.
241 const GRState *enterStackFrame(const StackFrameContext *frame) const;
243 /// Get the lvalue for a variable reference.
244 Loc getLValue(const VarDecl *D, const LocationContext *LC) const;
246 /// Get the lvalue for a StringLiteral.
247 Loc getLValue(const StringLiteral *literal) const;
249 Loc getLValue(const CompoundLiteralExpr *literal,
250 const LocationContext *LC) const;
252 /// Get the lvalue for an ivar reference.
253 SVal getLValue(const ObjCIvarDecl *decl, SVal base) const;
255 /// Get the lvalue for a field reference.
256 SVal getLValue(const FieldDecl *decl, SVal Base) const;
258 /// Get the lvalue for an array index.
259 SVal getLValue(QualType ElementType, SVal Idx, SVal Base) const;
261 const llvm::APSInt *getSymVal(SymbolRef sym) const;
263 /// Returns the SVal bound to the statement 'S' in the state's environment.
264 SVal getSVal(const Stmt* S) const;
266 SVal getSValAsScalarOrLoc(const Stmt *Ex) const;
268 SVal getSVal(Loc LV, QualType T = QualType()) const;
270 /// Returns the "raw" SVal bound to LV before any value simplfication.
271 SVal getRawSVal(Loc LV, QualType T= QualType()) const;
273 SVal getSVal(const MemRegion* R) const;
275 SVal getSValAsScalarOrLoc(const MemRegion *R) const;
277 const llvm::APSInt *getSymVal(SymbolRef sym);
279 bool scanReachableSymbols(SVal val, SymbolVisitor& visitor) const;
281 bool scanReachableSymbols(const SVal *I, const SVal *E,
282 SymbolVisitor &visitor) const;
284 bool scanReachableSymbols(const MemRegion * const *I,
285 const MemRegion * const *E,
286 SymbolVisitor &visitor) const;
288 template <typename CB> CB scanReachableSymbols(SVal val) const;
289 template <typename CB> CB scanReachableSymbols(const SVal *beg,
290 const SVal *end) const;
292 template <typename CB> CB
293 scanReachableSymbols(const MemRegion * const *beg,
294 const MemRegion * const *end) const;
296 //==---------------------------------------------------------------------==//
297 // Accessing the Generic Data Map (GDM).
298 //==---------------------------------------------------------------------==//
300 void* const* FindGDM(void* K) const;
303 const GRState *add(typename GRStateTrait<T>::key_type K) const;
305 template <typename T>
306 typename GRStateTrait<T>::data_type
308 return GRStateTrait<T>::MakeData(FindGDM(GRStateTrait<T>::GDMIndex()));
312 typename GRStateTrait<T>::lookup_type
313 get(typename GRStateTrait<T>::key_type key) const {
314 void* const* d = FindGDM(GRStateTrait<T>::GDMIndex());
315 return GRStateTrait<T>::Lookup(GRStateTrait<T>::MakeData(d), key);
318 template <typename T>
319 typename GRStateTrait<T>::context_type get_context() const;
323 const GRState *remove(typename GRStateTrait<T>::key_type K) const;
326 const GRState *remove(typename GRStateTrait<T>::key_type K,
327 typename GRStateTrait<T>::context_type C) const;
328 template <typename T>
329 const GRState *remove() const;
332 const GRState *set(typename GRStateTrait<T>::data_type D) const;
335 const GRState *set(typename GRStateTrait<T>::key_type K,
336 typename GRStateTrait<T>::value_type E) const;
339 const GRState *set(typename GRStateTrait<T>::key_type K,
340 typename GRStateTrait<T>::value_type E,
341 typename GRStateTrait<T>::context_type C) const;
344 bool contains(typename GRStateTrait<T>::key_type key) const {
345 void* const* d = FindGDM(GRStateTrait<T>::GDMIndex());
346 return GRStateTrait<T>::Contains(GRStateTrait<T>::MakeData(d), key);
349 // State pretty-printing.
352 virtual ~Printer() {}
353 virtual void Print(llvm::raw_ostream& Out, const GRState* state,
354 const char* nl, const char* sep) = 0;
358 void print(llvm::raw_ostream& Out, CFG &C, const char *nl = "\n",
359 const char *sep = "") const;
361 void printStdErr(CFG &C) const;
363 void printDOT(llvm::raw_ostream& Out, CFG &C) const;
366 /// Increments the number of times this state is referenced by ExplodeNodes.
367 void incrementReferenceCount() { ++refCount; }
369 /// Decrement the number of times this state is referenced by ExplodeNodes.
370 void decrementReferenceCount() {
371 assert(refCount > 0);
377 typedef llvm::SmallPtrSet<const GRState*,5> ImplTy;
382 inline void Add(const GRState* St) {
386 typedef ImplTy::const_iterator iterator;
388 inline unsigned size() const { return Impl.size(); }
389 inline bool empty() const { return Impl.empty(); }
391 inline iterator begin() const { return Impl.begin(); }
392 inline iterator end() const { return Impl.end(); }
399 AutoPopulate(GRStateSet& s, const GRState* st)
400 : S(s), StartSize(S.size()), St(st) {}
403 if (StartSize == S.size())
409 //===----------------------------------------------------------------------===//
410 // GRStateManager - Factory object for GRStates.
411 //===----------------------------------------------------------------------===//
413 class GRStateManager {
414 friend class GRState;
415 friend class ExprEngine; // FIXME: Remove.
417 /// Eng - The SubEngine that owns this state manager.
418 SubEngine *Eng; /* Can be null. */
420 EnvironmentManager EnvMgr;
421 llvm::OwningPtr<StoreManager> StoreMgr;
422 llvm::OwningPtr<ConstraintManager> ConstraintMgr;
424 GRState::GenericDataMap::Factory GDMFactory;
426 typedef llvm::DenseMap<void*,std::pair<void*,void (*)(void*)> > GDMContextsTy;
427 GDMContextsTy GDMContexts;
429 /// Printers - A set of printer objects used for pretty-printing a GRState.
430 /// GRStateManager owns these objects.
431 std::vector<GRState::Printer*> Printers;
433 /// StateSet - FoldingSet containing all the states created for analyzing
434 /// a particular function. This is used to unique states.
435 llvm::FoldingSet<GRState> StateSet;
437 /// Object that manages the data for all created SVals.
438 llvm::OwningPtr<SValBuilder> svalBuilder;
440 /// A BumpPtrAllocator to allocate states.
441 llvm::BumpPtrAllocator &Alloc;
443 /// A vector of recently allocated GRStates that can potentially be
445 std::vector<GRState *> recentlyAllocatedStates;
447 /// A vector of GRStates that we can reuse.
448 std::vector<GRState *> freeStates;
451 GRStateManager(ASTContext& Ctx,
452 StoreManagerCreator CreateStoreManager,
453 ConstraintManagerCreator CreateConstraintManager,
454 llvm::BumpPtrAllocator& alloc,
459 svalBuilder(createSimpleSValBuilder(alloc, Ctx, *this)),
461 StoreMgr.reset((*CreateStoreManager)(*this));
462 ConstraintMgr.reset((*CreateConstraintManager)(*this, subeng));
465 GRStateManager(ASTContext& Ctx,
466 StoreManagerCreator CreateStoreManager,
467 ConstraintManager* ConstraintManagerPtr,
468 llvm::BumpPtrAllocator& alloc)
472 svalBuilder(createSimpleSValBuilder(alloc, Ctx, *this)),
474 StoreMgr.reset((*CreateStoreManager)(*this));
475 ConstraintMgr.reset(ConstraintManagerPtr);
480 const GRState *getInitialState(const LocationContext *InitLoc);
482 ASTContext &getContext() { return svalBuilder->getContext(); }
483 const ASTContext &getContext() const { return svalBuilder->getContext(); }
485 BasicValueFactory &getBasicVals() {
486 return svalBuilder->getBasicValueFactory();
488 const BasicValueFactory& getBasicVals() const {
489 return svalBuilder->getBasicValueFactory();
492 SValBuilder &getSValBuilder() {
496 SymbolManager &getSymbolManager() {
497 return svalBuilder->getSymbolManager();
499 const SymbolManager &getSymbolManager() const {
500 return svalBuilder->getSymbolManager();
503 llvm::BumpPtrAllocator& getAllocator() { return Alloc; }
505 MemRegionManager& getRegionManager() {
506 return svalBuilder->getRegionManager();
508 const MemRegionManager& getRegionManager() const {
509 return svalBuilder->getRegionManager();
512 StoreManager& getStoreManager() { return *StoreMgr; }
513 ConstraintManager& getConstraintManager() { return *ConstraintMgr; }
514 SubEngine* getOwningEngine() { return Eng; }
516 const GRState* removeDeadBindings(const GRState* St,
517 const StackFrameContext *LCtx,
518 SymbolReaper& SymReaper);
520 /// Marshal a new state for the callee in another translation unit.
521 /// 'state' is owned by the caller's engine.
522 const GRState *MarshalState(const GRState *state, const StackFrameContext *L);
526 SVal ArrayToPointer(Loc Array) {
527 return StoreMgr->ArrayToPointer(Array);
530 // Methods that manipulate the GDM.
531 const GRState* addGDM(const GRState* St, void* Key, void* Data);
532 const GRState *removeGDM(const GRState *state, void *Key);
534 // Methods that query & manipulate the Store.
536 void iterBindings(const GRState* state, StoreManager::BindingsHandler& F) {
537 StoreMgr->iterBindings(state->getStore(), F);
540 const GRState* getPersistentState(GRState& Impl);
542 /// Periodically called by ExprEngine to recycle GRStates that were
543 /// created but never used for creating an ExplodedNode.
544 void recycleUnusedStates();
546 //==---------------------------------------------------------------------==//
547 // Generic Data Map methods.
548 //==---------------------------------------------------------------------==//
550 // GRStateManager and GRState support a "generic data map" that allows
551 // different clients of GRState objects to embed arbitrary data within a
552 // GRState object. The generic data map is essentially an immutable map
553 // from a "tag" (that acts as the "key" for a client) and opaque values.
554 // Tags/keys and values are simply void* values. The typical way that clients
555 // generate unique tags are by taking the address of a static variable.
556 // Clients are responsible for ensuring that data values referred to by a
557 // the data pointer are immutable (and thus are essentially purely functional
560 // The templated methods below use the GRStateTrait<T> class
561 // to resolve keys into the GDM and to return data values to clients.
564 // Trait based GDM dispatch.
565 template <typename T>
566 const GRState* set(const GRState* st, typename GRStateTrait<T>::data_type D) {
567 return addGDM(st, GRStateTrait<T>::GDMIndex(),
568 GRStateTrait<T>::MakeVoidPtr(D));
572 const GRState* set(const GRState* st,
573 typename GRStateTrait<T>::key_type K,
574 typename GRStateTrait<T>::value_type V,
575 typename GRStateTrait<T>::context_type C) {
577 return addGDM(st, GRStateTrait<T>::GDMIndex(),
578 GRStateTrait<T>::MakeVoidPtr(GRStateTrait<T>::Set(st->get<T>(), K, V, C)));
581 template <typename T>
582 const GRState* add(const GRState* st,
583 typename GRStateTrait<T>::key_type K,
584 typename GRStateTrait<T>::context_type C) {
585 return addGDM(st, GRStateTrait<T>::GDMIndex(),
586 GRStateTrait<T>::MakeVoidPtr(GRStateTrait<T>::Add(st->get<T>(), K, C)));
589 template <typename T>
590 const GRState* remove(const GRState* st,
591 typename GRStateTrait<T>::key_type K,
592 typename GRStateTrait<T>::context_type C) {
594 return addGDM(st, GRStateTrait<T>::GDMIndex(),
595 GRStateTrait<T>::MakeVoidPtr(GRStateTrait<T>::Remove(st->get<T>(), K, C)));
598 template <typename T>
599 const GRState *remove(const GRState *st) {
600 return removeGDM(st, GRStateTrait<T>::GDMIndex());
603 void* FindGDMContext(void* index,
604 void* (*CreateContext)(llvm::BumpPtrAllocator&),
605 void (*DeleteContext)(void*));
607 template <typename T>
608 typename GRStateTrait<T>::context_type get_context() {
609 void* p = FindGDMContext(GRStateTrait<T>::GDMIndex(),
610 GRStateTrait<T>::CreateContext,
611 GRStateTrait<T>::DeleteContext);
613 return GRStateTrait<T>::MakeContext(p);
616 const llvm::APSInt* getSymVal(const GRState* St, SymbolRef sym) {
617 return ConstraintMgr->getSymVal(St, sym);
620 void EndPath(const GRState* St) {
621 ConstraintMgr->EndPath(St);
626 //===----------------------------------------------------------------------===//
627 // Out-of-line method definitions for GRState.
628 //===----------------------------------------------------------------------===//
630 inline const llvm::APSInt *GRState::getSymVal(SymbolRef sym) {
631 return getStateManager().getSymVal(this, sym);
634 inline const VarRegion* GRState::getRegion(const VarDecl *D,
635 const LocationContext *LC) const {
636 return getStateManager().getRegionManager().getVarRegion(D, LC);
639 inline const GRState *GRState::assume(DefinedOrUnknownSVal Cond,
640 bool Assumption) const {
641 if (Cond.isUnknown())
644 return getStateManager().ConstraintMgr->assume(this, cast<DefinedSVal>(Cond),
648 inline std::pair<const GRState*, const GRState*>
649 GRState::assume(DefinedOrUnknownSVal Cond) const {
650 if (Cond.isUnknown())
651 return std::make_pair(this, this);
653 return getStateManager().ConstraintMgr->assumeDual(this,
654 cast<DefinedSVal>(Cond));
657 inline const GRState *GRState::bindLoc(SVal LV, SVal V) const {
658 return !isa<Loc>(LV) ? this : bindLoc(cast<Loc>(LV), V);
661 inline Loc GRState::getLValue(const VarDecl* VD,
662 const LocationContext *LC) const {
663 return getStateManager().StoreMgr->getLValueVar(VD, LC);
666 inline Loc GRState::getLValue(const StringLiteral *literal) const {
667 return getStateManager().StoreMgr->getLValueString(literal);
670 inline Loc GRState::getLValue(const CompoundLiteralExpr *literal,
671 const LocationContext *LC) const {
672 return getStateManager().StoreMgr->getLValueCompoundLiteral(literal, LC);
675 inline SVal GRState::getLValue(const ObjCIvarDecl *D, SVal Base) const {
676 return getStateManager().StoreMgr->getLValueIvar(D, Base);
679 inline SVal GRState::getLValue(const FieldDecl* D, SVal Base) const {
680 return getStateManager().StoreMgr->getLValueField(D, Base);
683 inline SVal GRState::getLValue(QualType ElementType, SVal Idx, SVal Base) const{
684 if (NonLoc *N = dyn_cast<NonLoc>(&Idx))
685 return getStateManager().StoreMgr->getLValueElement(ElementType, *N, Base);
689 inline const llvm::APSInt *GRState::getSymVal(SymbolRef sym) const {
690 return getStateManager().getSymVal(this, sym);
693 inline SVal GRState::getSVal(const Stmt* Ex) const {
694 return Env.getSVal(Ex, *getStateManager().svalBuilder);
697 inline SVal GRState::getSValAsScalarOrLoc(const Stmt *S) const {
698 if (const Expr *Ex = dyn_cast<Expr>(S)) {
699 QualType T = Ex->getType();
700 if (Loc::isLocType(T) || T->isIntegerType())
707 inline SVal GRState::getRawSVal(Loc LV, QualType T) const {
708 return getStateManager().StoreMgr->Retrieve(getStore(), LV, T);
711 inline SVal GRState::getSVal(const MemRegion* R) const {
712 return getStateManager().StoreMgr->Retrieve(getStore(), loc::MemRegionVal(R));
715 inline BasicValueFactory &GRState::getBasicVals() const {
716 return getStateManager().getBasicVals();
719 inline SymbolManager &GRState::getSymbolManager() const {
720 return getStateManager().getSymbolManager();
724 const GRState *GRState::add(typename GRStateTrait<T>::key_type K) const {
725 return getStateManager().add<T>(this, K, get_context<T>());
728 template <typename T>
729 typename GRStateTrait<T>::context_type GRState::get_context() const {
730 return getStateManager().get_context<T>();
734 const GRState *GRState::remove(typename GRStateTrait<T>::key_type K) const {
735 return getStateManager().remove<T>(this, K, get_context<T>());
739 const GRState *GRState::remove(typename GRStateTrait<T>::key_type K,
740 typename GRStateTrait<T>::context_type C) const {
741 return getStateManager().remove<T>(this, K, C);
744 template <typename T>
745 const GRState *GRState::remove() const {
746 return getStateManager().remove<T>(this);
750 const GRState *GRState::set(typename GRStateTrait<T>::data_type D) const {
751 return getStateManager().set<T>(this, D);
755 const GRState *GRState::set(typename GRStateTrait<T>::key_type K,
756 typename GRStateTrait<T>::value_type E) const {
757 return getStateManager().set<T>(this, K, E, get_context<T>());
761 const GRState *GRState::set(typename GRStateTrait<T>::key_type K,
762 typename GRStateTrait<T>::value_type E,
763 typename GRStateTrait<T>::context_type C) const {
764 return getStateManager().set<T>(this, K, E, C);
767 template <typename CB>
768 CB GRState::scanReachableSymbols(SVal val) const {
770 scanReachableSymbols(val, cb);
774 template <typename CB>
775 CB GRState::scanReachableSymbols(const SVal *beg, const SVal *end) const {
777 scanReachableSymbols(beg, end, cb);
781 template <typename CB>
782 CB GRState::scanReachableSymbols(const MemRegion * const *beg,
783 const MemRegion * const *end) const {
785 scanReachableSymbols(beg, end, cb);
789 } // end GR namespace
791 } // end clang namespace