The size returned by Rewriter::getRangeSize should include

the size of the last token.

llvm-svn: 43092
This commit is contained in:
Chris Lattner 2007-10-17 21:23:07 +00:00
parent fd64ebd3e4
commit 42ebe5c1e6
1 changed files with 5 additions and 0 deletions

View File

@ -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;
}