[cfe-commits] r54704 - in /cfe/trunk: include/clang/Analysis/PathSensitive/ValueState.h lib/Analysis/ValueState.cpp
Ted Kremenek
kremenek at apple.com
Tue Aug 12 14:49:25 PDT 2008
Author: kremenek
Date: Tue Aug 12 16:49:24 2008
New Revision: 54704
URL: http://llvm.org/viewvc/llvm-project?rev=54704&view=rev
Log:
Added GenericDataMap as a component of ValueState.
Modified:
cfe/trunk/include/clang/Analysis/PathSensitive/ValueState.h
cfe/trunk/lib/Analysis/ValueState.cpp
Modified: cfe/trunk/include/clang/Analysis/PathSensitive/ValueState.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/ValueState.h?rev=54704&r1=54703&r2=54704&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/ValueState.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/ValueState.h Tue Aug 12 16:49:24 2008
@@ -55,6 +55,7 @@
public:
// Typedefs.
typedef llvm::ImmutableSet<llvm::APSInt*> IntSetTy;
+ typedef llvm::ImmutableMap<void*, void*> GenericDataMap;
typedef llvm::ImmutableMap<SymbolID,IntSetTy> ConstNotEqTy;
typedef llvm::ImmutableMap<SymbolID,const llvm::APSInt*> ConstEqTy;
@@ -70,6 +71,7 @@
// FIXME: Make these private.
public:
+ GenericDataMap GDM;
ConstNotEqTy ConstNotEq;
ConstEqTy ConstEq;
void* CheckerState;
@@ -77,10 +79,11 @@
public:
/// This ctor is used when creating the first ValueState object.
- ValueState(const Environment& env, Store st,
+ ValueState(const Environment& env, Store st, GenericDataMap gdm,
ConstNotEqTy CNE, ConstEqTy CE)
: Env(env),
St(st),
+ GDM(gdm),
ConstNotEq(CNE),
ConstEq(CE),
CheckerState(NULL) {}
@@ -91,6 +94,7 @@
: llvm::FoldingSetNode(),
Env(RHS.Env),
St(RHS.St),
+ GDM(RHS.GDM),
ConstNotEq(RHS.ConstNotEq),
ConstEq(RHS.ConstEq),
CheckerState(RHS.CheckerState) {}
@@ -103,11 +107,15 @@
/// is a mapping from locations to values.
Store getStore() const { return St; }
+ /// getGDM - Return the generic data map associated with this state.
+ GenericDataMap getGDM() const { return GDM; }
+
/// Profile - Profile the contents of a ValueState object for use
/// in a FoldingSet.
static void Profile(llvm::FoldingSetNodeID& ID, const ValueState* V) {
V->Env.Profile(ID);
ID.AddPointer(V->St);
+ V->GDM.Profile(ID);
V->ConstNotEq.Profile(ID);
V->ConstEq.Profile(ID);
ID.AddPointer(V->CheckerState);
@@ -228,6 +236,7 @@
EnvironmentManager EnvMgr;
llvm::OwningPtr<StoreManager> StMgr;
ValueState::IntSetTy::Factory ISetFactory;
+ ValueState::GenericDataMap::Factory GDMFactory;
ValueState::ConstNotEqTy::Factory CNEFactory;
ValueState::ConstEqTy::Factory CEFactory;
@@ -276,6 +285,7 @@
: EnvMgr(alloc),
StMgr(stmgr),
ISetFactory(alloc),
+ GDMFactory(alloc),
CNEFactory(alloc),
CEFactory(alloc),
BasicVals(Ctx, alloc),
@@ -338,9 +348,21 @@
return SetRVal(St, Ex, V, isBlkExpr, true);
}
+
+ // Methods that manipulate the GDM.
+ const ValueState* addGDM(const ValueState* St, void* Key, void* Data) {
+ ValueState::GenericDataMap M1 = St->getGDM();
+ ValueState::GenericDataMap M2 = GDMFactory.Add(M2, Key, Data);
+
+ if (M1 == M2)
+ return St;
+
+ ValueState NewSt = *St;
+ NewSt.GDM = M2;
+ return getPersistentState(NewSt);
+ }
// Methods that query & manipulate the Store.
-
RVal GetRVal(const ValueState* St, LVal LV, QualType T = QualType()) {
return StMgr->GetRVal(St->getStore(), LV, T);
}
Modified: cfe/trunk/lib/Analysis/ValueState.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/ValueState.cpp?rev=54704&r1=54703&r2=54704&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/ValueState.cpp (original)
+++ cfe/trunk/lib/Analysis/ValueState.cpp Tue Aug 12 16:49:24 2008
@@ -180,6 +180,7 @@
ValueState StateImpl(EnvMgr.getInitialEnvironment(),
StMgr->getInitialStore(),
+ GDMFactory.GetEmptyMap(),
CNEFactory.GetEmptyMap(),
CEFactory.GetEmptyMap());
More information about the cfe-commits
mailing list