Adding pre/post conditions for some Replacement handling functions

The vector version of shiftedCodePosition() requires Replacements to be
in sorted order.

Turned existing comment about sorting for deduplicate() into an exact
post condition.

llvm-svn: 191536
This commit is contained in:
Edwin Vane 2013-09-27 17:52:45 +00:00
parent e7800df48b
commit 88ef9ad84e
1 changed files with 6 additions and 2 deletions

View File

@ -164,14 +164,18 @@ unsigned shiftedCodePosition(const Replacements& Replaces, unsigned Position);
/// \brief Calculates how a code \p Position is shifted when \p Replaces are
/// applied.
///
/// \pre Replaces[i].getOffset() <= Replaces[i+1].getOffset().
unsigned shiftedCodePosition(const std::vector<Replacement> &Replaces,
unsigned Position);
/// \brief Removes duplicate Replacements and reports if Replacements conflict
/// with one another.
///
/// This function will sort \p Replaces so that conflicts can be reported simply
/// by offset into \p Replaces and number of elements in the conflict.
/// \post Replaces[i].getOffset() <= Replaces[i+1].getOffset().
///
/// This function sorts \p Replaces so that conflicts can be reported simply by
/// offset into \p Replaces and number of elements in the conflict.
void deduplicate(std::vector<Replacement> &Replaces,
std::vector<Range> &Conflicts);