]> granicus.if.org Git - clang/commitdiff
Adding pre/post conditions for some Replacement handling functions
authorEdwin Vane <edwin.vane@intel.com>
Fri, 27 Sep 2013 17:52:45 +0000 (17:52 +0000)
committerEdwin Vane <edwin.vane@intel.com>
Fri, 27 Sep 2013 17:52:45 +0000 (17:52 +0000)
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

index 4868b5bfc4f592426b9b4e8f78b58597fbc9ec29..43ec9acdb3bf28d260c5c70a0a72b6d1c9394ed3 100644 (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);