Skip to content

Commit 8bcfd08

Browse files
authored
Merge pull request #462 from secure-software-engineering/f-ClangTidyFixWPDS
clang-tidy: Fix WPDS
2 parents ff48eb8 + 4a92909 commit 8bcfd08

10 files changed

Lines changed: 445 additions & 436 deletions

File tree

include/phasar/PhasarLLVM/DataFlowSolver/WPDS/JoinLatticeToSemiRingElem.h

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,60 +28,64 @@ namespace psr {
2828
*/
2929
template <typename V> class JoinLatticeToSemiRingElem : public wali::SemElem {
3030
public:
31-
std::shared_ptr<EdgeFunction<V>> F;
32-
JoinLattice<V> &L;
33-
V v;
31+
std::shared_ptr<EdgeFunction<V>> EdgeFunc;
32+
JoinLattice<V> &Lattice;
33+
V Val;
3434

3535
JoinLatticeToSemiRingElem(std::shared_ptr<EdgeFunction<V>> F,
3636
JoinLattice<V> &L)
37-
: wali::SemElem(), F(F), L(L) {}
37+
: wali::SemElem(), EdgeFunc(F), Lattice(L) {}
38+
3839
~JoinLatticeToSemiRingElem() override = default;
3940

40-
std::ostream &print(std::ostream &os) const override { return os << *F; }
41+
std::ostream &print(std::ostream &OS) const override {
42+
return OS << *EdgeFunc;
43+
}
4144

4245
[[nodiscard]] wali::sem_elem_t one() const override {
4346
// std::cout << "JoinLatticeToSemiRingElem::one()" << std::endl;
4447
return wali::ref_ptr<JoinLatticeToSemiRingElem<V>>(
4548
new JoinLatticeToSemiRingElem(
46-
std::make_shared<AllBottom<V>>(L.bottomElement()), L));
49+
std::make_shared<AllBottom<V>>(Lattice.bottomElement()), Lattice));
4750
}
4851

4952
[[nodiscard]] wali::sem_elem_t zero() const override {
5053
// std::cout << "JoinLatticeToSemiRingElem::zero()" << std::endl;
5154
return wali::ref_ptr<JoinLatticeToSemiRingElem<V>>(
5255
new JoinLatticeToSemiRingElem(
53-
std::make_shared<AllTop<V>>(L.topElement()), L));
56+
std::make_shared<AllTop<V>>(Lattice.topElement()), Lattice));
5457
}
5558

56-
wali::sem_elem_t extend(SemElem *se) override {
59+
[[nodiscard]] wali::sem_elem_t extend(SemElem *SE) override {
5760
// std::cout << "JoinLatticeToSemiRingElem::extend()" << std::endl;
5861
auto ThisF = static_cast<JoinLatticeToSemiRingElem *>(this);
59-
auto ThatF = static_cast<JoinLatticeToSemiRingElem *>(se);
62+
auto ThatF = static_cast<JoinLatticeToSemiRingElem *>(SE);
6063
return wali::ref_ptr<JoinLatticeToSemiRingElem<V>>(
61-
new JoinLatticeToSemiRingElem(ThisF->F->composeWith(ThatF->F), L));
64+
new JoinLatticeToSemiRingElem(ThisF->F->composeWith(ThatF->F),
65+
Lattice));
6266
}
6367

64-
wali::sem_elem_t combine(SemElem *se) override {
68+
[[nodiscard]] wali::sem_elem_t combine(SemElem *SE) override {
6569
// std::cout << "JoinLatticeToSemiRingElem::combine()" << std::endl;
6670
auto ThisF = static_cast<JoinLatticeToSemiRingElem *>(this);
67-
auto ThatF = static_cast<JoinLatticeToSemiRingElem *>(se);
71+
auto ThatF = static_cast<JoinLatticeToSemiRingElem *>(SE);
6872
return wali::ref_ptr<JoinLatticeToSemiRingElem<V>>(
69-
new JoinLatticeToSemiRingElem(ThisF->F->joinWith(ThatF->F), L));
73+
new JoinLatticeToSemiRingElem(ThisF->F->joinWith(ThatF->F), Lattice));
7074
}
7175

72-
bool equal(SemElem *se) const override {
76+
[[nodiscard]] bool equal(SemElem *SE) const override {
7377
// std::cout << "JoinLatticeToSemiRingElem::equal()" << std::endl;
7478
auto ThisF = static_cast<const JoinLatticeToSemiRingElem *>(this);
75-
auto ThatF = static_cast<const JoinLatticeToSemiRingElem *>(se);
79+
auto ThatF = static_cast<const JoinLatticeToSemiRingElem *>(SE);
7680
return ThisF->F->equal_to(ThatF->F);
7781
}
7882
};
7983

