Skip to content

Commit 20c5857

Browse files
authored
Merge pull request #3229 from romainbrenguier/document/make_union
Document union_find_replacet
2 parents b473cfc + df01f72 commit 20c5857

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

src/util/union_find_replace.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,10 @@ Author: Romain Brenguier, romain.brenguier@diffblue.com
88

99
#include "union_find_replace.h"
1010

11-
/// Keeps a map of symbols to expressions, such as none of the mapped values
12-
/// exist as a key
13-
/// \param a: an expression of type char array
14-
/// \param b: an expression to map it to, which should be either a symbol
15-
/// a string_exprt, an array_exprt, an array_of_exprt or an
16-
/// if_exprt with branches of the previous kind
17-
/// \return the new mapped value
11+
/// Merge the set containing `a` and the set containing `b`.
12+
/// \param a: an expression
13+
/// \param b: an expression
14+
/// \return current representative element of the set containing `a` and `b`
1815
exprt union_find_replacet::make_union(const exprt &a, const exprt &b)
1916
{
2017
const exprt &lhs_root = find(a);
@@ -24,8 +21,8 @@ exprt union_find_replacet::make_union(const exprt &a, const exprt &b)
2421
return rhs_root;
2522
}
2623

27-
/// Replace subexpressions of `expr` by a canonical element of the set they
28-
/// belong to.
24+
/// Replace subexpressions of `expr` by the representative element of the set
25+
/// they belong to.
2926
/// \param expr: an expression, modified in place
3027
/// \return true if expr is left unchanged
3128
bool union_find_replacet::replace_expr(exprt &expr) const
@@ -37,15 +34,14 @@ bool union_find_replacet::replace_expr(exprt &expr) const
3734
}
3835

3936
/// \param expr: an expression
40-
/// \return canonical representation for expressions which belong to the same
41-
/// set
37+
/// \return representative element of the set `expr` belongs to
4238
exprt union_find_replacet::find(exprt expr) const
4339
{
4440
replace_expr(expr);
4541
return expr;
4642
}
4743

48-
/// \return pairs of expression composed of expressions and a canonical
44+
/// \return pairs of expression composed of expressions and a representative
4945
/// expression for the set they below to.
5046
std::vector<std::pair<exprt, exprt>> union_find_replacet::to_vector() const
5147
{

0 commit comments

Comments
 (0)