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

Chih-Hung Hsieh via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 28 13:02:26 PDT 2017


chh marked an inline comment as done.
chh added inline comments.


================
Comment at: clang-tidy/ClangTidy.cpp:246
+      Path2FileID[Path] =
+          SourceMgr.createFileID(File, SourceLocation(), SrcMgr::C_User);
+    }
----------------
xazax.hun wrote:
> I do not know how important the efficiency here. But you do not need to store strings (and allocate buffers).  You could get the FileEntry from the FileID and query the name (which will give you a StringRef).
> 
> After that modification, StringRef is relatively small, so maybe the map is a good candidate to be a DenseMap. 
Now replaced with DenseMap<StringRef, FileID>.



https://reviews.llvm.org/D31406





More information about the llvm-commits mailing list