8084
template <typename V>
81-
std::ostream &operator<<(std::ostream &os,
85+
std::ostream &operator<<(std::ostream &OS,
8286
const JoinLatticeToSemiRingElem<V> &ETS) {
83-
ETS.print(os);
84-
return os;
87+
ETS.print(OS);
88+
return OS;
8589
}
8690

8791
} // namespace psr

include/phasar/PhasarLLVM/DataFlowSolver/WPDS/Problems/WPDSAliasCollector.h

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -47,44 +47,44 @@ class WPDSAliasCollector
4747

4848
~WPDSAliasCollector() override = default;
4949

50-
FlowFunctionPtrType getNormalFlowFunction(n_t curr, n_t succ) override;
51-
FlowFunctionPtrType getCallFlowFunction(n_t callSite, f_t destFun) override;
52-
FlowFunctionPtrType getRetFlowFunction(n_t callSite, f_t calleeFun,
53-
n_t ExitInst, n_t retSite) override;
54-
FlowFunctionPtrType getCallToRetFlowFunction(n_t callSite, n_t retSite,
55-
std::set<f_t> callees) override;
56-
FlowFunctionPtrType getSummaryFlowFunction(n_t curr, f_t destFun) override;
50+
FlowFunctionPtrType getNormalFlowFunction(n_t Curr, n_t Succ) override;
51+
FlowFunctionPtrType getCallFlowFunction(n_t CallSite, f_t DestFun) override;
52+
FlowFunctionPtrType getRetFlowFunction(n_t CallSite, f_t CalleeFun,
53+
n_t ExitInst, n_t RetSite) override;
54+
FlowFunctionPtrType getCallToRetFlowFunction(n_t CallSite, n_t RetSite,
55+
std::set<f_t> Callees) override;
56+
FlowFunctionPtrType getSummaryFlowFunction(n_t Curr, f_t DestFun) override;
5757

5858
std::shared_ptr<EdgeFunction<l_t>>
59-
getNormalEdgeFunction(n_t curr, d_t currNode, n_t succ,
60-
d_t succNode) override;
59+
getNormalEdgeFunction(n_t Curr, d_t CurrNode, n_t Succ,
60+
d_t SuccNode) override;
6161
std::shared_ptr<EdgeFunction<l_t>>
62-
getCallEdgeFunction(n_t callSite, d_t srcNode, f_t destinationFunction,
63-
d_t destNode) override;
62+
getCallEdgeFunction(n_t CallSite, d_t SrcNode, f_t DestinationFunction,
63+
d_t DestNode) override;
6464
std::shared_ptr<EdgeFunction<l_t>>
65-
getReturnEdgeFunction(n_t callSite, f_t calleeFunction, n_t ExitInst,
66-
d_t exitNode, n_t reSite, d_t retNode) override;
65+
getReturnEdgeFunction(n_t CallSite, f_t CalleeFunction, n_t ExitInst,
66+
d_t ExitNode, n_t RetSite, d_t RetNode) override;
6767
std::shared_ptr<EdgeFunction<l_t>>
68-
getCallToRetEdgeFunction(n_t callSite, d_t callNode, n_t retSite,
69-
d_t retSiteNode, std::set<f_t> callees) override;
68+
getCallToRetEdgeFunction(n_t CallSite, d_t CallNode, n_t RetSite,
69+
d_t RetSiteNode, std::set<f_t> Callees) override;
7070
std::shared_ptr<EdgeFunction<l_t>>
71-
getSummaryEdgeFunction(n_t curr, d_t currNode, n_t succ,
72-
d_t succNode) override;
71+
getSummaryEdgeFunction(n_t Curr, d_t CurrNode, n_t Succ,
72+
d_t SuccNode) override;
7373

7474
l_t topElement() override;
7575
l_t bottomElement() override;
76-
l_t join(l_t lhs, l_t rhs) override;
76+
l_t join(l_t Lhs, l_t Rhs) override;
7777

78-
bool isZeroValue(WPDSAliasCollector::d_t d) const override;
78+
bool isZeroValue(WPDSAliasCollector::d_t Fact) const override;
7979

8080
InitialSeeds<n_t, d_t, l_t> initialSeeds() override;
8181

8282
std::shared_ptr<EdgeFunction<l_t>> allTopFunction() override;
8383

84-
void printNode(std::ostream &os, n_t n) const override;
85-
void printDataFlowFact(std::ostream &os, d_t d) const override;
86-
void printFunction(std::ostream &os, f_t m) const override;
87-
void printEdgeFact(std::ostream &os, l_t v) const override;
84+
void printNode(std::ostream &OS, n_t Stmt) const override;
85+
void printDataFlowFact(std::ostream &OS, d_t Fact) const override;
86+
void printFunction(std::ostream &OS, f_t Func) const override;
87+
void printEdgeFact(std::ostream &OS, l_t L) const override;
8888
};
8989

