From: Manuel Klimek Date: Thu, 30 May 2013 07:45:53 +0000 (+0000) Subject: Add asserts to guard against regressions. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b6dba337ba87c2f47a402ecccf4089ab86bbe70c;p=clang Add asserts to guard against regressions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182916 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Format/BreakableToken.cpp b/lib/Format/BreakableToken.cpp index 10ba1f39a5..01317dbef3 100644 --- a/lib/Format/BreakableToken.cpp +++ b/lib/Format/BreakableToken.cpp @@ -316,6 +316,7 @@ void BreakableBlockComment::insertBreak(unsigned LineIndex, unsigned TailOffset, 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::replaceWhitespaceBefore(unsigned LineIndex, 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());