[clang-tidy] Reuse FileID in getLocation

One FileID per warning will increase and overflow NextLocalOffset
when input file is large with many warnings.
Reusing FileID avoids this problem.

This requires changes in getColumnNumber, D31406, rL299681.

Differential Revision: http://reviews.llvm.org/D31406

llvm-svn: 299700
This commit is contained in:
Chih-Hung Hsieh 2017-04-06 20:19:26 +00:00
parent 579540a8f7
commit 90fccec5ee
1 changed files with 1 additions and 1 deletions

View File

@ -239,7 +239,7 @@ private:
return SourceLocation();
const FileEntry *File = SourceMgr.getFileManager().getFile(FilePath);
FileID ID = SourceMgr.createFileID(File, SourceLocation(), SrcMgr::C_User);
FileID ID = SourceMgr.getOrCreateFileID(File, SrcMgr::C_User);
return SourceMgr.getLocForStartOfFile(ID).getLocWithOffset(Offset);
}