diff options
author | Chih-Hung Hsieh <chh@google.com> | 2017-03-30 22:09:17 +0000 |
---|---|---|
committer | Chih-Hung Hsieh <chh@google.com> | 2017-03-30 22:09:17 +0000 |
commit | 4c2647bc2aa83af9add80c23419501886231d62d (patch) | |
tree | 30bba63b2c7fd05ea66af5fbc21c215b1654b4db | |
parent | bfd7c38de785fcbd52adf4f93eff8ec346f8b1bc (diff) | |
download | bcm5719-llvm-4c2647bc2aa83af9add80c23419501886231d62d.tar.gz bcm5719-llvm-4c2647bc2aa83af9add80c23419501886231d62d.zip |
[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.
Differential Revision: http://reviews.llvm.org/D31406
llvm-svn: 299119
-rw-r--r-- | clang-tools-extra/clang-tidy/ClangTidy.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang-tools-extra/clang-tidy/ClangTidy.cpp b/clang-tools-extra/clang-tidy/ClangTidy.cpp index 2da9e142957..6ed8306423a 100644 --- a/clang-tools-extra/clang-tidy/ClangTidy.cpp +++ b/clang-tools-extra/clang-tidy/ClangTidy.cpp @@ -238,7 +238,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); } |