From ca750be7edbc7a7acf39aeb7c6a2ef6a4c36cbf1 Mon Sep 17 00:00:00 2001 From: Edwin Vane Date: Fri, 27 Sep 2013 17:52:45 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191536 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Tooling/Refactoring.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/clang/Tooling/Refactoring.h b/include/clang/Tooling/Refactoring.h index 4868b5bfc4..43ec9acdb3 100644 --- a/include/clang/Tooling/Refactoring.h +++ b/include/clang/Tooling/Refactoring.h @@ -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 &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 &Replaces, std::vector &Conflicts); -- 2.50.1