forked from OSchip/llvm-project
The size returned by Rewriter::getRangeSize should include
the size of the last token. llvm-svn: 43092
This commit is contained in:
parent
fd64ebd3e4
commit
42ebe5c1e6
|
@ -13,6 +13,7 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "clang/Rewrite/Rewriter.h"
|
||||
#include "clang/Lex/Lexer.h"
|
||||
#include "clang/Basic/SourceManager.h"
|
||||
using namespace clang;
|
||||
|
||||
|
@ -156,6 +157,10 @@ int Rewriter::getRangeSize(SourceRange Range) const {
|
|||
if (StartFileID != EndFileID)
|
||||
return -1;
|
||||
|
||||
// Adjust the end offset to the end of the last token, instead of being the
|
||||
// start of the last token.
|
||||
EndOff += Lexer::MeasureTokenLength(Range.getEnd(), *SourceMgr);
|
||||
|
||||
return EndOff-StartOff;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue