r191536 - Adding pre/post conditions for some Replacement handling functions
Edwin Vane
edwin.vane at intel.com
Fri Sep 27 10:52:45 PDT 2013
Author: revane
Date: Fri Sep 27 12:52:45 2013
New Revision: 191536
URL: http://llvm.org/viewvc/llvm-project?rev=191536&view=rev
Log:
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.
Modified:
cfe/trunk/include/clang/Tooling/Refactoring.h
Modified: cfe/trunk/include/clang/Tooling/Refactoring.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/Refactoring.h?rev=191536&r1=191535&r2=191536&view=diff
==============================================================================
--- cfe/trunk/include/clang/Tooling/Refactoring.h (original)
+++ cfe/trunk/include/clang/Tooling/Refactoring.h Fri Sep 27 12:52:45 2013
@@ -164,14 +164,18 @@ unsigned shiftedCodePosition(const Repla
/// \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);
More information about the cfe-commits
mailing list