diff options
-rw-r--r-- | Rewrite/Rewriter.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Rewrite/Rewriter.cpp b/Rewrite/Rewriter.cpp index 7744a0c4ff..62d0432f0a 100644 --- a/Rewrite/Rewriter.cpp +++ b/Rewrite/Rewriter.cpp @@ -208,6 +208,7 @@ RewriteBuffer &Rewriter::getEditBuffer(unsigned FileID) { /// locations. void Rewriter::InsertText(SourceLocation Loc, const char *StrData, unsigned StrLen) { + assert(isRewritable(Loc) && "Not a rewritable location!"); unsigned FileID; unsigned StartOffs = getLocationOffsetAndFileID(Loc, FileID); getEditBuffer(FileID).InsertText(StartOffs, StrData, StrLen); @@ -216,6 +217,7 @@ void Rewriter::InsertText(SourceLocation Loc, /// RemoveText - Remove the specified text region. This method is only valid /// on a rewritable source location. void Rewriter::RemoveText(SourceLocation Start, unsigned Length) { + assert(isRewritable(Start) && "Not a rewritable location!"); unsigned FileID; unsigned StartOffs = getLocationOffsetAndFileID(Start, FileID); getEditBuffer(FileID).RemoveText(StartOffs, Length); |