[PATCH] D21787: [include-fixer] make HeaderMapCollector maps from regex instead of postfix.

Eric Liu via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 4 03:05:39 PDT 2016


ioeric added inline comments.

================
Comment at: include-fixer/find-all-symbols/STLPostfixHeaderMap.cpp:16
@@ -15,2 +15,3 @@
 const HeaderMapCollector::HeaderMap *getSTLPostfixHeaderMap() {
   static const HeaderMapCollector::HeaderMap STLPostfixHeaderMap = {
+      {"include/__stddef_max_align_t.h$", "<cstddef>"},
----------------
bkramer wrote:
> Can we make this a std::vector<std::pair<llvm::Regex, const char *>>? Creating llvm::Regex is somewhat expensive so we only want to do it once. We also never lookup into the postfix header map and only iterate over it so using a StringMap for it is wasteful.
As per our offline discussion, copy constructor of `llvm::Regex` is deleted and the non-const `match` function prevents us from making the header map const. So we use `std::vector<std::pair<StringRef, StringRef>>` instead.


http://reviews.llvm.org/D21787





More information about the cfe-commits mailing list