forked from OSchip/llvm-project
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:
parent
8b02d36a23
commit
8de8cfdd21
|
@ -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 {
|
||||
|
|
|
@ -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) {}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue