[PATCH] D23651: [clang-rename] improve performance for rename-all

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 19 11:20:17 PDT 2016


alexfh requested changes to this revision.
This revision now requires changes to proceed.

================
Comment at: clang-rename/USRFindingAction.cpp:145
@@ +144,3 @@
+  explicit NamedDeclFindingConsumer(
+      ArrayRef<unsigned> SymbolOffsets,
+      ArrayRef<std::string> OldNames,
----------------
What about the second part?

> BTW, if the code relies on `SymbolOffsets` and `OldNames` being of the same length, maybe a single collection of pairs would work better? Or define a structure for keeping offset and old name together?

================
Comment at: clang-rename/USRFindingAction.h:37-40
@@ -37,6 +36,6 @@
 private:
-  unsigned SymbolOffset;
-  std::string OldName;
-  std::string SpellingName;
-  std::vector<std::string> USRs;
+  ArrayRef<unsigned> SymbolOffsets;
+  ArrayRef<std::string> OldNames;
+  std::vector<std::string> SpellingNames;
+  std::vector<std::vector<std::string>> USRList;
 };
----------------
Yes, I think, copying here makes sense to uncouple lifetime of the creator of the class with the lifetime of this class.


https://reviews.llvm.org/D23651





More information about the cfe-commits mailing list