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

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 4 06:12:03 PDT 2015


alexfh added inline comments.

================
Comment at: clang-tidy/modernize/LoopConvertUtils.cpp:465
@@ +464,3 @@
+  if (UsageSet.insert(U).second) {
+    Usages.push_back(U);
+    return true;
----------------
Do you need both `Usages` and `UsageSet`?

================
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()) <
----------------
Please use `std::tie` instead of `std::make_tuple` to avoid copies.

================
Comment at: clang-tidy/modernize/LoopConvertUtils.h:217
@@ +216,3 @@
+  bool operator==(const Usage &Other) const {
+    return Expression == Other.Expression && IsArrow == Other.IsArrow &&
+           Range == Other.Range;
----------------
Looks like you can use `std::tie` here as well.


http://reviews.llvm.org/D12631





More information about the cfe-commits mailing list