diff --git a/service/cse/CommonSubexpressionElimination.cpp b/service/cse/CommonSubexpressionElimination.cpp index 225ba57274c..f5d5107a1db 100644 --- a/service/cse/CommonSubexpressionElimination.cpp +++ b/service/cse/CommonSubexpressionElimination.cpp @@ -459,7 +459,7 @@ class Analyzer final : public BaseEdgeAwareIRAnalyzer { } }); current_state->mutate_ref_env([mask, &any_changes](RefEnvironment* env) { - bool any_map_changes = env->map([mask](ValueIdDomain domain) { + bool any_map_changes = env->transform([mask](ValueIdDomain domain) { auto c = domain.get_constant(); always_assert(c); auto value_id = *c; diff --git a/service/type-analysis/LocalTypeAnalyzer.cpp b/service/type-analysis/LocalTypeAnalyzer.cpp index 4414bad27eb..5b954e13fce 100644 --- a/service/type-analysis/LocalTypeAnalyzer.cpp +++ b/service/type-analysis/LocalTypeAnalyzer.cpp @@ -357,7 +357,7 @@ bool RegisterTypeAnalyzer::analyze_invoke(const IRInstruction* insn, if (!array_nullness.is_top() && array_nullness.get_length() && *array_nullness.get_length() > 0 && dex_type) { env->mutate_reg_environment([&](RegTypeEnvironment* env) { - env->map([&](const DexTypeDomain& domain) { + env->transform([&](const DexTypeDomain& domain) { auto dex_type_local = domain.get_dex_type(); if (dex_type_local && *dex_type == *dex_type_local) { return DexTypeDomain(*dex_type_local, diff --git a/sparta/include/sparta/FlatMap.h b/sparta/include/sparta/FlatMap.h index 4e1c2fabd6c..a1f348bf8e1 100644 --- a/sparta/include/sparta/FlatMap.h +++ b/sparta/include/sparta/FlatMap.h @@ -226,7 +226,7 @@ class FlatMap final { } template // void(mapped_type*) - void map(MappingFunction&& f) { + void transform(MappingFunction&& f) { bool has_default_value = false; for (auto& p : m_map) { f(&p.second); diff --git a/sparta/include/sparta/HashMap.h b/sparta/include/sparta/HashMap.h index 4a10140058c..2a8b6f63497 100644 --- a/sparta/include/sparta/HashMap.h +++ b/sparta/include/sparta/HashMap.h @@ -213,7 +213,7 @@ class HashMap final { } template // void(mapped_type*) - HashMap& map(MappingFunction&& f) { + HashMap& transform(MappingFunction&& f) { auto it = m_map.begin(), end = m_map.end(); while (it != end) { f(&it->second); diff --git a/sparta/include/sparta/HashedAbstractPartition.h b/sparta/include/sparta/HashedAbstractPartition.h index 50421f8f004..ffde50dc101 100644 --- a/sparta/include/sparta/HashedAbstractPartition.h +++ b/sparta/include/sparta/HashedAbstractPartition.h @@ -128,11 +128,11 @@ class HashedAbstractPartition final } template // void(Domain*) - void map(Operation&& f) { + void transform(Operation&& f) { if (is_top()) { return; } - m_map.map(std::forward(f)); + m_map.transform(std::forward(f)); } bool is_top() const { return m_is_top; } diff --git a/sparta/include/sparta/PatriciaTreeHashMap.h b/sparta/include/sparta/PatriciaTreeHashMap.h index 45e09267d4e..996199a262e 100644 --- a/sparta/include/sparta/PatriciaTreeHashMap.h +++ b/sparta/include/sparta/PatriciaTreeHashMap.h @@ -163,10 +163,10 @@ class PatriciaTreeHashMap final { } template // void(mapped_type*) - bool map(MappingFunction&& f) { - return m_tree.map( + bool transform(MappingFunction&& f) { + return m_tree.transform( [f = std::forward(f)](FlatMapT flat_map) -> FlatMapT { - flat_map.map(f); + flat_map.transform(f); return flat_map; }); } @@ -183,7 +183,7 @@ class PatriciaTreeHashMap final { template // bool(const Key&, const ValueType&) PatriciaTreeHashMap& filter(const Predicate& predicate) { - m_tree.map([&predicate](FlatMapT flat_map) -> FlatMapT { + m_tree.transform([&predicate](FlatMapT flat_map) -> FlatMapT { flat_map.filter(predicate); return flat_map; }); diff --git a/sparta/include/sparta/PatriciaTreeHashMapAbstractEnvironment.h b/sparta/include/sparta/PatriciaTreeHashMapAbstractEnvironment.h index be336f6867d..2dba6189ca2 100644 --- a/sparta/include/sparta/PatriciaTreeHashMapAbstractEnvironment.h +++ b/sparta/include/sparta/PatriciaTreeHashMapAbstractEnvironment.h @@ -103,11 +103,11 @@ class PatriciaTreeHashMapAbstractEnvironment final } template // void(Domain*) - bool map(Operation&& f) { + bool transform(Operation&& f) { if (this->is_bottom()) { return false; } - bool res = this->get_value()->map(std::forward(f)); + bool res = this->get_value()->transform(std::forward(f)); this->normalize(); return res; } @@ -272,8 +272,8 @@ class MapValue final : public AbstractValue> { } template // void(Domain*) - bool map(Operation&& f) { - return m_map.map(std::forward(f)); + bool transform(Operation&& f) { + return m_map.transform(std::forward(f)); } template // void(Domain*, const Domain&) diff --git a/sparta/include/sparta/PatriciaTreeHashMapAbstractPartition.h b/sparta/include/sparta/PatriciaTreeHashMapAbstractPartition.h index 29bf8544d00..6264ce27258 100644 --- a/sparta/include/sparta/PatriciaTreeHashMapAbstractPartition.h +++ b/sparta/include/sparta/PatriciaTreeHashMapAbstractPartition.h @@ -114,11 +114,11 @@ class PatriciaTreeHashMapAbstractPartition final } template // void(Domain*) - bool map(Operation&& f) { + bool transform(Operation&& f) { if (is_top()) { return false; } - return m_map.map(std::forward(f)); + return m_map.transform(std::forward(f)); } bool is_top() const { return m_is_top; } diff --git a/sparta/include/sparta/PatriciaTreeMap.h b/sparta/include/sparta/PatriciaTreeMap.h index 04bdfce8694..6a07b2a2ac5 100644 --- a/sparta/include/sparta/PatriciaTreeMap.h +++ b/sparta/include/sparta/PatriciaTreeMap.h @@ -150,7 +150,7 @@ class PatriciaTreeMap final { } template // mapped_type(const mapped_type&) - bool map(MappingFunction&& f) { + bool transform(MappingFunction&& f) { return m_core.update_all_leafs( apply_leafs(std::forward(f))); } diff --git a/sparta/include/sparta/PatriciaTreeMapAbstractEnvironment.h b/sparta/include/sparta/PatriciaTreeMapAbstractEnvironment.h index 3363b25d0b8..68fa42f5560 100644 --- a/sparta/include/sparta/PatriciaTreeMapAbstractEnvironment.h +++ b/sparta/include/sparta/PatriciaTreeMapAbstractEnvironment.h @@ -106,11 +106,11 @@ class PatriciaTreeMapAbstractEnvironment final } template // Domain(const Domain&) - bool map(Operation&& f) { + bool transform(Operation&& f) { if (this->is_bottom()) { return false; } - bool res = this->get_value()->map(std::forward(f)); + bool res = this->get_value()->transform(std::forward(f)); this->normalize(); return res; } @@ -285,8 +285,8 @@ class MapValue final : public AbstractValue> { } template // Domain(const Domain&) - bool map(Operation&& f) { - return m_map.map(std::forward(f)); + bool transform(Operation&& f) { + return m_map.transform(std::forward(f)); } bool erase_all_matching(const Variable& variable_mask) { diff --git a/sparta/include/sparta/PatriciaTreeMapAbstractPartition.h b/sparta/include/sparta/PatriciaTreeMapAbstractPartition.h index 104c27da8bb..be5637e2d65 100644 --- a/sparta/include/sparta/PatriciaTreeMapAbstractPartition.h +++ b/sparta/include/sparta/PatriciaTreeMapAbstractPartition.h @@ -126,11 +126,11 @@ class PatriciaTreeMapAbstractPartition final } template // Domain(const Domain&) - bool map(Operation&& f) { + bool transform(Operation&& f) { if (is_top()) { return false; } - return m_map.map(std::forward(f)); + return m_map.transform(std::forward(f)); } bool is_top() const { return m_is_top; } diff --git a/sparta/test/PatriciaTreeHashMapAbstractEnvironmentTest.cpp b/sparta/test/PatriciaTreeHashMapAbstractEnvironmentTest.cpp index b4be41c1ccb..2e2a788750a 100644 --- a/sparta/test/PatriciaTreeHashMapAbstractEnvironmentTest.cpp +++ b/sparta/test/PatriciaTreeHashMapAbstractEnvironmentTest.cpp @@ -242,12 +242,12 @@ TEST_F(PatriciaTreeHashMapAbstractEnvironmentTest, whiteBox) { EXPECT_TRUE(e.bindings().reference_equals(before)); } -TEST_F(PatriciaTreeHashMapAbstractEnvironmentTest, map) { +TEST_F(PatriciaTreeHashMapAbstractEnvironmentTest, transform) { Environment e1({{1, Domain({"a", "b"})}}); - bool any_changes = e1.map([](Domain*) {}); + bool any_changes = e1.transform([](Domain*) {}); EXPECT_FALSE(any_changes); - any_changes = e1.map([](Domain* d) { d->set_to_top(); }); + any_changes = e1.transform([](Domain* d) { d->set_to_top(); }); EXPECT_TRUE(any_changes); EXPECT_TRUE(e1.is_top()); } diff --git a/sparta/test/PatriciaTreeHashMapAbstractPartitionTest.cpp b/sparta/test/PatriciaTreeHashMapAbstractPartitionTest.cpp index ffa306c39e1..6715652cb2c 100644 --- a/sparta/test/PatriciaTreeHashMapAbstractPartitionTest.cpp +++ b/sparta/test/PatriciaTreeHashMapAbstractPartitionTest.cpp @@ -245,12 +245,12 @@ TEST(PatriciaTreeHashMapAbstractPartitionTest, destructiveOperations) { EXPECT_TRUE(p6.is_top()); } -TEST(PatriciaTreeHashMapAbstractPartitionTest, map) { +TEST(PatriciaTreeHashMapAbstractPartitionTest, transform) { Partition p1({{1, Domain({"a", "b"})}}); - bool any_changes = p1.map([](Domain*) {}); + bool any_changes = p1.transform([](Domain*) {}); EXPECT_FALSE(any_changes); - any_changes = p1.map([](Domain* d) { d->set_to_bottom(); }); + any_changes = p1.transform([](Domain* d) { d->set_to_bottom(); }); EXPECT_TRUE(any_changes); EXPECT_TRUE(p1.is_bottom()); } diff --git a/sparta/test/PatriciaTreeHashMapTest.cpp b/sparta/test/PatriciaTreeHashMapTest.cpp index 7e179956f51..d1238ac7dff 100644 --- a/sparta/test/PatriciaTreeHashMapTest.cpp +++ b/sparta/test/PatriciaTreeHashMapTest.cpp @@ -65,14 +65,14 @@ TEST(PatriciaTreeHashMapTest, map) { constexpr uint32_t default_value = 0; pth_map m1 = create_pth_map({{0, 1}, {1, 2}, {2, 4}}); - bool any_changes = m1.map([](uint32_t*) {}); + bool any_changes = m1.transform([](uint32_t*) {}); EXPECT_FALSE(any_changes); EXPECT_EQ(3, m1.size()); EXPECT_EQ(m1.at(0), 1); EXPECT_EQ(m1.at(1), 2); EXPECT_EQ(m1.at(2), 4); - any_changes = m1.map([](uint32_t* value) { --(*value); }); + any_changes = m1.transform([](uint32_t* value) { --(*value); }); EXPECT_TRUE(any_changes); EXPECT_EQ(2, m1.size()); EXPECT_EQ(m1.at(0), default_value); diff --git a/sparta/test/PatriciaTreeMapAbstractEnvironmentTest.cpp b/sparta/test/PatriciaTreeMapAbstractEnvironmentTest.cpp index 1b62286ec4b..a17e299d95a 100644 --- a/sparta/test/PatriciaTreeMapAbstractEnvironmentTest.cpp +++ b/sparta/test/PatriciaTreeMapAbstractEnvironmentTest.cpp @@ -259,12 +259,12 @@ TEST_F(PatriciaTreeMapAbstractEnvironmentTest, erase_all_matching) { EXPECT_TRUE(e1.is_top()); } -TEST_F(PatriciaTreeMapAbstractEnvironmentTest, map) { +TEST_F(PatriciaTreeMapAbstractEnvironmentTest, transform) { Environment e1({{1, Domain({"a", "b"})}}); - bool any_changes = e1.map([](Domain d) { return d; }); + bool any_changes = e1.transform([](Domain d) { return d; }); EXPECT_FALSE(any_changes); - any_changes = e1.map([](Domain d) { return Domain::top(); }); + any_changes = e1.transform([](Domain d) { return Domain::top(); }); EXPECT_TRUE(any_changes); EXPECT_TRUE(e1.is_top()); } diff --git a/sparta/test/PatriciaTreeMapAbstractPartitionTest.cpp b/sparta/test/PatriciaTreeMapAbstractPartitionTest.cpp index e27f304128a..0eaabef0651 100644 --- a/sparta/test/PatriciaTreeMapAbstractPartitionTest.cpp +++ b/sparta/test/PatriciaTreeMapAbstractPartitionTest.cpp @@ -249,12 +249,12 @@ TEST(PatriciaTreeMapAbstractPartitionTest, destructiveOperations) { EXPECT_TRUE(p6.is_top()); } -TEST(PatriciaTreeMapAbstractPartitionTest, map) { +TEST(PatriciaTreeMapAbstractPartitionTest, transform) { Partition p1({{1, Domain({"a", "b"})}}); - bool any_changes = p1.map([](Domain d) { return d; }); + bool any_changes = p1.transform([](Domain d) { return d; }); EXPECT_FALSE(any_changes); - any_changes = p1.map([](Domain d) { return Domain::bottom(); }); + any_changes = p1.transform([](Domain d) { return Domain::bottom(); }); EXPECT_TRUE(any_changes); EXPECT_TRUE(p1.is_bottom()); } diff --git a/sparta/test/PatriciaTreeMapTest.cpp b/sparta/test/PatriciaTreeMapTest.cpp index fe28803cb76..da0a0a29c7c 100644 --- a/sparta/test/PatriciaTreeMapTest.cpp +++ b/sparta/test/PatriciaTreeMapTest.cpp @@ -87,18 +87,18 @@ TEST(PatriciaTreeMapTest, erase_all_matching) { EXPECT_EQ(m1.at(1), 1); } -TEST(PatriciaTreeMapTest, map) { +TEST(PatriciaTreeMapTest, transform) { constexpr uint32_t default_value = 0; pt_map m1 = create_pt_map({{0, 1}, {1, 2}, {2, 4}}); - bool any_changes = m1.map([](uint32_t value) { return value; }); + bool any_changes = m1.transform([](uint32_t value) { return value; }); EXPECT_FALSE(any_changes); EXPECT_EQ(3, m1.size()); EXPECT_EQ(m1.at(0), 1); EXPECT_EQ(m1.at(1), 2); EXPECT_EQ(m1.at(2), 4); - any_changes = m1.map([](uint32_t value) { return value - 1; }); + any_changes = m1.transform([](uint32_t value) { return value - 1; }); EXPECT_TRUE(any_changes); EXPECT_EQ(2, m1.size()); EXPECT_EQ(m1.at(0), default_value);