diff options
Diffstat (limited to 'contrib/llvm/tools/clang/lib/Edit/EditedSource.cpp')
-rw-r--r-- | contrib/llvm/tools/clang/lib/Edit/EditedSource.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/contrib/llvm/tools/clang/lib/Edit/EditedSource.cpp b/contrib/llvm/tools/clang/lib/Edit/EditedSource.cpp index 6cf6335..1c66cb8 100644 --- a/contrib/llvm/tools/clang/lib/Edit/EditedSource.cpp +++ b/contrib/llvm/tools/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) { |