diff options
Diffstat (limited to 'clang/lib/Format/Format.cpp')
| -rw-r--r-- | clang/lib/Format/Format.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index 1f3eef47590..b5b3797f3a0 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -1332,8 +1332,9 @@ private: SourceLocation Start = First.WhitespaceRange.getBegin(); if (!IncludeLeadingNewlines) Start = Start.getLocWithOffset(First.LastNewlineOffset); - SourceLocation End = Last.getStartOfNonWhitespace().getLocWithOffset( - Last.TokenText.size() - 1); + SourceLocation End = Last.getStartOfNonWhitespace(); + if (Last.TokenText.size() > 0) + End = End.getLocWithOffset(Last.TokenText.size() - 1); CharSourceRange Range = CharSourceRange::getCharRange(Start, End); return affectsCharSourceRange(Range); } |

