diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-04-30 05:25:48 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-04-30 05:25:48 +0000 |
commit | ef91bd38cd94e34b4b0a30e225e507f5c10087d3 (patch) | |
tree | a32eb01379c5c7f1f1bcd6a2528cabeedda12c80 /include/clang/Rewrite | |
parent | 9ab08c3357404e43c970e2e7438c796dd33f4593 (diff) | |
download | clang-ef91bd38cd94e34b4b0a30e225e507f5c10087d3.tar.gz |
PR37189 Fix incorrect end source location and spelling for a split '>>' token.
When a '>>' token is split into two '>' tokens (in C++11 onwards), or (as an
extension) when we do the same for other tokens starting with a '>', we can't
just use a location pointing to the first '>' as the location of the split
token, because that would result in our miscomputing the length and spelling
for the token. As a consequence, for example, a refactoring replacing 'A<X>'
with something else would sometimes replace one character too many, and
similarly diagnostics highlighting a template-id source range would highlight
one character too many.
Fix this by creating an expansion range covering the first character of the
'>>' token, whose spelling is '>'. For this to work, we generalize the
expansion range of a macro FileID to be either a token range (the common case)
or a character range (used in this new case).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@331155 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Rewrite')
-rw-r--r-- | include/clang/Rewrite/Core/HTMLRewrite.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/clang/Rewrite/Core/HTMLRewrite.h b/include/clang/Rewrite/Core/HTMLRewrite.h index 1fd7c7a3f8..0f1f490d83 100644 --- a/include/clang/Rewrite/Core/HTMLRewrite.h +++ b/include/clang/Rewrite/Core/HTMLRewrite.h @@ -31,7 +31,8 @@ namespace html { /// start/end tags are placed at the start/end of each line if the range is /// multiline. void HighlightRange(Rewriter &R, SourceLocation B, SourceLocation E, - const char *StartTag, const char *EndTag); + const char *StartTag, const char *EndTag, + bool IsTokenRange = true); /// HighlightRange - Highlight a range in the source code with the specified /// start/end tags. The Start/end of the range must be in the same file. |