ProgramPoint cleanup after the previous commit r141408 (remove the copy constructor, mark withTag const).

Move getProgramPoint() utility from CoreEngine.cpp into ProgramPoint.

llvm-svn: 141414
This commit is contained in:
Anna Zaks 2011-10-07 21:01:38 +00:00
parent 8b02d36a23
commit 8de8cfdd21
3 changed files with 33 additions and 31 deletions

View File

@ -78,12 +78,9 @@ protected:
const void *getData2() const { return Data.second; }
public:
ProgramPoint(const ProgramPoint &P)
: Data(P.Data), K(P.K), L(P.L), Tag(P.Tag) {}
/// Create a new ProgramPoint object that is the same as the original
/// except for using the specified tag value.
ProgramPoint withTag(const ProgramPointTag *tag) {
ProgramPoint withTag(const ProgramPointTag *tag) const {
return ProgramPoint(Data.first, Data.second, K, L, tag);
}
@ -117,6 +114,11 @@ public:
ID.AddPointer(L);
ID.AddPointer(Tag);
}
static ProgramPoint getProgramPoint(const Stmt *S, ProgramPoint::Kind K,
const LocationContext *LC,
const ProgramPointTag *tag);
};
class BlockEntrance : public ProgramPoint {

View File

@ -18,6 +18,31 @@ using namespace clang;
ProgramPointTag::~ProgramPointTag() {}
ProgramPoint ProgramPoint::getProgramPoint(const Stmt *S, ProgramPoint::Kind K,
const LocationContext *LC,
const ProgramPointTag *tag){
switch (K) {
default:
llvm_unreachable("Unhandled ProgramPoint kind");
case ProgramPoint::PreStmtKind:
return PreStmt(S, LC, tag);
case ProgramPoint::PostStmtKind:
return PostStmt(S, LC, tag);
case ProgramPoint::PreLoadKind:
return PreLoad(S, LC, tag);
case ProgramPoint::PostLoadKind:
return PostLoad(S, LC, tag);
case ProgramPoint::PreStoreKind:
return PreStore(S, LC, tag);
case ProgramPoint::PostStoreKind:
return PostStore(S, LC, tag);
case ProgramPoint::PostLValueKind:
return PostLValue(S, LC, tag);
case ProgramPoint::PostPurgeDeadSymbolsKind:
return PostPurgeDeadSymbols(S, LC, tag);
}
}
SimpleProgramPointTag::SimpleProgramPointTag(StringRef description)
: desc(description) {}

View File

@ -541,31 +541,6 @@ ExplodedNode *StmtNodeBuilder::MakeNode(ExplodedNodeSet &Dst,
return N;
}
static ProgramPoint GetProgramPoint(const Stmt *S, ProgramPoint::Kind K,
const LocationContext *LC,
const ProgramPointTag *tag){
switch (K) {
default:
llvm_unreachable("Unhandled ProgramPoint kind");
case ProgramPoint::PreStmtKind:
return PreStmt(S, LC, tag);
case ProgramPoint::PostStmtKind:
return PostStmt(S, LC, tag);
case ProgramPoint::PreLoadKind:
return PreLoad(S, LC, tag);
case ProgramPoint::PostLoadKind:
return PostLoad(S, LC, tag);
case ProgramPoint::PreStoreKind:
return PreStore(S, LC, tag);
case ProgramPoint::PostStoreKind:
return PostStore(S, LC, tag);
case ProgramPoint::PostLValueKind:
return PostLValue(S, LC, tag);
case ProgramPoint::PostPurgeDeadSymbolsKind:
return PostPurgeDeadSymbols(S, LC, tag);
}
}
ExplodedNode*
StmtNodeBuilder::generateNodeInternal(const Stmt *S,
const ProgramState *state,
@ -573,8 +548,8 @@ StmtNodeBuilder::generateNodeInternal(const Stmt *S,
ProgramPoint::Kind K,
const ProgramPointTag *tag) {
const ProgramPoint &L = GetProgramPoint(S, K, Pred->getLocationContext(),
tag);
const ProgramPoint &L = ProgramPoint::getProgramPoint(S, K,
Pred->getLocationContext(), tag);
return generateNodeInternal(L, state, Pred);
}