[PATCH] D12631: Avoid repeated replacements on loop-convert check.

Angel Garcia via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 4 06:23:52 PDT 2015


angelgarcia added a comment.

Anyway, I just found that this needs a few more changes (it still does duplicated replacementes inside some macros, and I have to find out why), so don't bother with this for now.


================
Comment at: clang-tidy/modernize/LoopConvertUtils.cpp:465
@@ +464,3 @@
+  if (UsageSet.insert(U).second) {
+    Usages.push_back(U);
+    return true;
----------------
alexfh wrote:
> Do you need both `Usages` and `UsageSet`?
Yes, because SmallSet doesn't provide a way to iterate over its members.

================
Comment at: clang-tidy/modernize/LoopConvertUtils.h:211
@@ +210,3 @@
+  bool operator<(const Usage &Other) const {
+    return std::make_tuple(Expression, IsArrow, Range.getBegin(),
+                           Range.getEnd()) <
----------------
alexfh wrote:
> Please use `std::tie` instead of `std::make_tuple` to avoid copies.
I used std::tie here at first, but it didn't work because it tries to bind a RValue to a non-const ref. 


http://reviews.llvm.org/D12631





More information about the cfe-commits mailing list