From b9e43c08b02677d7c8e71e322e76866c9260d6e2 Mon Sep 17 00:00:00 2001 From: Fabian Schiebel Date: Mon, 21 Oct 2024 19:13:58 +0200 Subject: [PATCH] Some cleanup based on review --- .../IfdsIde/Solver/GenericSolverResults.h | 4 ++-- include/phasar/Utils/EquivalenceClassMap.h | 24 +------------------ .../IfdsIde/IterativeIDESolverTest.cpp | 14 ----------- 3 files changed, 3 insertions(+), 39 deletions(-) diff --git a/include/phasar/DataFlow/IfdsIde/Solver/GenericSolverResults.h b/include/phasar/DataFlow/IfdsIde/Solver/GenericSolverResults.h index 180c63017..70615c301 100644 --- a/include/phasar/DataFlow/IfdsIde/Solver/GenericSolverResults.h +++ b/include/phasar/DataFlow/IfdsIde/Solver/GenericSolverResults.h @@ -21,11 +21,9 @@ #include #include #include -#include #include #include #include -#include namespace psr { @@ -68,6 +66,8 @@ template class GenericSolverResults final { GenericSolverResults(const GenericSolverResults &) noexcept = default; GenericSolverResults & operator=(const GenericSolverResults &) noexcept = default; + GenericSolverResults(GenericSolverResults &&) noexcept = default; + GenericSolverResults &operator=(GenericSolverResults &&) noexcept = default; ~GenericSolverResults() = default; [[nodiscard]] l_t resultAt(ByConstRef Stmt, ByConstRef Node) const { diff --git a/include/phasar/Utils/EquivalenceClassMap.h b/include/phasar/Utils/EquivalenceClassMap.h index 849a9e053..e58258b9e 100644 --- a/include/phasar/Utils/EquivalenceClassMap.h +++ b/include/phasar/Utils/EquivalenceClassMap.h @@ -10,9 +10,6 @@ #ifndef PHASAR_UTILS_EQUIVALENCECLASSMAP_H #define PHASAR_UTILS_EQUIVALENCECLASSMAP_H -/// XXX: Eventually get rid of this dependency: -#include "phasar/DataFlow/IfdsIde/EdgeFunction.h" - #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallVector.h" @@ -21,10 +18,8 @@ #include #include #include -#include #include #include -#include namespace psr { @@ -177,25 +172,8 @@ template struct EquivalenceClassMap { StorageT StoredData{}; }; -namespace detail { -template struct DefaultValueComparer : std::equal_to {}; -template -struct DefaultValueComparer>> { - bool operator()(const std::shared_ptr> &LHS, - const std::shared_ptr> &RHS) const { - if (LHS == RHS) { - return true; - } - if (LHS == nullptr) { - return false; - } - return LHS->equal_to(RHS); - } -}; -} // namespace detail - template > + typename ValueComparator = std::equal_to> class EquivalenceClassMapNG { using SetTy = llvm::SmallDenseSet; diff --git a/unittests/PhasarLLVM/DataFlow/IfdsIde/IterativeIDESolverTest.cpp b/unittests/PhasarLLVM/DataFlow/IfdsIde/IterativeIDESolverTest.cpp index b5b18ed11..6e75ad4bb 100644 --- a/unittests/PhasarLLVM/DataFlow/IfdsIde/IterativeIDESolverTest.cpp +++ b/unittests/PhasarLLVM/DataFlow/IfdsIde/IterativeIDESolverTest.cpp @@ -26,12 +26,6 @@ using namespace psr; /* ============== TEST FIXTURE ============== */ class IterativeIDESolverTest : public ::testing::Test { protected: - // const std::string PathToLlFiles = - // unittest::PathToLLTestFiles + "control_flow/"; - - // void SetUp() override { - // boost::log::core::get()->set_logging_enabled(false); } - template void doAnalysis(const llvm::Twine &LlvmFilePath, bool PrintDump = false) { LLVMProjectIRDB IRDB(unittest::PathToLLTestFiles + LlvmFilePath); @@ -41,11 +35,6 @@ class IterativeIDESolverTest : public ::testing::Test { Soundness::Soundy, /*IncludeGlobals*/ true); IDELinearConstantAnalysis Problem(&IRDB, &ICFG, {"main"}); - /// Unfortunately, the legacy solver does not compute any SolverResults if - /// value computation is turned off - // Problem.getIFDSIDESolverConfig().setComputeValues(false); - // Problem.getIFDSIDESolverConfig().setAutoAddZero(false); - IterativeIDESolver Solver( &Problem, &ICFG); @@ -69,8 +58,6 @@ class IterativeIDESolverTest : public ::testing::Test { OldSolver.dumpResults(); } - // EXPECT_TRUE( - // Solver.getSolverResults().ifdsEqualWith(OldSolver.getSolverResults())); checkEquality(OldSolver.getSolverResults(), Solver.getSolverResults(), SolverConfigTy{}); @@ -156,7 +143,6 @@ TEST_F(IterativeIDESolverTest, IDESolverTestLoop) { doAnalysis("control_flow/loop_cpp.ll"); } TEST_F(IterativeIDESolverTest, IDELinearConstant_Call06) { - // Logger::initializeStderrLogger(SeverityLevel::DEBUG, "IterativeIDESolver"); doAnalysis("linear_constant/call_06_cpp.ll"); } TEST_F(IterativeIDESolverTest, IDELinearConstant_Call07) {