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

Gábor Horváth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 28 02:56:51 PDT 2017


xazax.hun added inline comments.


================
Comment at: clang-tidy/ClangTidy.cpp:246
+      Path2FileID[Path] =
+          SourceMgr.createFileID(File, SourceLocation(), SrcMgr::C_User);
+    }
----------------
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. 


Repository:
  rL LLVM

https://reviews.llvm.org/D31406





More information about the llvm-commits mailing list