From 81032a4001e059fa960af8a3c11896dbc5fcc368 Mon Sep 17 00:00:00 2001 From: Martin Mory Date: Thu, 23 Dec 2021 14:16:20 +0100 Subject: [PATCH 1/3] clang-tidy fixes WPDS solver and problems - mostly renames --- .../WPDS/JoinLatticeToSemiRingElem.h | 38 +- .../WPDS/Problems/WPDSAliasCollector.h | 46 +- .../WPDS/Problems/WPDSSolverTest.h | 46 +- .../DataFlowSolver/WPDS/Solver/WPDSSolver.h | 557 +++++++++--------- .../DataFlowSolver/WPDS/WPDSGenKillProblem.h | 2 +- .../DataFlowSolver/WPDS/WPDSSolverConfig.h | 12 +- .../WPDS/Problems/WPDSAliasCollector.cpp | 74 +-- .../WPDS/Problems/WPDSSolverTest.cpp | 89 +-- .../DataFlowSolver/WPDS/WPDSOptions.cpp | 3 +- .../DataFlowSolver/WPDS/WPDSSolverConfig.cpp | 12 +- 10 files changed, 442 insertions(+), 437 deletions(-) diff --git a/include/phasar/PhasarLLVM/DataFlowSolver/WPDS/JoinLatticeToSemiRingElem.h b/include/phasar/PhasarLLVM/DataFlowSolver/WPDS/JoinLatticeToSemiRingElem.h index bc6d73971a..5bedc23e52 100644 --- a/include/phasar/PhasarLLVM/DataFlowSolver/WPDS/JoinLatticeToSemiRingElem.h +++ b/include/phasar/PhasarLLVM/DataFlowSolver/WPDS/JoinLatticeToSemiRingElem.h @@ -28,60 +28,60 @@ namespace psr { */ template class JoinLatticeToSemiRingElem : public wali::SemElem { public: - std::shared_ptr> F; - JoinLattice &L; - V v; + std::shared_ptr> EdgeFunc; + JoinLattice &Lattice; + V Val; JoinLatticeToSemiRingElem(std::shared_ptr> F, JoinLattice &L) - : wali::SemElem(), F(F), L(L) {} - virtual ~JoinLatticeToSemiRingElem() = default; + : wali::SemElem(), EdgeFunc(F), Lattice(L) {} + ~JoinLatticeToSemiRingElem() override = default; - std::ostream &print(std::ostream &os) const override { return os << *F; } + std::ostream &print(std::ostream &OS) const override { return OS << *EdgeFunc; } wali::sem_elem_t one() const override { // std::cout << "JoinLatticeToSemiRingElem::one()" << std::endl; return wali::ref_ptr>( new JoinLatticeToSemiRingElem( - std::make_shared>(L.bottomElement()), L)); + std::make_shared>(Lattice.bottomElement()), Lattice)); } wali::sem_elem_t zero() const override { // std::cout << "JoinLatticeToSemiRingElem::zero()" << std::endl; return wali::ref_ptr>( new JoinLatticeToSemiRingElem( - std::make_shared>(L.topElement()), L)); + std::make_shared>(Lattice.topElement()), Lattice)); } - wali::sem_elem_t extend(SemElem *se) override { + [[nodiscard]] wali::sem_elem_t extend(SemElem *SE) override { // std::cout << "JoinLatticeToSemiRingElem::extend()" << std::endl; auto ThisF = static_cast(this); - auto ThatF = static_cast(se); + auto ThatF = static_cast(SE); return wali::ref_ptr>( - new JoinLatticeToSemiRingElem(ThisF->F->composeWith(ThatF->F), L)); + new JoinLatticeToSemiRingElem(ThisF->F->composeWith(ThatF->F), Lattice)); } - wali::sem_elem_t combine(SemElem *se) override { + [[nodiscard]] wali::sem_elem_t combine(SemElem *SE) override { // std::cout << "JoinLatticeToSemiRingElem::combine()" << std::endl; auto ThisF = static_cast(this); - auto ThatF = static_cast(se); + auto ThatF = static_cast(SE); return wali::ref_ptr>( - new JoinLatticeToSemiRingElem(ThisF->F->joinWith(ThatF->F), L)); + new JoinLatticeToSemiRingElem(ThisF->F->joinWith(ThatF->F), Lattice)); } - bool equal(SemElem *se) const override { + [[nodiscard]] bool equal(SemElem *SE) const override { // std::cout << "JoinLatticeToSemiRingElem::equal()" << std::endl; auto ThisF = static_cast(this); - auto ThatF = static_cast(se); + auto ThatF = static_cast(SE); return ThisF->F->equal_to(ThatF->F); } }; template -std::ostream &operator<<(std::ostream &os, +std::ostream &operator<<(std::ostream &OS, const JoinLatticeToSemiRingElem &ETS) { - ETS.print(os); - return os; + ETS.print(OS); + return OS; } } // namespace psr diff --git a/include/phasar/PhasarLLVM/DataFlowSolver/WPDS/Problems/WPDSAliasCollector.h b/include/phasar/PhasarLLVM/DataFlowSolver/WPDS/Problems/WPDSAliasCollector.h index c65e32c858..b50df342ed 100644 --- a/include/phasar/PhasarLLVM/DataFlowSolver/WPDS/Problems/WPDSAliasCollector.h +++ b/include/phasar/PhasarLLVM/DataFlowSolver/WPDS/Problems/WPDSAliasCollector.h @@ -47,44 +47,44 @@ class WPDSAliasCollector ~WPDSAliasCollector() override = default; - FlowFunctionPtrType getNormalFlowFunction(n_t curr, n_t succ) override; - FlowFunctionPtrType getCallFlowFunction(n_t callSite, f_t destFun) override; - FlowFunctionPtrType getRetFlowFunction(n_t callSite, f_t calleeFun, - n_t ExitInst, n_t retSite) override; - FlowFunctionPtrType getCallToRetFlowFunction(n_t callSite, n_t retSite, - std::set callees) override; - FlowFunctionPtrType getSummaryFlowFunction(n_t curr, f_t destFun) override; + FlowFunctionPtrType getNormalFlowFunction(n_t Curr, n_t Succ) override; + FlowFunctionPtrType getCallFlowFunction(n_t CallSite, f_t DestFun) override; + FlowFunctionPtrType getRetFlowFunction(n_t CallSite, f_t CalleeFun, + n_t ExitInst, n_t RetSite) override; + FlowFunctionPtrType getCallToRetFlowFunction(n_t CallSite, n_t RetSite, + std::set Callees) override; + FlowFunctionPtrType getSummaryFlowFunction(n_t Curr, f_t DestFun) override; std::shared_ptr> - getNormalEdgeFunction(n_t curr, d_t currNode, n_t succ, - d_t succNode) override; + getNormalEdgeFunction(n_t Curr, d_t CurrNode, n_t Succ, + d_t SuccNode) override; std::shared_ptr> - getCallEdgeFunction(n_t callSite, d_t srcNode, f_t destinationFunction, - d_t destNode) override; + getCallEdgeFunction(n_t CallSite, d_t SrcNode, f_t DestinationFunction, + d_t DestNode) override; std::shared_ptr> - getReturnEdgeFunction(n_t callSite, f_t calleeFunction, n_t ExitInst, - d_t exitNode, n_t reSite, d_t retNode) override; + getReturnEdgeFunction(n_t CallSite, f_t CalleeFunction, n_t ExitInst, + d_t ExitNode, n_t RetSite, d_t RetNode) override; std::shared_ptr> - getCallToRetEdgeFunction(n_t callSite, d_t callNode, n_t retSite, - d_t retSiteNode, std::set callees) override; + getCallToRetEdgeFunction(n_t CallSite, d_t CallNode, n_t RetSite, + d_t RetSiteNode, std::set Callees) override; std::shared_ptr> - getSummaryEdgeFunction(n_t curr, d_t currNode, n_t succ, - d_t succNode) override; + getSummaryEdgeFunction(n_t Curr, d_t CurrNode, n_t Succ, + d_t SuccNode) override; l_t topElement() override; l_t bottomElement() override; - l_t join(l_t lhs, l_t rhs) override; + l_t join(l_t Lhs, l_t Rhs) override; - bool isZeroValue(WPDSAliasCollector::d_t d) const override; + bool isZeroValue(WPDSAliasCollector::d_t Fact) const override; InitialSeeds initialSeeds() override; std::shared_ptr> allTopFunction() override; - void printNode(std::ostream &os, n_t n) const override; - void printDataFlowFact(std::ostream &os, d_t d) const override; - void printFunction(std::ostream &os, f_t m) const override; - void printEdgeFact(std::ostream &os, l_t v) const override; + void printNode(std::ostream &OS, n_t Stmt) const override; + void printDataFlowFact(std::ostream &OS, d_t Fact) const override; + void printFunction(std::ostream &OS, f_t Func) const override; + void printEdgeFact(std::ostream &OS, l_t L) const override; }; } // namespace psr diff --git a/include/phasar/PhasarLLVM/DataFlowSolver/WPDS/Problems/WPDSSolverTest.h b/include/phasar/PhasarLLVM/DataFlowSolver/WPDS/Problems/WPDSSolverTest.h index b3337fc7cf..22febe6128 100644 --- a/include/phasar/PhasarLLVM/DataFlowSolver/WPDS/Problems/WPDSSolverTest.h +++ b/include/phasar/PhasarLLVM/DataFlowSolver/WPDS/Problems/WPDSSolverTest.h @@ -42,46 +42,46 @@ class WPDSSolverTest : public WPDSProblem { const LLVMBasedICFG *ICF, LLVMPointsToInfo *PT, std::set EntryPoints = {"main"}); - FlowFunctionPtrType getNormalFlowFunction(n_t curr, n_t succ) override; - FlowFunctionPtrType getCallFlowFunction(n_t callSite, f_t destFun) override; - FlowFunctionPtrType getRetFlowFunction(n_t callSite, f_t calleeFun, - n_t ExitInst, n_t retSite) override; - FlowFunctionPtrType getCallToRetFlowFunction(n_t callSite, n_t retSite, - std::set callees) override; - FlowFunctionPtrType getSummaryFlowFunction(n_t curr, f_t destFun) override; + FlowFunctionPtrType getNormalFlowFunction(n_t Curr, n_t Succ) override; + FlowFunctionPtrType getCallFlowFunction(n_t CallSite, f_t DestFun) override; + FlowFunctionPtrType getRetFlowFunction(n_t CallSite, f_t CalleeFun, + n_t ExitStmt, n_t RetSite) override; + FlowFunctionPtrType getCallToRetFlowFunction(n_t CallSite, n_t RetSite, + std::set Callees) override; + FlowFunctionPtrType getSummaryFlowFunction(n_t Curr, f_t DestFun) override; std::shared_ptr> - getNormalEdgeFunction(n_t curr, d_t currNode, n_t succ, - d_t succNode) override; + getNormalEdgeFunction(n_t Curr, d_t CurrNode, n_t Succ, + d_t SuccNode) override; std::shared_ptr> - getCallEdgeFunction(n_t callSite, d_t srcNode, f_t destinationFunction, - d_t destNode) override; + getCallEdgeFunction(n_t CallSite, d_t SrcNode, f_t DestinationFunction, + d_t DestNode) override; std::shared_ptr> - getReturnEdgeFunction(n_t callSite, f_t calleeFunction, n_t ExitInst, - d_t exitNode, n_t reSite, d_t retNode) override; + getReturnEdgeFunction(n_t CallSite, f_t CalleeFunction, n_t ExitStmt, + d_t ExitNode, n_t RetSite, d_t RetNode) override; std::shared_ptr> - getCallToRetEdgeFunction(n_t callSite, d_t callNode, n_t retSite, - d_t retSiteNode, std::set callees) override; + getCallToRetEdgeFunction(n_t CallSite, d_t CallNode, n_t RetSite, + d_t RetSiteNode, std::set Callees) override; std::shared_ptr> - getSummaryEdgeFunction(n_t curr, d_t currNode, n_t succ, - d_t succNode) override; + getSummaryEdgeFunction(n_t Curr, d_t CurrNode, n_t Succ, + d_t SuccNode) override; l_t topElement() override; l_t bottomElement() override; - l_t join(l_t lhs, l_t rhs) override; + l_t join(l_t Lhs, l_t Rhs) override; d_t createZeroValue() const override; - bool isZeroValue(d_t d) const override; + [[nodiscard]] bool isZeroValue(d_t Fact) const override; InitialSeeds initialSeeds() override; std::shared_ptr> allTopFunction() override; - void printNode(std::ostream &os, n_t n) const override; - void printDataFlowFact(std::ostream &os, d_t d) const override; - void printFunction(std::ostream &os, f_t m) const override; - void printEdgeFact(std::ostream &os, l_t v) const override; + void printNode(std::ostream &OS, n_t Stmt) const override; + void printDataFlowFact(std::ostream &OS, d_t Fact) const override; + void printFunction(std::ostream &OS, f_t Func) const override; + void printEdgeFact(std::ostream &OS, l_t L) const override; }; } // namespace psr diff --git a/include/phasar/PhasarLLVM/DataFlowSolver/WPDS/Solver/WPDSSolver.h b/include/phasar/PhasarLLVM/DataFlowSolver/WPDS/Solver/WPDSSolver.h index 6b553286fc..d439070de2 100644 --- a/include/phasar/PhasarLLVM/DataFlowSolver/WPDS/Solver/WPDSSolver.h +++ b/include/phasar/PhasarLLVM/DataFlowSolver/WPDS/Solver/WPDSSolver.h @@ -76,7 +76,7 @@ class WPDSSolver : public IDESolver { wali::wfa::WFA Query; wali::wfa::WFA Answer; wali::sem_elem_t SRElem; - Table>> incomingtab; + Table>> Incomingtab; wali::wpds::WPDS *makePDS(WPDSType Ty, bool Witnesses) { wali::wpds::Wrapper *Wrapper = @@ -105,10 +105,10 @@ class WPDSSolver : public IDESolver { WPDSSolver(WPDSProblem &Problem) : IDESolver(Problem), Problem(Problem), SolverConf(Problem.getWPDSSolverConfig()), - PDS(makePDS(SolverConf.wpdsty, SolverConf.recordWitnesses)), + PDS(makePDS(SolverConf.WPDSType, SolverConf.RecordWitnesses)), ZeroValue(Problem.getZeroValue()), - AcceptingState(wali::getKey("__accept")), SRElem(nullptr) { - ZeroPDSState = wali::getKey(ZeroValue); + AcceptingState(wali::getKey("__accept")), SRElem(nullptr), + ZeroPDSState(wali::getKey(ZeroValue)) { DKey[ZeroValue] = ZeroPDSState; } ~WPDSSolver() override = default; @@ -117,15 +117,15 @@ class WPDSSolver : public IDESolver { // Construct the PDS IDESolver::submitInitalSeeds(); - std::ofstream pdsfile("pds.dot"); - PDS->print_dot(pdsfile, true); - pdsfile.flush(); - pdsfile.close(); + std::ofstream PDSFile("pds.dot"); + PDS->print_dot(PDSFile, true); + PDSFile.flush(); + PDSFile.close(); // test the SRElem wali::test_semelem_impl(SRElem); // Solve the PDS - wali::sem_elem_t ret = nullptr; - if (WPDSSearchDirection::FORWARD == SolverConf.searchDirection) { + wali::sem_elem_t Ret = nullptr; + if (WPDSSearchDirection::FORWARD == SolverConf.Direction) { LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) << "FORWARD"); doForwardSearch(Answer); Answer.path_summary(); @@ -142,12 +142,12 @@ class WPDSSolver : public IDESolver { // ret = ret->combine(tmp); // } } else { - auto retnode = + auto RetNode = wali::getKey(&IDESolver::ICF->getFunction("main") ->back() .back()); LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) << "BACKWARD"); - doBackwardSearch(retnode, Answer); + doBackwardSearch(RetNode, Answer); Answer.path_summary(); // access the results @@ -192,161 +192,164 @@ class WPDSSolver : public IDESolver { } } - void processNormalFlow(PathEdge edge) override { + void processNormalFlow(PathEdge Edge) override { LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) << "WPDS::processNormal"); PAMM_GET_INSTANCE; INC_COUNTER("Process Normal", 1, PAMM_SEVERITY_LEVEL::Full); LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) << "Process normal at target: " - << this->ideTabulationProblem.NtoString(edge.getTarget())); - d_t d1 = edge.factAtSource(); - n_t n = edge.getTarget(); - d_t d2 = edge.factAtTarget(); - EdgeFunctionPtrType f = IDESolver::jumpFunction(edge); - auto successorInst = IDESolver::ICF->getSuccsOf(n); - for (auto f : successorInst) { - FlowFunctionPtrType flowFunction = + << this->ideTabulationProblem.NtoString(Edge.getTarget())); + d_t d1 = Edge.factAtSource(); // NOLINT + n_t n = Edge.getTarget(); // NOLINT + d_t d2 = Edge.factAtTarget(); // NOLINT + EdgeFunctionPtrType f = // NOLINT + IDESolver::jumpFunction(Edge); + auto SuccessorInsts = IDESolver::ICF->getSuccsOf(n); + for (auto SuccessorInst : SuccessorInsts) { + FlowFunctionPtrType flowFunction = // NOLINT IDESolver::cachedFlowEdgeFunctions - .getNormalFlowFunction(n, f); + .getNormalFlowFunction(n, SuccessorInst); INC_COUNTER("FF Queries", 1, PAMM_SEVERITY_LEVEL::Full); - std::set res = + std::set Res = IDESolver::computeNormalFlowFunction(flowFunction, d1, d2); ADD_TO_HISTOGRAM("Data-flow facts", res.size(), 1, PAMM_SEVERITY_LEVEL::Full); - IDESolver::saveEdges(n, f, d2, res, false); - for (d_t d3 : res) { - EdgeFunctionPtrType g = + IDESolver::saveEdges(n, SuccessorInst, d2, Res, false); + for (d_t d3 : Res) { // NOLINT + EdgeFunctionPtrType g = // NOLINT IDESolver::cachedFlowEdgeFunctions - .getNormalEdgeFunction(n, d2, f, d3); + .getNormalEdgeFunction(n, d2, SuccessorInst, d3); // add normal PDS rule - auto d2_k = wali::getKey(d2); + auto d2_k = wali::getKey(d2); // NOLINT DKey[d2] = d2_k; - auto d3_k = wali::getKey(d3); + auto d3_k = wali::getKey(d3); // NOLINT DKey[d3] = d3_k; - auto n_k = wali::getKey(n); - auto f_k = wali::getKey(f); - wali::ref_ptr> wptr; - wptr = new JoinLatticeToSemiRingElem( + auto n_k = wali::getKey(n); // NOLINT + auto f_k = wali::getKey(SuccessorInst); // NOLINT + wali::ref_ptr> Wptr; + Wptr = new JoinLatticeToSemiRingElem( g, static_cast &>(Problem)); - LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) - << "ADD NORMAL RULE: " << Problem.DtoString(d2) << " | " - << Problem.NtoString(n) << " --> " - << Problem.DtoString(d3) << " | " << Problem.DtoString(f) - << ", " << *wptr << ")"); - PDS->add_rule(d2_k, n_k, d3_k, f_k, wptr); + LOG_IF_ENABLE( + BOOST_LOG_SEV(lg::get(), DEBUG) + << "ADD NORMAL RULE: " << Problem.DtoString(d2) << " | " + << Problem.NtoString(n) << " --> " << Problem.DtoString(d3) << " | " + << Problem.DtoString(SuccessorInst) << ", " << *Wptr << ")"); + PDS->add_rule(d2_k, n_k, d3_k, f_k, Wptr); if (!SRElem.is_valid()) { - SRElem = wptr; + SRElem = Wptr; } - EdgeFunctionPtrType fprime = f->composeWith(g); + EdgeFunctionPtrType fprime = SuccessorInst->composeWith(g); // NOLINT LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) - << "Compose: " << g->str() << " * " << f->str()); + << "Compose: " << g->str() << " * " + << SuccessorInst->str()); LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) << ' '); INC_COUNTER("EF Queries", 1, PAMM_SEVERITY_LEVEL::Full); - IDESolver::propagate(d1, f, d3, fprime, nullptr, - false); + IDESolver::propagate(d1, SuccessorInst, d3, fprime, + nullptr, false); } } } - void processCall(PathEdge edge) override { + void processCall(PathEdge Edge) override { LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) << "WPDS::processCall"); PAMM_GET_INSTANCE; INC_COUNTER("Process Call", 1, PAMM_SEVERITY_LEVEL::Full); LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) << "Process call at target: " - << this->ideTabulationProblem.NtoString(edge.getTarget())); - d_t d1 = edge.factAtSource(); - n_t n = edge.getTarget(); // a call node; line 14... - d_t d2 = edge.factAtTarget(); - EdgeFunctionPtrType f = IDESolver::jumpFunction(edge); - std::set returnSiteNs = + << this->ideTabulationProblem.NtoString(Edge.getTarget())); + d_t d1 = Edge.factAtSource(); // NOLINT + n_t n = Edge.getTarget(); // NOLINT a call node; line 14... + d_t d2 = Edge.factAtTarget(); // NOLINT + EdgeFunctionPtrType f // NOLINT + = IDESolver::jumpFunction(Edge); + std::set ReturnSiteNs = IDESolver::ICF->getReturnSitesOfCallAt(n); - std::set callees = + std::set Callees = IDESolver::ICF->getCalleesOfCallAt(n); LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) << "Possible callees:"); - for (auto callee : callees) { + for (auto Callee : Callees) { LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) - << " " << callee->getName().str()); + << " " << Callee->getName().str()); } LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) << "Possible return sites:"); - for (auto ret : returnSiteNs) { + for (auto Ret : ReturnSiteNs) { LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) - << " " << this->ideTabulationProblem.NtoString(ret)); + << " " << this->ideTabulationProblem.NtoString(Ret)); } // for each possible callee - for (f_t sCalledProcN : callees) { // still line 14 + for (f_t SCalledProcN : Callees) { // still line 14 // check if a special summary for the called procedure exists - FlowFunctionPtrType specialSum = + FlowFunctionPtrType SpecialSum = IDESolver::cachedFlowEdgeFunctions - .getSummaryFlowFunction(n, sCalledProcN); + .getSummaryFlowFunction(n, SCalledProcN); // if a special summary is available, treat this as a normal flow // and use the summary flow and edge functions - if (specialSum) { + if (SpecialSum) { LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) << "Found and process special summary"); - for (n_t returnSiteN : returnSiteNs) { - std::set res = + for (n_t ReturnSiteN : ReturnSiteNs) { + std::set Res = IDESolver::computeSummaryFlowFunction( - specialSum, d1, d2); + SpecialSum, d1, d2); INC_COUNTER("SpecialSummary-FF Application", 1, PAMM_SEVERITY_LEVEL::Full); ADD_TO_HISTOGRAM("Data-flow facts", res.size(), 1, PAMM_SEVERITY_LEVEL::Full); - IDESolver::saveEdges(n, returnSiteN, d2, res, + IDESolver::saveEdges(n, ReturnSiteN, d2, Res, false); - for (d_t d3 : res) { - EdgeFunctionPtrType sumEdgFnE = + for (d_t d3 : Res) { // NOLINT + EdgeFunctionPtrType SumEdgFnE = IDESolver::cachedFlowEdgeFunctions - .getSummaryEdgeFunction(n, d2, returnSiteN, d3); + .getSummaryEdgeFunction(n, d2, ReturnSiteN, d3); INC_COUNTER("SpecialSummary-EF Queries", 1, PAMM_SEVERITY_LEVEL::Full); LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) - << "Compose: " << sumEdgFnE->str() << " * " + << "Compose: " << SumEdgFnE->str() << " * " << f->str()); LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) << ' '); IDESolver::propagate( - d1, returnSiteN, d3, f->composeWith(sumEdgFnE), n, false); + d1, ReturnSiteN, d3, f->composeWith(SumEdgFnE), n, false); } } } else { // compute the call-flow function - FlowFunctionPtrType function = + FlowFunctionPtrType Function = IDESolver::cachedFlowEdgeFunctions - .getCallFlowFunction(n, sCalledProcN); + .getCallFlowFunction(n, SCalledProcN); INC_COUNTER("FF Queries", 1, PAMM_SEVERITY_LEVEL::Full); - std::set res = - IDESolver::computeCallFlowFunction(function, d1, + std::set Res = + IDESolver::computeCallFlowFunction(Function, d1, d2); ADD_TO_HISTOGRAM("Data-flow facts", res.size(), 1, PAMM_SEVERITY_LEVEL::Full); // for each callee's start point(s) - std::set startPointsOf = - IDESolver::ICF->getStartPointsOf(sCalledProcN); - if (startPointsOf.empty()) { + std::set StartPointsOf = + IDESolver::ICF->getStartPointsOf(SCalledProcN); + if (StartPointsOf.empty()) { LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) << "Start points of '" + - this->ICF->getFunctionName(sCalledProcN) + + this->ICF->getFunctionName(SCalledProcN) + "' currently not available!"); } // if startPointsOf is empty, the called function is a declaration - for (n_t sP : startPointsOf) { - IDESolver::saveEdges(n, sP, d2, res, true); + for (n_t SP : StartPointsOf) { + IDESolver::saveEdges(n, SP, d2, Res, true); // for each result node of the call-flow function - for (d_t d3 : res) { + for (d_t d3 : Res) { // NOLINT // create initial self-loop IDESolver::propagate( - d3, sP, d3, EdgeIdentity::getInstance(), n, + d3, SP, d3, EdgeIdentity::getInstance(), n, false); // line 15 // register the fact that has an incoming edge from // line 15.1 of Naeem/Lhotak/Rodriguez - IDESolver::addIncoming(sP, d3, n, d2); + IDESolver::addIncoming(SP, d3, n, d2); // line 15.2, copy to avoid concurrent modification exceptions by // other threads std::set::Cell> - endSumm = std::set< + EndSumm = std::set< typename Table::Cell>( - IDESolver::endSummary(sP, d3)); + IDESolver::endSummary(SP, d3)); // std::cout << "ENDSUMM" << std::endl; // std::cout << "Size: " << endSumm.size() << std::endl; // std::cout << "sP: " << ideTabulationProblem.NtoString(sP) @@ -358,93 +361,93 @@ class WPDSSolver : public IDESolver { // , create new caller-side jump functions to the return // sites because we have observed a potentially new incoming // edge into - for (typename Table::Cell entry : - endSumm) { - n_t eP = entry.getRowKey(); - d_t d4 = entry.getColumnKey(); - EdgeFunctionPtrType fCalleeSummary = entry.getValue(); + for (typename Table::Cell Entry : + EndSumm) { + n_t eP = Entry.getRowKey(); // NOLINT + d_t d4 = Entry.getColumnKey(); // NOLINT + EdgeFunctionPtrType FCalleeSummary = Entry.getValue(); // for each return site - for (n_t retSiteN : returnSiteNs) { + for (n_t RetSiteN : ReturnSiteNs) { // compute return-flow function - FlowFunctionPtrType retFunction = + FlowFunctionPtrType RetFunction = IDESolver::cachedFlowEdgeFunctions - .getRetFlowFunction(n, sCalledProcN, eP, retSiteN); + .getRetFlowFunction(n, SCalledProcN, eP, RetSiteN); INC_COUNTER("FF Queries", 1, PAMM_SEVERITY_LEVEL::Full); - std::set returnedFacts = + std::set ReturnedFacts = IDESolver::computeReturnFlowFunction( - retFunction, d3, d4, n, std::set{d2}); + RetFunction, d3, d4, n, std::set{d2}); ADD_TO_HISTOGRAM("Data-flow facts", returnedFacts.size(), 1, PAMM_SEVERITY_LEVEL::Full); - IDESolver::saveEdges(eP, retSiteN, d4, - returnedFacts, true); + IDESolver::saveEdges(eP, RetSiteN, d4, + ReturnedFacts, true); // for each target value of the function - for (d_t d5 : returnedFacts) { + for (d_t d5 : ReturnedFacts) { // NOLINT // update the caller-side summary function // get call edge function - EdgeFunctionPtrType f4 = + EdgeFunctionPtrType f4 = // NOLINT IDESolver::cachedFlowEdgeFunctions - .getCallEdgeFunction(n, d2, sCalledProcN, d3); + .getCallEdgeFunction(n, d2, SCalledProcN, d3); // add call PDS rule - auto d2_k = wali::getKey(d2); + auto d2_k = wali::getKey(d2); // NOLINT DKey[d2] = d2_k; - auto d3_k = wali::getKey(d3); + auto d3_k = wali::getKey(d3); // NOLINT DKey[d3] = d3_k; - auto n_k = wali::getKey(n); - auto sP_k = wali::getKey(sP); - wali::ref_ptr> wptrCall( + auto n_k = wali::getKey(n); // NOLINT + auto sP_k = wali::getKey(SP); // NOLINT + wali::ref_ptr> WptrCall( new JoinLatticeToSemiRingElem( f4, static_cast &>(Problem))); LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) << "ADD CALL RULE: " << Problem.DtoString(d2) << ", " << Problem.NtoString(n) << ", " << Problem.DtoString(d3) << ", " - << Problem.NtoString(sP) << ", " << *wptrCall); - auto retSiteN_k = wali::getKey(retSiteN); - PDS->add_rule(d2_k, n_k, d3_k, sP_k, retSiteN_k, wptrCall); + << Problem.NtoString(SP) << ", " << *WptrCall); + auto RetSiteNK = wali::getKey(RetSiteN); + PDS->add_rule(d2_k, n_k, d3_k, sP_k, RetSiteNK, WptrCall); if (!SRElem.is_valid()) { - SRElem = wptrCall; + SRElem = WptrCall; } // get return edge function - EdgeFunctionPtrType f5 = + EdgeFunctionPtrType f5 = // NOLINT IDESolver::cachedFlowEdgeFunctions - .getReturnEdgeFunction(n, sCalledProcN, eP, d4, - retSiteN, d5); + .getReturnEdgeFunction(n, SCalledProcN, eP, d4, + RetSiteN, d5); // add ret PDS rule - auto d4_k = wali::getKey(d4); + auto d4_k = wali::getKey(d4); // NOLINT DKey[d4] = d4_k; - auto d5_k = wali::getKey(d5); + auto d5_k = wali::getKey(d5); // NOLINT DKey[d5] = d5_k; - wali::ref_ptr> wptrRet( + wali::ref_ptr> WptrRet( new JoinLatticeToSemiRingElem( f5, static_cast &>(Problem))); LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) << "ADD RET RULE (CALL): " << Problem.DtoString(d4) << ", " - << Problem.NtoString(retSiteN) << ", " - << Problem.DtoString(d5) << ", " << *wptrRet); - std::set exitPointsN = + << Problem.NtoString(RetSiteN) << ", " + << Problem.DtoString(d5) << ", " << *WptrRet); + std::set ExitPointsN = IDESolver::ICF->getExitPointsOf( - IDESolver::ICF->getFunctionOf(sP)); - for (auto exitPointN : exitPointsN) { - auto exitPointN_k = wali::getKey(exitPointN); - PDS->add_rule(d4_k, exitPointN_k, d5_k, wptrRet); + IDESolver::ICF->getFunctionOf(SP)); + for (auto ExitPointN : ExitPointsN) { + auto ExitPointNK = wali::getKey(ExitPointN); + PDS->add_rule(d4_k, ExitPointNK, d5_k, WptrRet); } if (!SRElem.is_valid()) { - SRElem = wptrRet; + SRElem = WptrRet; } INC_COUNTER("EF Queries", 2, PAMM_SEVERITY_LEVEL::Full); // compose call * calleeSummary * return edge functions LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) << "Compose: " << f5->str() << " * " - << fCalleeSummary->str() << " * " << f4->str()); + << FCalleeSummary->str() << " * " << f4->str()); LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) << " (return * calleeSummary * call)"); - EdgeFunctionPtrType fPrime = - f4->composeWith(fCalleeSummary)->composeWith(f5); + EdgeFunctionPtrType fPrime = // NOLINT + f4->composeWith(FCalleeSummary)->composeWith(f5); LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) << " = " << fPrime->str()); LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) << ' '); - d_t d5_restoredCtx = + d_t d5_restoredCtx = // NOLINT IDESolver::restoreContextOnReturnedFact( n, d2, d5); // propagte the effects of the entire call @@ -453,7 +456,7 @@ class WPDSSolver : public IDESolver { << f->str()); LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) << ' '); IDESolver::propagate( - d1, retSiteN, d5_restoredCtx, f->composeWith(fPrime), n, + d1, RetSiteN, d5_restoredCtx, f->composeWith(fPrime), n, false); } } @@ -463,137 +466,138 @@ class WPDSSolver : public IDESolver { } // line 17-19 of Naeem/Lhotak/Rodriguez // process intra-procedural flows along call-to-return flow functions - for (n_t returnSiteN : returnSiteNs) { - FlowFunctionPtrType callToReturnFlowFunction = + for (n_t ReturnSiteN : ReturnSiteNs) { + FlowFunctionPtrType CallToReturnFlowFunction = IDESolver::cachedFlowEdgeFunctions - .getCallToRetFlowFunction(n, returnSiteN, callees); + .getCallToRetFlowFunction(n, ReturnSiteN, Callees); INC_COUNTER("FF Queries", 1, PAMM_SEVERITY_LEVEL::Full); - std::set returnFacts = + std::set ReturnFacts = IDESolver::computeCallToReturnFlowFunction( - callToReturnFlowFunction, d1, d2); + CallToReturnFlowFunction, d1, d2); ADD_TO_HISTOGRAM("Data-flow facts", returnFacts.size(), 1, PAMM_SEVERITY_LEVEL::Full); - IDESolver::saveEdges(n, returnSiteN, d2, returnFacts, + IDESolver::saveEdges(n, ReturnSiteN, d2, ReturnFacts, false); - for (d_t d3 : returnFacts) { - EdgeFunctionPtrType edgeFnE = + for (d_t d3 : ReturnFacts) { // NOLINT + EdgeFunctionPtrType EdgeFnE = IDESolver::cachedFlowEdgeFunctions - .getCallToRetEdgeFunction(n, d2, returnSiteN, d3, callees); + .getCallToRetEdgeFunction(n, d2, ReturnSiteN, d3, Callees); // add calltoret PDS rule - auto d2_k = wali::getKey(d2); + auto d2_k = wali::getKey(d2); // NOLINT DKey[d2] = d2_k; - auto d3_k = wali::getKey(d3); + auto d3_k = wali::getKey(d3); // NOLINT DKey[d3] = d3_k; - auto n_k = wali::getKey(n); - auto returnSiteN_k = wali::getKey(returnSiteN); - wali::ref_ptr> wptr( + auto n_k = wali::getKey(n); // NOLINT + auto ReturnSiteNK = wali::getKey(ReturnSiteN); + wali::ref_ptr> Wptr( new JoinLatticeToSemiRingElem( - edgeFnE, static_cast &>(Problem))); + EdgeFnE, static_cast &>(Problem))); LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) << "ADD CALLTORET RULE: " << Problem.DtoString(d2) << " | " << Problem.NtoString(n) << " --> " << Problem.DtoString(d3) << ", " - << Problem.NtoString(returnSiteN) << ", " << *wptr); - PDS->add_rule(d2_k, n_k, d3_k, returnSiteN_k, wptr); + << Problem.NtoString(ReturnSiteN) << ", " << *Wptr); + PDS->add_rule(d2_k, n_k, d3_k, ReturnSiteNK, Wptr); if (!SRElem.is_valid()) { - SRElem = wptr; + SRElem = Wptr; } INC_COUNTER("EF Queries", 1, PAMM_SEVERITY_LEVEL::Full); LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) - << "Compose: " << edgeFnE->str() << " * " << f->str()); + << "Compose: " << EdgeFnE->str() << " * " << f->str()); LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) << ' '); IDESolver::propagate( - d1, returnSiteN, d3, f->composeWith(edgeFnE), n, false); + d1, ReturnSiteN, d3, f->composeWith(EdgeFnE), n, false); } } } } - void processExit(PathEdge edge) override { + void processExit(PathEdge Edge) override { LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) << "WPDS::processExit"); PAMM_GET_INSTANCE; INC_COUNTER("Process Exit", 1, PAMM_SEVERITY_LEVEL::Full); LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) << "Process exit at target: " - << this->ideTabulationProblem.NtoString(edge.getTarget())); - n_t n = edge.getTarget(); // an exit node; line 21... - EdgeFunctionPtrType f = IDESolver::jumpFunction(edge); - f_t functionThatNeedsSummary = + << this->ideTabulationProblem.NtoString(Edge.getTarget())); + n_t n = Edge.getTarget(); // NOLINT an exit node; line 21... + EdgeFunctionPtrType f // NOLINT + = IDESolver::jumpFunction(Edge); + f_t FunctionThatNeedsSummary = IDESolver::ICF->getFunctionOf(n); - d_t d1 = edge.factAtSource(); - d_t d2 = edge.factAtTarget(); + d_t d1 = Edge.factAtSource(); // NOLINT + d_t d2 = Edge.factAtTarget(); // NOLINT // for each of the method's start points, determine incoming calls - std::set startPointsOf = + std::set StartPointsOf = IDESolver::ICF->getStartPointsOf( - functionThatNeedsSummary); - std::map> inc; - for (n_t sP : startPointsOf) { + FunctionThatNeedsSummary); + std::map> Inc; + for (n_t SP : StartPointsOf) { // line 21.1 of Naeem/Lhotak/Rodriguez // register end-summary - IDESolver::addEndSummary(sP, d1, n, d2, f); - for (auto entry : IDESolver::incoming(d1, sP)) { - inc[entry.first] = std::set{entry.second}; + IDESolver::addEndSummary(SP, d1, n, d2, f); + for (auto Entry : IDESolver::incoming(d1, SP)) { + Inc[Entry.first] = std::set{Entry.second}; } } IDESolver::printEndSummaryTab(); IDESolver::printIncomingTab(); // for each incoming call edge already processed //(see processCall(..)) - for (auto entry : inc) { + for (auto Entry : Inc) { // line 22 - n_t c = entry.first; + n_t c = Entry.first; // NOLINT // for each return site - for (n_t retSiteC : + for (n_t RetSiteC : IDESolver::ICF->getReturnSitesOfCallAt(c)) { // compute return-flow function - FlowFunctionPtrType retFunction = + FlowFunctionPtrType RetFunction = IDESolver::cachedFlowEdgeFunctions - .getRetFlowFunction(c, functionThatNeedsSummary, n, retSiteC); + .getRetFlowFunction(c, FunctionThatNeedsSummary, n, RetSiteC); INC_COUNTER("FF Queries", 1, PAMM_SEVERITY_LEVEL::Full); // for each incoming-call value - for (d_t d4 : entry.second) { - std::set targets = + for (d_t d4 : Entry.second) { // NOLINT + std::set Targets = IDESolver::computeReturnFlowFunction( - retFunction, d1, d2, c, entry.second); + RetFunction, d1, d2, c, Entry.second); ADD_TO_HISTOGRAM("Data-flow facts", targets.size(), 1, PAMM_SEVERITY_LEVEL::Full); - IDESolver::saveEdges(n, retSiteC, d2, targets, + IDESolver::saveEdges(n, RetSiteC, d2, Targets, true); - std::cout << "RETURN TARGETS: " << targets.size() << std::endl; + std::cout << "RETURN TARGETS: " << Targets.size() << std::endl; // for each target value at the return site // line 23 - for (d_t d5 : targets) { + for (d_t d5 : Targets) { // NOLINT // compute composed function // get call edge function - EdgeFunctionPtrType f4 = + EdgeFunctionPtrType f4 = // NOLINT IDESolver::cachedFlowEdgeFunctions .getCallEdgeFunction( c, d4, IDESolver::ICF->getFunctionOf(n), d1); // get return edge function - EdgeFunctionPtrType f5 = + EdgeFunctionPtrType f5 = // NOLINT IDESolver::cachedFlowEdgeFunctions .getReturnEdgeFunction( c, IDESolver::ICF->getFunctionOf(n), - n, d2, retSiteC, d5); + n, d2, RetSiteC, d5); // add ret PDS rule - auto d1_k = wali::getKey(d1); + auto d1_k = wali::getKey(d1); // NOLINT DKey[d1] = d1_k; - auto d2_k = wali::getKey(d2); + auto d2_k = wali::getKey(d2); // NOLINT DKey[d2] = d2_k; - auto d5_k = wali::getKey(d5); + auto d5_k = wali::getKey(d5); // NOLINT DKey[d5] = d5_k; - auto n_k = wali::getKey(n); - wali::ref_ptr> wptr( + auto n_k = wali::getKey(n); // NOLINT + wali::ref_ptr> Wptr( new JoinLatticeToSemiRingElem( f5, static_cast &>(Problem))); LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) << "ADD RET RULE: " << Problem.DtoString(d2) << ", " << Problem.NtoString(n) << ", " - << Problem.DtoString(d5) << ", " << *wptr); - PDS->add_rule(d2_k, n_k, d5_k, wptr); + << Problem.DtoString(d5) << ", " << *Wptr); + PDS->add_rule(d2_k, n_k, d5_k, Wptr); if (!SRElem.is_valid()) { - SRElem = wptr; + SRElem = Wptr; } INC_COUNTER("EF Queries", 2, PAMM_SEVERITY_LEVEL::Full); // compose call function * function * return function @@ -602,18 +606,19 @@ class WPDSSolver : public IDESolver { << " * " << f4->str()); LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) << " (return * function * call)"); - EdgeFunctionPtrType fPrime = f4->composeWith(f)->composeWith(f5); + EdgeFunctionPtrType fPrime // NOLINT + = f4->composeWith(f)->composeWith(f5); LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) << " = " << fPrime->str()); LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) << ' '); // for each jump function coming into the call, propagate to return // site using the composed function - for (auto valAndFunc : + for (auto ValAndFunc : IDESolver::jumpFn->reverseLookup(c, d4)) { - EdgeFunctionPtrType f3 = valAndFunc.second; + EdgeFunctionPtrType f3 = ValAndFunc.second; // NOLINT if (!f3->equal_to(IDESolver::allTop)) { - d_t d3 = valAndFunc.first; - d_t d5_restoredCtx = + d_t d3 = ValAndFunc.first; // NOLINT + d_t d5_restoredCtx = // NOLINT IDESolver::restoreContextOnReturnedFact( c, d4, d5); LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) @@ -621,7 +626,7 @@ class WPDSSolver : public IDESolver { << f3->str()); LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) << ' '); IDESolver::propagate( - d3, retSiteC, d5_restoredCtx, f3->composeWith(fPrime), c, + d3, RetSiteC, d5_restoredCtx, f3->composeWith(fPrime), c, false); } } @@ -635,39 +640,39 @@ class WPDSSolver : public IDESolver { // conditionally generated values should only // be propagated into callers that have an incoming edge for this condition if (IDESolver::SolverConfig.followReturnsPastSeeds && - inc.empty() && + Inc.empty() && IDESolver::ideTabulationProblem.isZeroValue(d1)) { - std::set callers = IDESolver::ICF->getCallersOf( - functionThatNeedsSummary); - for (n_t c : callers) { - for (n_t retSiteC : - IDESolver::ICF->getReturnSitesOfCallAt(c)) { - FlowFunctionPtrType retFunction = + std::set Callers = IDESolver::ICF->getCallersOf( + FunctionThatNeedsSummary); + for (n_t C : Callers) { + for (n_t RetSiteC : + IDESolver::ICF->getReturnSitesOfCallAt(C)) { + FlowFunctionPtrType RetFunction = IDESolver::cachedFlowEdgeFunctions - .getRetFlowFunction(c, functionThatNeedsSummary, n, retSiteC); + .getRetFlowFunction(C, FunctionThatNeedsSummary, n, RetSiteC); INC_COUNTER("FF Queries", 1, PAMM_SEVERITY_LEVEL::Full); - std::set targets = + std::set Targets = IDESolver::computeReturnFlowFunction( - retFunction, d1, d2, c, + RetFunction, d1, d2, C, std::set{IDESolver::zeroValue}); ADD_TO_HISTOGRAM("Data-flow facts", targets.size(), 1, PAMM_SEVERITY_LEVEL::Full); - IDESolver::saveEdges(n, retSiteC, d2, targets, + IDESolver::saveEdges(n, RetSiteC, d2, Targets, true); - for (d_t d5 : targets) { - EdgeFunctionPtrType f5 = + for (d_t d5 : Targets) { // NOLINT + EdgeFunctionPtrType f5 = // NOLINT IDESolver::cachedFlowEdgeFunctions .getReturnEdgeFunction( - c, IDESolver::ICF->getFunctionOf(n), - n, d2, retSiteC, d5); + C, IDESolver::ICF->getFunctionOf(n), + n, d2, RetSiteC, d5); INC_COUNTER("EF Queries", 1, PAMM_SEVERITY_LEVEL::Full); LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) << "Compose: " << f5->str() << " * " << f->str()); LOG_IF_ENABLE(BOOST_LOG_SEV(lg::get(), DEBUG) << ' '); IDESolver::propagteUnbalancedReturnFlow( - retSiteC, d5, f->composeWith(f5), c); + RetSiteC, d5, f->composeWith(f5), C); // register for value processing (2nd IDE phase) - IDESolver::unbalancedRetSites.insert(retSiteC); + IDESolver::unbalancedRetSites.insert(RetSiteC); } } } @@ -675,13 +680,13 @@ class WPDSSolver : public IDESolver { // normally not be processed at all; this might be undesirable if // the flow function has a side effect such as registering a taint; // instead we thus call the return flow function will a null caller - if (callers.empty()) { - FlowFunctionPtrType retFunction = + if (Callers.empty()) { + FlowFunctionPtrType RetFunction = IDESolver::cachedFlowEdgeFunctions - .getRetFlowFunction(nullptr, functionThatNeedsSummary, n, + .getRetFlowFunction(nullptr, FunctionThatNeedsSummary, n, nullptr); INC_COUNTER("FF Queries", 1, PAMM_SEVERITY_LEVEL::Full); - retFunction->computeTargets(d2); + RetFunction->computeTargets(d2); } } } @@ -689,123 +694,123 @@ class WPDSSolver : public IDESolver { void doForwardSearch(wali::wfa::WFA &Answer) { // Create an automaton to AcceptingState the configuration: // - for (auto seed : IDESolver::initialSeeds) { - wali::Key entry = wali::getKey(seed.first); - Query.addTrans(ZeroPDSState, entry, AcceptingState, SRElem->one()); + for (auto Seed : IDESolver::initialSeeds) { + wali::Key Entry = wali::getKey(Seed.first); + Query.addTrans(ZeroPDSState, Entry, AcceptingState, SRElem->one()); } Query.set_initial_state(ZeroPDSState); Query.add_final_state(AcceptingState); Query.print(std::cout << "BEFORE POSTSTAR\n"); - std::ofstream before("before_poststar.dot"); - Query.print_dot(before, true); + std::ofstream Before("before_poststar.dot"); + Query.print_dot(Before, true); PDS->poststar(Query, Answer); Answer.print(std::cout << "AFTER POSTSTAR\n"); - std::ofstream after("after_poststar.dot"); - Answer.print_dot(after, true); + std::ofstream After("after_poststar.dot"); + Answer.print_dot(After, true); } - void doBackwardSearch(wali::Key node, wali::wfa::WFA &Answer) { + void doBackwardSearch(wali::Key Node, wali::wfa::WFA &Answer) { // Create an automaton to AcceptingState the configurations {n \Gamma^*} // Find the set of all return points - wali::wpds::WpdsStackSymbols syms; - PDS->for_each(syms); - auto alloca1 = + wali::wpds::WpdsStackSymbols Syms; + PDS->for_each(Syms); + auto Alloca1 = &IDESolver::ICF->getFunction("main")->front().front(); - auto a1key = wali::getKey(alloca1); + auto A1Key = wali::getKey(Alloca1); // the weight is essential here! - Query.addTrans(a1key, node, AcceptingState, SRElem->one()); - std::set::iterator it; - for (it = syms.returnPoints.begin(); it != syms.returnPoints.end(); it++) { - wali::getKeySource(*it)->print(std::cout); + Query.addTrans(A1Key, Node, AcceptingState, SRElem->one()); + std::set::iterator It; + for (It = Syms.returnPoints.begin(); It != Syms.returnPoints.end(); It++) { + wali::getKeySource(*It)->print(std::cout); std::cout << std::endl; - Query.addTrans(AcceptingState, *it, AcceptingState, SRElem->one()); + Query.addTrans(AcceptingState, *It, AcceptingState, SRElem->one()); } - Query.set_initial_state(a1key); + Query.set_initial_state(A1Key); Query.add_final_state(AcceptingState); Query.print(std::cout << "BEFORE PRESTAR\n"); - std::ofstream before("before_prestar.dot"); - Query.print_dot(before, true); + std::ofstream Before("before_prestar.dot"); + Query.print_dot(Before, true); PDS->prestar(Query, Answer); Answer.print(std::cout << "AFTER PRESTAR\n"); - std::ofstream after("after_prestar.dot"); - Answer.print_dot(after, true); + std::ofstream After("after_prestar.dot"); + Answer.print_dot(After, true); } - void doBackwardSearch(std::vector node_stack, + void doBackwardSearch(std::vector NodeStack, wali::wfa::WFA &Answer) { - assert(!node_stack.empty()); + assert(!NodeStack.empty()); // Create an automaton to AcceptingState the configuration - wali::Key temp_from = ZeroPDSState; - wali::Key temp_to = wali::WALI_EPSILON; - for (size_t i = 0; i < node_stack.size(); i++) { - std::stringstream ss; - ss << "__tmp_state_" << i; - temp_to = wali::getKey(ss.str()); - Query.addTrans(temp_from, node_stack[i], temp_to, SRElem->one()); - temp_from = temp_to; + wali::Key TempFrom = ZeroPDSState; + wali::Key TempTo = wali::WALI_EPSILON; + for (size_t I = 0; I < NodeStack.size(); I++) { + std::stringstream SStr; + SStr << "__tmp_state_" << I; + TempTo = wali::getKey(SStr.str()); + Query.addTrans(TempFrom, NodeStack[I], TempTo, SRElem->one()); + TempFrom = TempTo; } Query.set_initial_state(ZeroPDSState); - Query.add_final_state(temp_to); + Query.add_final_state(TempTo); PDS->prestar(Query, Answer); } - std::unordered_map resultsAt(n_t stmt, - bool stripZero = false) override { + std::unordered_map resultsAt(n_t Stmt, + bool StripZero = false) override { std::unordered_map Results; - wali::wfa::Trans goal; + wali::wfa::Trans Goal; for (auto Entry : DKey) { // Method 1: If query 'stmt' is located within the same function as the // starting point - if (Answer.find(Entry.second, wali::getKey(stmt), AcceptingState, goal)) { + if (Answer.find(Entry.second, wali::getKey(Stmt), AcceptingState, Goal)) { Results.insert(std::make_pair( Entry.first, - static_cast &>(*goal.weight()) + static_cast &>(*Goal.weight()) .F->computeTarget(l_t{}))); } else { // Method 2: If query 'stmt' is located in a different function - wali::sem_elem_t ret = SRElem->zero(); - wali::wfa::TransSet tset; - wali::wfa::TransSet::iterator titer; - tset = Answer.match(Entry.second, wali::getKey(stmt)); - for (titer = tset.begin(); titer != tset.end(); titer++) { - wali::wfa::ITrans *t = *titer; - wali::sem_elem_t tmp(Answer.getState(t->to())->weight()); - tmp = tmp->extend(t->weight()); - ret = ret->combine(tmp); + wali::sem_elem_t Ret = SRElem->zero(); + wali::wfa::TransSet Tset; + wali::wfa::TransSet::iterator TIter; + Tset = Answer.match(Entry.second, wali::getKey(Stmt)); + for (TIter = Tset.begin(); TIter != Tset.end(); TIter++) { + wali::wfa::ITrans *Trans = *TIter; + wali::sem_elem_t Tmp(Answer.getState(Trans->to())->weight()); + Tmp = Tmp->extend(Trans->weight()); + Ret = Ret->combine(Tmp); } - if (!ret->equal(SRElem->zero())) { + if (!Ret->equal(SRElem->zero())) { Results.insert(std::make_pair( - Entry.first, static_cast &>(*ret) + Entry.first, static_cast &>(*Ret) .F->computeTarget(l_t{}))); } } } - if (stripZero) { + if (StripZero) { Results.erase(ZeroValue); } return Results; } - l_t resultAt(n_t stmt, d_t fact) override { - wali::wfa::Trans goal; - if (Answer.find(wali::getKey(fact), wali::getKey(stmt), AcceptingState, - goal)) { - return static_cast &>(*goal.weight()) + l_t resultAt(n_t Stmt, d_t Fact) override { + wali::wfa::Trans Goal; + if (Answer.find(wali::getKey(Fact), wali::getKey(Stmt), AcceptingState, + Goal)) { + return static_cast &>(*Goal.weight()) .F->computeTarget(l_t{}); } - wali::sem_elem_t ret = SRElem->zero(); - wali::wfa::TransSet tset; - wali::wfa::TransSet::iterator titer; - tset = Answer.match(wali::getKey(fact), wali::getKey(stmt)); - for (titer = tset.begin(); titer != tset.end(); titer++) { - wali::wfa::ITrans *t = *titer; - wali::sem_elem_t tmp(Answer.getState(t->to())->weight()); - tmp = tmp->extend(t->weight()); - ret = ret->combine(tmp); + wali::sem_elem_t Ret = SRElem->zero(); + wali::wfa::TransSet Tset; + wali::wfa::TransSet::iterator TIter; + Tset = Answer.match(wali::getKey(Fact), wali::getKey(Stmt)); + for (TIter = Tset.begin(); TIter != Tset.end(); TIter++) { + wali::wfa::ITrans *Trans = *TIter; + wali::sem_elem_t Tmp(Answer.getState(Trans->to())->weight()); + Tmp = Tmp->extend(Trans->weight()); + Ret = Ret->combine(Tmp); } - if (!ret->equal(SRElem->zero())) { - return static_cast &>(*ret) + if (!Ret->equal(SRElem->zero())) { + return static_cast &>(*Ret) .F->computeTarget(l_t{}); } throw std::runtime_error("Requested invalid fact!"); diff --git a/include/phasar/PhasarLLVM/DataFlowSolver/WPDS/WPDSGenKillProblem.h b/include/phasar/PhasarLLVM/DataFlowSolver/WPDS/WPDSGenKillProblem.h index 7960752ab9..3933c6882f 100644 --- a/include/phasar/PhasarLLVM/DataFlowSolver/WPDS/WPDSGenKillProblem.h +++ b/include/phasar/PhasarLLVM/DataFlowSolver/WPDS/WPDSGenKillProblem.h @@ -24,7 +24,7 @@ template class WPDSGenKillProblem { public: - WPDSGenKillProblem() {} + WPDSGenKillProblem() = default; virtual ~WPDSGenKillProblem() = default; }; diff --git a/include/phasar/PhasarLLVM/DataFlowSolver/WPDS/WPDSSolverConfig.h b/include/phasar/PhasarLLVM/DataFlowSolver/WPDS/WPDSSolverConfig.h index 5cf5235213..efb4527c0c 100644 --- a/include/phasar/PhasarLLVM/DataFlowSolver/WPDS/WPDSSolverConfig.h +++ b/include/phasar/PhasarLLVM/DataFlowSolver/WPDS/WPDSSolverConfig.h @@ -18,17 +18,17 @@ namespace psr { struct WPDSSolverConfig { WPDSSolverConfig() = default; - WPDSSolverConfig(bool recordWitnesses, WPDSSearchDirection searchDirection, - WPDSType wpdsty); + WPDSSolverConfig(bool RecordWitnesses, WPDSSearchDirection Direction, + WPDSType WPDSTy); ~WPDSSolverConfig() = default; WPDSSolverConfig(const WPDSSolverConfig &) = default; WPDSSolverConfig &operator=(const WPDSSolverConfig &) = default; WPDSSolverConfig(WPDSSolverConfig &&) = default; WPDSSolverConfig &operator=(WPDSSolverConfig &&) = default; - bool recordWitnesses = false; - WPDSSearchDirection searchDirection = WPDSSearchDirection::FORWARD; - WPDSType wpdsty = WPDSType::FWPDS; - friend std::ostream &operator<<(std::ostream &os, const WPDSSolverConfig &sc); + bool RecordWitnesses = false; + WPDSSearchDirection Direction = WPDSSearchDirection::FORWARD; + WPDSType WPDSType = WPDSType::FWPDS; + friend std::ostream &operator<<(std::ostream &OS, const WPDSSolverConfig &SC); }; } // namespace psr diff --git a/lib/PhasarLLVM/DataFlowSolver/WPDS/Problems/WPDSAliasCollector.cpp b/lib/PhasarLLVM/DataFlowSolver/WPDS/Problems/WPDSAliasCollector.cpp index e3dea13a14..8e45568ea4 100644 --- a/lib/PhasarLLVM/DataFlowSolver/WPDS/Problems/WPDSAliasCollector.cpp +++ b/lib/PhasarLLVM/DataFlowSolver/WPDS/Problems/WPDSAliasCollector.cpp @@ -34,73 +34,73 @@ WPDSAliasCollector::WPDSAliasCollector(const ProjectIRDB *IRDB, std::move(EntryPoints)) {} WPDSAliasCollector::FlowFunctionPtrType -WPDSAliasCollector::getNormalFlowFunction(WPDSAliasCollector::n_t Curr, - WPDSAliasCollector::n_t Succ) { +WPDSAliasCollector::getNormalFlowFunction(WPDSAliasCollector::n_t /*Curr*/, + WPDSAliasCollector::n_t /*Succ*/) { return Identity::getInstance(); } WPDSAliasCollector::FlowFunctionPtrType -WPDSAliasCollector::getCallFlowFunction(WPDSAliasCollector::n_t CallSite, - WPDSAliasCollector::f_t DestFun) { +WPDSAliasCollector::getCallFlowFunction(WPDSAliasCollector::n_t /*CallSite*/, + WPDSAliasCollector::f_t /*DestFun*/) { return Identity::getInstance(); } WPDSAliasCollector::FlowFunctionPtrType WPDSAliasCollector::getRetFlowFunction( - WPDSAliasCollector::n_t CallSite, WPDSAliasCollector::f_t CalleeFun, - WPDSAliasCollector::n_t ExitSite, WPDSAliasCollector::n_t RetSite) { + WPDSAliasCollector::n_t /*CallSite*/, WPDSAliasCollector::f_t /*CalleeFun*/, + WPDSAliasCollector::n_t /*ExitSite*/, WPDSAliasCollector::n_t /*RetSite*/) { return Identity::getInstance(); } WPDSAliasCollector::FlowFunctionPtrType WPDSAliasCollector::getCallToRetFlowFunction( - WPDSAliasCollector::n_t CallSite, WPDSAliasCollector::n_t RetSite, - set Callees) { + WPDSAliasCollector::n_t /*CallSite*/, WPDSAliasCollector::n_t /*RetSite*/, + set /*Callees*/) { return Identity::getInstance(); } WPDSAliasCollector::FlowFunctionPtrType -WPDSAliasCollector::getSummaryFlowFunction(WPDSAliasCollector::n_t Curr, - WPDSAliasCollector::f_t DestFun) { +WPDSAliasCollector::getSummaryFlowFunction( + WPDSAliasCollector::n_t /*Curr*/, WPDSAliasCollector::f_t /*DestFun*/) { return nullptr; } shared_ptr> -WPDSAliasCollector::getNormalEdgeFunction(WPDSAliasCollector::n_t Curr, - WPDSAliasCollector::d_t CurrNode, - WPDSAliasCollector::n_t Succ, - WPDSAliasCollector::d_t SuccNode) { +WPDSAliasCollector::getNormalEdgeFunction( + WPDSAliasCollector::n_t /*Curr*/, WPDSAliasCollector::d_t /*CurrNode*/, + WPDSAliasCollector::n_t /*Succ*/, WPDSAliasCollector::d_t /*SuccNode*/) { return EdgeIdentity::getInstance(); } shared_ptr> WPDSAliasCollector::getCallEdgeFunction( - WPDSAliasCollector::n_t CallSite, WPDSAliasCollector::d_t SrcNode, - WPDSAliasCollector::f_t DestinationFunction, - WPDSAliasCollector::d_t DestNode) { + WPDSAliasCollector::n_t /*CallSite*/, WPDSAliasCollector::d_t /*SrcNode*/, + WPDSAliasCollector::f_t /*DestinationFunction*/, + WPDSAliasCollector::d_t /*DestNode*/) { return EdgeIdentity::getInstance(); } shared_ptr> WPDSAliasCollector::getReturnEdgeFunction( - WPDSAliasCollector::n_t CallSite, WPDSAliasCollector::f_t CalleeFunction, - WPDSAliasCollector::n_t ExitSite, WPDSAliasCollector::d_t ExitNode, - WPDSAliasCollector::n_t ReSite, WPDSAliasCollector::d_t RetNode) { + WPDSAliasCollector::n_t /*CallSite*/, + WPDSAliasCollector::f_t /*CalleeFunction*/, + WPDSAliasCollector::n_t /*ExitSite*/, WPDSAliasCollector::d_t /*ExitNode*/, + WPDSAliasCollector::n_t /*RetSite*/, WPDSAliasCollector::d_t /*RetNode*/) { return EdgeIdentity::getInstance(); } shared_ptr> WPDSAliasCollector::getCallToRetEdgeFunction( - WPDSAliasCollector::n_t CallSite, WPDSAliasCollector::d_t CallNode, - WPDSAliasCollector::n_t RetSite, WPDSAliasCollector::d_t RetSiteNode, - set Callees) { + WPDSAliasCollector::n_t /*CallSite*/, WPDSAliasCollector::d_t /*CallNode*/, + WPDSAliasCollector::n_t /*RetSite*/, + WPDSAliasCollector::d_t /*RetSiteNode*/, + set /*Callees*/) { return EdgeIdentity::getInstance(); } shared_ptr> -WPDSAliasCollector::getSummaryEdgeFunction(WPDSAliasCollector::n_t Curr, - WPDSAliasCollector::d_t CurrNode, - WPDSAliasCollector::n_t Succ, - WPDSAliasCollector::d_t SuccNode) { +WPDSAliasCollector::getSummaryEdgeFunction( + WPDSAliasCollector::n_t /*Curr*/, WPDSAliasCollector::d_t /*CurrNode*/, + WPDSAliasCollector::n_t /*Succ*/, WPDSAliasCollector::d_t /*SuccNode*/) { return nullptr; } @@ -117,8 +117,8 @@ WPDSAliasCollector::l_t WPDSAliasCollector::join(WPDSAliasCollector::l_t Lhs, : BinaryDomain::TOP; } -bool WPDSAliasCollector::isZeroValue(WPDSAliasCollector::d_t D) const { - return LLVMZeroValue::getInstance()->isLLVMZeroValue(D); +bool WPDSAliasCollector::isZeroValue(WPDSAliasCollector::d_t Fact) const { + return LLVMZeroValue::getInstance()->isLLVMZeroValue(Fact); } InitialSeedsgetName().str(); + WPDSAliasCollector::f_t Func) const { + OS << Func->getName().str(); } void WPDSAliasCollector::printEdgeFact(std::ostream &OS, - WPDSAliasCollector::l_t V) const { - if (V == BinaryDomain::TOP) { + WPDSAliasCollector::l_t L) const { + if (L == BinaryDomain::TOP) { OS << "TOP"; } else { OS << "BOTTOM"; diff --git a/lib/PhasarLLVM/DataFlowSolver/WPDS/Problems/WPDSSolverTest.cpp b/lib/PhasarLLVM/DataFlowSolver/WPDS/Problems/WPDSSolverTest.cpp index c3727a3ac0..36b3d3f3bc 100644 --- a/lib/PhasarLLVM/DataFlowSolver/WPDS/Problems/WPDSSolverTest.cpp +++ b/lib/PhasarLLVM/DataFlowSolver/WPDS/Problems/WPDSSolverTest.cpp @@ -32,76 +32,76 @@ WPDSSolverTest::WPDSSolverTest(const ProjectIRDB *IRDB, std::move(EntryPoints)) {} WPDSSolverTest::FlowFunctionPtrType -WPDSSolverTest::getNormalFlowFunction(WPDSSolverTest::n_t Curr, - WPDSSolverTest::n_t Succ) { +WPDSSolverTest::getNormalFlowFunction(WPDSSolverTest::n_t /*Curr*/, + WPDSSolverTest::n_t /*Succ*/) { return Identity::getInstance(); } WPDSSolverTest::FlowFunctionPtrType -WPDSSolverTest::getCallFlowFunction(WPDSSolverTest::n_t CallSite, - WPDSSolverTest::f_t DestFun) { +WPDSSolverTest::getCallFlowFunction(WPDSSolverTest::n_t /*CallSite*/, + WPDSSolverTest::f_t /*DestFun*/) { return Identity::getInstance(); } WPDSSolverTest::FlowFunctionPtrType WPDSSolverTest::getRetFlowFunction( - WPDSSolverTest::n_t CallSite, WPDSSolverTest::f_t CalleeFun, - WPDSSolverTest::n_t ExitSite, WPDSSolverTest::n_t RetSite) { + WPDSSolverTest::n_t /*CallSite*/, WPDSSolverTest::f_t /*CalleeFun*/, + WPDSSolverTest::n_t /*ExitStmt*/, WPDSSolverTest::n_t /*RetSite*/) { return Identity::getInstance(); } WPDSSolverTest::FlowFunctionPtrType -WPDSSolverTest::getCallToRetFlowFunction(WPDSSolverTest::n_t CallSite, - WPDSSolverTest::n_t RetSite, - set Callees) { +WPDSSolverTest::getCallToRetFlowFunction(WPDSSolverTest::n_t /*CallSite*/, + WPDSSolverTest::n_t /*RetSite*/, + set /*Callees*/) { return Identity::getInstance(); } WPDSSolverTest::FlowFunctionPtrType -WPDSSolverTest::getSummaryFlowFunction(WPDSSolverTest::n_t Curr, - WPDSSolverTest::f_t DestFun) { +WPDSSolverTest::getSummaryFlowFunction(WPDSSolverTest::n_t /*Curr*/, + WPDSSolverTest::f_t /*DestFun*/) { return nullptr; } shared_ptr> -WPDSSolverTest::getNormalEdgeFunction(WPDSSolverTest::n_t Curr, - WPDSSolverTest::d_t CurrNode, - WPDSSolverTest::n_t Succ, - WPDSSolverTest::d_t SuccNode) { +WPDSSolverTest::getNormalEdgeFunction(WPDSSolverTest::n_t /*Curr*/, + WPDSSolverTest::d_t /*CurrNode*/, + WPDSSolverTest::n_t /*Succ*/, + WPDSSolverTest::d_t /*SuccNode*/) { return EdgeIdentity::getInstance(); } shared_ptr> -WPDSSolverTest::getCallEdgeFunction(WPDSSolverTest::n_t CallSite, - WPDSSolverTest::d_t SrcNode, - WPDSSolverTest::f_t DestinationFunction, - WPDSSolverTest::d_t DestNode) { +WPDSSolverTest::getCallEdgeFunction(WPDSSolverTest::n_t /*CallSite*/, + WPDSSolverTest::d_t /*SrcNode*/, + WPDSSolverTest::f_t /*DestinationFunction*/, + WPDSSolverTest::d_t /*DestNode*/) { return EdgeIdentity::getInstance(); } shared_ptr> -WPDSSolverTest::getReturnEdgeFunction(WPDSSolverTest::n_t CallSite, - WPDSSolverTest::f_t CalleeFunction, - WPDSSolverTest::n_t ExitSite, - WPDSSolverTest::d_t ExitNode, - WPDSSolverTest::n_t ReSite, - WPDSSolverTest::d_t RetNode) { +WPDSSolverTest::getReturnEdgeFunction(WPDSSolverTest::n_t /*CallSite*/, + WPDSSolverTest::f_t /*CalleeFunction*/, + WPDSSolverTest::n_t /*ExitStmt*/, + WPDSSolverTest::d_t /*ExitNode*/, + WPDSSolverTest::n_t /*RetSite*/, + WPDSSolverTest::d_t /*RetNode*/) { return EdgeIdentity::getInstance(); } shared_ptr> -WPDSSolverTest::getCallToRetEdgeFunction(WPDSSolverTest::n_t CallSite, - WPDSSolverTest::d_t CallNode, - WPDSSolverTest::n_t RetSite, - WPDSSolverTest::d_t RetSiteNode, - set Callees) { +WPDSSolverTest::getCallToRetEdgeFunction(WPDSSolverTest::n_t /*CallSite*/, + WPDSSolverTest::d_t /*CallNode*/, + WPDSSolverTest::n_t /*RetSite*/, + WPDSSolverTest::d_t /*RetSiteNode*/, + set /*Callees*/) { return EdgeIdentity::getInstance(); } shared_ptr> -WPDSSolverTest::getSummaryEdgeFunction(WPDSSolverTest::n_t Curr, - WPDSSolverTest::d_t CurrNode, - WPDSSolverTest::n_t Succ, - WPDSSolverTest::d_t SuccNode) { +WPDSSolverTest::getSummaryEdgeFunction(WPDSSolverTest::n_t /*Curr*/, + WPDSSolverTest::d_t /*CurrNode*/, + WPDSSolverTest::n_t /*Succ*/, + WPDSSolverTest::d_t /*SuccNode*/) { return nullptr; } @@ -122,8 +122,8 @@ WPDSSolverTest::d_t WPDSSolverTest::createZeroValue() const { return LLVMZeroValue::getInstance(); } -bool WPDSSolverTest::isZeroValue(WPDSSolverTest::d_t D) const { - return LLVMZeroValue::getInstance()->isLLVMZeroValue(D); +bool WPDSSolverTest::isZeroValue(WPDSSolverTest::d_t Fact) const { + return LLVMZeroValue::getInstance()->isLLVMZeroValue(Fact); } InitialSeeds @@ -139,23 +139,24 @@ WPDSSolverTest::allTopFunction() { return make_shared>(BinaryDomain::TOP); } -void WPDSSolverTest::printNode(std::ostream &OS, WPDSSolverTest::n_t N) const { - OS << llvmIRToString(N); +void WPDSSolverTest::printNode(std::ostream &OS, + WPDSSolverTest::n_t Stmt) const { + OS << llvmIRToString(Stmt); } void WPDSSolverTest::printDataFlowFact(std::ostream &OS, - WPDSSolverTest::d_t D) const { - OS << llvmIRToString(D); + WPDSSolverTest::d_t Fact) const { + OS << llvmIRToString(Fact); } void WPDSSolverTest::printFunction(std::ostream &OS, - WPDSSolverTest::f_t M) const { - OS << M->getName().str(); + WPDSSolverTest::f_t Func) const { + OS << Func->getName().str(); } void WPDSSolverTest::printEdgeFact(std::ostream &OS, - WPDSSolverTest::l_t V) const { - if (V == BinaryDomain::TOP) { + WPDSSolverTest::l_t L) const { + if (L == BinaryDomain::TOP) { OS << "TOP"; } else { OS << "BOTTOM"; diff --git a/lib/PhasarLLVM/DataFlowSolver/WPDS/WPDSOptions.cpp b/lib/PhasarLLVM/DataFlowSolver/WPDS/WPDSOptions.cpp index dc13a4918e..1cababcaf0 100644 --- a/lib/PhasarLLVM/DataFlowSolver/WPDS/WPDSOptions.cpp +++ b/lib/PhasarLLVM/DataFlowSolver/WPDS/WPDSOptions.cpp @@ -42,9 +42,8 @@ std::ostream &operator<<(std::ostream &OS, const WPDSType &T) { WPDSSearchDirection toWPDSSearchDirection(const std::string &S) { if (S == "FORWARD") { return WPDSSearchDirection::FORWARD; - } else { - return WPDSSearchDirection::BACKWARD; } + return WPDSSearchDirection::BACKWARD; } std::string toString(const WPDSSearchDirection &S) { diff --git a/lib/PhasarLLVM/DataFlowSolver/WPDS/WPDSSolverConfig.cpp b/lib/PhasarLLVM/DataFlowSolver/WPDS/WPDSSolverConfig.cpp index f11c4b64b1..2817b19cda 100644 --- a/lib/PhasarLLVM/DataFlowSolver/WPDS/WPDSSolverConfig.cpp +++ b/lib/PhasarLLVM/DataFlowSolver/WPDS/WPDSSolverConfig.cpp @@ -18,15 +18,15 @@ namespace psr { WPDSSolverConfig::WPDSSolverConfig(bool RecordWitnesses, WPDSSearchDirection SearchDirection, - WPDSType Wpdsty) - : recordWitnesses(RecordWitnesses), searchDirection(SearchDirection), - wpdsty(Wpdsty) {} + enum WPDSType Wpdsty) + : RecordWitnesses(RecordWitnesses), Direction(SearchDirection), + WPDSType(Wpdsty) {} ostream &operator<<(ostream &OS, const WPDSSolverConfig &SC) { return OS << "WPDSSolverConfig:\n" - << "\trecordWitnesses: " << SC.recordWitnesses << "\n" - << "\tsearchDirection: " << SC.searchDirection << "\n" - << "\twpdsty: " << SC.wpdsty << "\n"; + << "\trecordWitnesses: " << SC.RecordWitnesses << "\n" + << "\tsearchDirection: " << SC.Direction << "\n" + << "\twpdsty: " << SC.WPDSType << "\n"; } } // namespace psr From 89a0b297ea86e9c5371ed25f6ca5ea038dfa635f Mon Sep 17 00:00:00 2001 From: Florian Sattler Date: Fri, 24 Dec 2021 13:42:21 +0100 Subject: [PATCH 2/3] Update include/phasar/PhasarLLVM/DataFlowSolver/WPDS/JoinLatticeToSemiRingElem.h Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../DataFlowSolver/WPDS/JoinLatticeToSemiRingElem.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/phasar/PhasarLLVM/DataFlowSolver/WPDS/JoinLatticeToSemiRingElem.h b/include/phasar/PhasarLLVM/DataFlowSolver/WPDS/JoinLatticeToSemiRingElem.h index 5bedc23e52..6ec5340356 100644 --- a/include/phasar/PhasarLLVM/DataFlowSolver/WPDS/JoinLatticeToSemiRingElem.h +++ b/include/phasar/PhasarLLVM/DataFlowSolver/WPDS/JoinLatticeToSemiRingElem.h @@ -37,7 +37,9 @@ template class JoinLatticeToSemiRingElem : public wali::SemElem { : wali::SemElem(), EdgeFunc(F), Lattice(L) {} ~JoinLatticeToSemiRingElem() override = default; - std::ostream &print(std::ostream &OS) const override { return OS << *EdgeFunc; } + std::ostream &print(std::ostream &OS) const override { + return OS << *EdgeFunc; + } wali::sem_elem_t one() const override { // std::cout << "JoinLatticeToSemiRingElem::one()" << std::endl; From fdd47ef18c3fb382942f2ae0278ef415ac2897b5 Mon Sep 17 00:00:00 2001 From: Florian Sattler Date: Fri, 24 Dec 2021 13:42:29 +0100 Subject: [PATCH 3/3] Update include/phasar/PhasarLLVM/DataFlowSolver/WPDS/JoinLatticeToSemiRingElem.h Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../PhasarLLVM/DataFlowSolver/WPDS/JoinLatticeToSemiRingElem.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/phasar/PhasarLLVM/DataFlowSolver/WPDS/JoinLatticeToSemiRingElem.h b/include/phasar/PhasarLLVM/DataFlowSolver/WPDS/JoinLatticeToSemiRingElem.h index 6ec5340356..ffc2f4bfa4 100644 --- a/include/phasar/PhasarLLVM/DataFlowSolver/WPDS/JoinLatticeToSemiRingElem.h +++ b/include/phasar/PhasarLLVM/DataFlowSolver/WPDS/JoinLatticeToSemiRingElem.h @@ -60,7 +60,8 @@ template class JoinLatticeToSemiRingElem : public wali::SemElem { auto ThisF = static_cast(this); auto ThatF = static_cast(SE); return wali::ref_ptr>( - new JoinLatticeToSemiRingElem(ThisF->F->composeWith(ThatF->F), Lattice)); + new JoinLatticeToSemiRingElem(ThisF->F->composeWith(ThatF->F), + Lattice)); } [[nodiscard]] wali::sem_elem_t combine(SemElem *SE) override {