[PATCH] D31406: [clang-tidy] Reuse FileID in getLocation

Chih-Hung Hsieh via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 30 09:55:42 PDT 2017


chh updated this revision to Diff 93499.
chh marked an inline comment as done.
chh added a comment.

Use getOrCreateFileID.


https://reviews.llvm.org/D31406

Files:
  clang-tidy/ClangTidy.cpp


Index: clang-tidy/ClangTidy.cpp
===================================================================
--- clang-tidy/ClangTidy.cpp
+++ clang-tidy/ClangTidy.cpp
@@ -238,7 +238,7 @@
       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);
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31406.93499.patch
Type: text/x-patch
Size: 516 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170330/aec2a26d/attachment.bin>


More information about the cfe-commits mailing list