9090
} // namespace psr

include/phasar/PhasarLLVM/DataFlowSolver/WPDS/Problems/WPDSSolverTest.h

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -42,46 +42,46 @@ class WPDSSolverTest : public WPDSProblem<WPDSSolverTestAnalysisDomain> {
4242
const LLVMBasedICFG *ICF, LLVMPointsToInfo *PT,
4343
std::set<std::string> EntryPoints = {"main"});
4444

45-
FlowFunctionPtrType getNormalFlowFunction(n_t curr, n_t succ) override;
46-
FlowFunctionPtrType getCallFlowFunction(n_t callSite, f_t destFun) override;
47-
FlowFunctionPtrType getRetFlowFunction(n_t callSite, f_t calleeFun,
48-
n_t ExitInst, n_t retSite) override;
49-
FlowFunctionPtrType getCallToRetFlowFunction(n_t callSite, n_t retSite,
50-
std::set<f_t> callees) override;
51-
FlowFunctionPtrType getSummaryFlowFunction(n_t curr, f_t destFun) override;
45+
FlowFunctionPtrType getNormalFlowFunction(n_t Curr, n_t Succ) override;
46+
FlowFunctionPtrType getCallFlowFunction(n_t CallSite, f_t DestFun) override;
47+
FlowFunctionPtrType getRetFlowFunction(n_t CallSite, f_t CalleeFun,
48+
n_t ExitStmt, n_t RetSite) override;
49+
FlowFunctionPtrType getCallToRetFlowFunction(n_t CallSite, n_t RetSite,
50+
std::set<f_t> Callees) override;
51+
FlowFunctionPtrType getSummaryFlowFunction(n_t Curr, f_t DestFun) override;
5252

5353
std::shared_ptr<EdgeFunction<l_t>>
54-
getNormalEdgeFunction(n_t curr, d_t currNode, n_t succ,
55-
d_t succNode) override;
54+
getNormalEdgeFunction(n_t Curr, d_t CurrNode, n_t Succ,
55+
d_t SuccNode) override;
5656
std::shared_ptr<EdgeFunction<l_t>>
57-
getCallEdgeFunction(n_t callSite, d_t srcNode, f_t destinationFunction,
58-
d_t destNode) override;
57+
getCallEdgeFunction(n_t CallSite, d_t SrcNode, f_t DestinationFunction,
58+
d_t DestNode) override;
5959
std::shared_ptr<EdgeFunction<l_t>>
60-
getReturnEdgeFunction(n_t callSite, f_t calleeFunction, n_t ExitInst,
61-
d_t exitNode, n_t reSite, d_t retNode) override;
60+
getReturnEdgeFunction(n_t CallSite, f_t CalleeFunction, n_t ExitStmt,
61+
d_t ExitNode, n_t RetSite, d_t RetNode) override;
6262
std::shared_ptr<EdgeFunction<l_t>>
63-
getCallToRetEdgeFunction(n_t callSite, d_t callNode, n_t retSite,
64-
d_t retSiteNode, std::set<f_t> callees) override;
63+
getCallToRetEdgeFunction(n_t CallSite, d_t CallNode, n_t RetSite,
64+
d_t RetSiteNode, std::set<f_t> Callees) override;
6565
std::shared_ptr<EdgeFunction<l_t>>
66-
getSummaryEdgeFunction(n_t curr, d_t currNode, n_t succ,
67-
d_t succNode) override;
66+
getSummaryEdgeFunction(n_t Curr, d_t CurrNode, n_t Succ,
67+
d_t SuccNode) override;
6868

6969
l_t topElement() override;
7070
l_t bottomElement() override;
71-
l_t join(l_t lhs, l_t rhs) override;
71+
l_t join(l_t Lhs, l_t Rhs) override;
7272

7373
[[nodiscard]] d_t createZeroValue() const override;
7474

75-
bool isZeroValue(d_t d) const override;
75+
[[nodiscard]] bool isZeroValue(d_t Fact) const override;
7676

7777
InitialSeeds<n_t, d_t, l_t> initialSeeds() override;
7878

7979
std::shared_ptr<EdgeFunction<l_t>> allTopFunction() override;
8080

81-
void printNode(std::ostream &os, n_t n) const override;
82-
void printDataFlowFact(std::ostream &os, d_t d) const override;
83-
void printFunction(std::ostream &os, f_t m) const override;
84-
void printEdgeFact(std::ostream &os, l_t v) const override;
81+
void printNode(std::ostream &OS, n_t Stmt) const override;
82+
void printDataFlowFact(std::ostream &OS, d_t Fact) const override;
83+
void printFunction(std::ostream &OS, f_t Func) const override;
84+
void printEdgeFact(std::ostream &OS, l_t L) const override;
8585
};
8686

8787
} // namespace psr

0 commit comments

Comments
 (0)