aboutsummaryrefslogtreecommitdiff
path: root/clang-tidy/ClangTidy.cpp
diff options
context:
space:
mode:
authorChih-Hung Hsieh <chh@google.com>2017-03-30 22:09:17 +0000
committerChih-Hung Hsieh <chh@google.com>2017-03-30 22:09:17 +0000
commit022596b087aa71dc396546f62c76e12c82541ec3 (patch)
tree720dbaf8c66257e73d9d6dc95ded13a501d58b40 /clang-tidy/ClangTidy.cpp
parent0945cf0c25f94a027fcf8c8fc8ddb3d44ae5abfd (diff)
[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 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@299119 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'clang-tidy/ClangTidy.cpp')
-rw-r--r--clang-tidy/ClangTidy.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang-tidy/ClangTidy.cpp b/clang-tidy/ClangTidy.cpp
index 2da9e142..6ed83064 100644
--- a/clang-tidy/ClangTidy.cpp
+++ b/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);
}