Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit 63d3201

Browse files
committed
ProgramPoint cleanup after the previous commit r141408 (remove the copy constructor, mark withTag const).
Move getProgramPoint() utility from CoreEngine.cpp into ProgramPoint. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141414 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 8828ee7 commit 63d3201

File tree

3 files changed

+33
-31
lines changed

3 files changed

+33
-31
lines changed

Diff for: include/clang/Analysis/ProgramPoint.h

+6-4
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,9 @@ class ProgramPoint {
7878
const void *getData2() const { return Data.second; }
7979

8080
public:
81-
ProgramPoint(const ProgramPoint &P)
82-
: Data(P.Data), K(P.K), L(P.L), Tag(P.Tag) {}
83-
8481
/// Create a new ProgramPoint object that is the same as the original
8582
/// except for using the specified tag value.
86-
ProgramPoint withTag(const ProgramPointTag *tag) {
83+
ProgramPoint withTag(const ProgramPointTag *tag) const {
8784
return ProgramPoint(Data.first, Data.second, K, L, tag);
8885
}
8986

@@ -117,6 +114,11 @@ class ProgramPoint {
117114
ID.AddPointer(L);
118115
ID.AddPointer(Tag);
119116
}
117+
118+
static ProgramPoint getProgramPoint(const Stmt *S, ProgramPoint::Kind K,
119+
const LocationContext *LC,
120+
const ProgramPointTag *tag);
121+
120122
};
121123

122124
class BlockEntrance : public ProgramPoint {

Diff for: lib/Analysis/ProgramPoint.cpp

+25
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,31 @@ using namespace clang;
1818

1919
ProgramPointTag::~ProgramPointTag() {}
2020

21+
ProgramPoint ProgramPoint::getProgramPoint(const Stmt *S, ProgramPoint::Kind K,
22+
const LocationContext *LC,
23+
const ProgramPointTag *tag){
24+
switch (K) {
25+
default:
26+
llvm_unreachable("Unhandled ProgramPoint kind");
27+
case ProgramPoint::PreStmtKind:
28+
return PreStmt(S, LC, tag);
29+
case ProgramPoint::PostStmtKind:
30+
return PostStmt(S, LC, tag);
31+
case ProgramPoint::PreLoadKind:
32+
return PreLoad(S, LC, tag);
33+
case ProgramPoint::PostLoadKind:
34+
return PostLoad(S, LC, tag);
35+
case ProgramPoint::PreStoreKind:
36+
return PreStore(S, LC, tag);
37+
case ProgramPoint::PostStoreKind:
38+
return PostStore(S, LC, tag);
39+
case ProgramPoint::PostLValueKind:
40+
return PostLValue(S, LC, tag);
41+
case ProgramPoint::PostPurgeDeadSymbolsKind:
42+
return PostPurgeDeadSymbols(S, LC, tag);
43+
}
44+
}
45+
2146
SimpleProgramPointTag::SimpleProgramPointTag(StringRef description)
2247
: desc(description) {}
2348

Diff for: lib/StaticAnalyzer/Core/CoreEngine.cpp

+2-27
Original file line numberDiff line numberDiff line change
@@ -541,40 +541,15 @@ ExplodedNode *StmtNodeBuilder::MakeNode(ExplodedNodeSet &Dst,
541541
return N;
542542
}
543543

544-
static ProgramPoint GetProgramPoint(const Stmt *S, ProgramPoint::Kind K,
545-
const LocationContext *LC,
546-
const ProgramPointTag *tag){
547-
switch (K) {
548-
default:
549-
llvm_unreachable("Unhandled ProgramPoint kind");
550-
case ProgramPoint::PreStmtKind:
551-
return PreStmt(S, LC, tag);
552-
case ProgramPoint::PostStmtKind:
553-
return PostStmt(S, LC, tag);
554-
case ProgramPoint::PreLoadKind:
555-
return PreLoad(S, LC, tag);
556-
case ProgramPoint::PostLoadKind:
557-
return PostLoad(S, LC, tag);
558-
case ProgramPoint::PreStoreKind:
559-
return PreStore(S, LC, tag);
560-
case ProgramPoint::PostStoreKind:
561-
return PostStore(S, LC, tag);
562-
case ProgramPoint::PostLValueKind:
563-
return PostLValue(S, LC, tag);
564-
case ProgramPoint::PostPurgeDeadSymbolsKind:
565-
return PostPurgeDeadSymbols(S, LC, tag);
566-
}
567-
}
568-
569544
ExplodedNode*
570545
StmtNodeBuilder::generateNodeInternal(const Stmt *S,
571546
const ProgramState *state,
572547
ExplodedNode *Pred,
573548
ProgramPoint::Kind K,
574549
const ProgramPointTag *tag) {
575550

576-
const ProgramPoint &L = GetProgramPoint(S, K, Pred->getLocationContext(),
577-
tag);
551+
const ProgramPoint &L = ProgramPoint::getProgramPoint(S, K,
552+
Pred->getLocationContext(), tag);
578553
return generateNodeInternal(L, state, Pred);
579554
}
580555

0 commit comments

Comments
 (0)