r182916 - Add asserts to guard against regressions.

Manuel Klimek klimek at google.com
Thu May 30 00:45:53 PDT 2013


Author: klimek
Date: Thu May 30 02:45:53 2013
New Revision: 182916

URL: http://llvm.org/viewvc/llvm-project?rev=182916&view=rev
Log:
Add asserts to guard against regressions.

Modified:
    cfe/trunk/lib/Format/BreakableToken.cpp

Modified: cfe/trunk/lib/Format/BreakableToken.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/BreakableToken.cpp?rev=182916&r1=182915&r2=182916&view=diff
==============================================================================
--- cfe/trunk/lib/Format/BreakableToken.cpp (original)
+++ cfe/trunk/lib/Format/BreakableToken.cpp Thu May 30 02:45:53 2013
@@ -316,6 +316,7 @@ void BreakableBlockComment::insertBreak(
   unsigned BreakOffsetInToken =
       Text.data() - Tok.TokenText.data() + Split.first;
   unsigned CharsToRemove = Split.second;
+  assert(IndentAtLineBreak >= Decoration.size());
   Whitespaces.breakToken(Tok, BreakOffsetInToken, CharsToRemove, "", Prefix,
                          InPPDirective, IndentAtLineBreak - Decoration.size());
 }
@@ -347,6 +348,7 @@ BreakableBlockComment::replaceWhitespace
   unsigned WhitespaceOffsetInToken =
       Lines[LineIndex].data() - Tok.TokenText.data() -
       LeadingWhitespace[LineIndex];
+  assert(StartOfLineColumn[LineIndex] >= Prefix.size());
   Whitespaces.breakToken(
       Tok, WhitespaceOffsetInToken, LeadingWhitespace[LineIndex], "", Prefix,
       InPPDirective, StartOfLineColumn[LineIndex] - Prefix.size());





More information about the cfe-commits mailing list