diff options
| -rw-r--r-- | clang/lib/Edit/EditedSource.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Edit/EditedSource.cpp b/clang/lib/Edit/EditedSource.cpp index 6cf6335da18..1c66cb82770 100644 --- a/clang/lib/Edit/EditedSource.cpp +++ b/clang/lib/Edit/EditedSource.cpp @@ -280,6 +280,12 @@ static void adjustRemoval(const SourceManager &SM, const LangOptions &LangOpts, unsigned begin = offs.getOffset(); unsigned end = begin + len; + // Do not try to extend the removal if we're at the end of the buffer already. + if (end == buffer.size()) + return; + + assert(begin < buffer.size() && end < buffer.size() && "Invalid range!"); + // FIXME: Remove newline. if (begin == 0) { |

