Skip to content

Commit a031490

Browse files
committed
Review comments
1 parent f17bef9 commit a031490

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

libsolutil/CommonData.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,17 +450,25 @@ bool contains_if(T const& _t, Predicate const& _p)
450450
return std::end(_t) != std::find_if(std::begin(_t), std::end(_t), _p);
451451
}
452452

453+
/// Function that insert @param _elem into a vector @param _destination only if _elem is not
454+
/// already present in _destination vector.
455+
template <class T>
456+
void emplaceBackUnique(std::vector<T>& _destination, T _elem)
457+
{
458+
if (!contains(_destination, _elem))
459+
_destination.emplace_back(std::move(_elem));
460+
}
461+
453462
/// Function that takes vector @param _destination and appends vector @param _source,
454463
/// whilst only taking into account unique elements of _source.
455464
template <class T>
456465
void concatenateVectorWithoutDuplicates(std::vector<T>& _destination, std::vector<T> const& _source)
457466
{
458467
for (auto&& elem: _source)
459-
if (!contains(_destination, elem))
460-
_destination.emplace_back(std::move(elem));
468+
emplaceBackUnique(_destination, elem);
461469
}
462470

463-
/// Function that removes all elements present in vector @param _sub from vector @_super.
471+
/// Function that removes all elements present in vector @param _sub from vector @param _super.
464472
template <class T>
465473
void removeVectorSubset(std::vector<T>& _super, std::vector<T> const& _sub)
466474
{

libyul/optimiser/SSATransform.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ class IntroduceControlFlowSSA: public ASTModifier
166166
std::set<YulString> const& m_variablesToReplace;
167167
/// Variables (that are to be replaced) currently in scope.
168168
std::vector<YulString> m_variablesInScope;
169-
/// Set of variables that do not have a specific value.
169+
/// Variables that do not have a specific value.
170170
std::vector<YulString> m_variablesToReassign;
171171
TypeInfo const& m_typeInfo;
172172
};

0 commit comments

Comments
 (0)