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

Manuel Klimek via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 4 09:24:13 PDT 2015


klimek added inline comments.

================
Comment at: clang-tidy/modernize/LoopConvertUtils.cpp:463-470
@@ -462,1 +462,10 @@
 
+void ForLoopIndexUseVisitor::addUsage(const Usage &U) {
+  SourceLocation Begin = U.Range.getBegin();
+  if (Begin.isMacroID())
+    Begin = Context->getSourceManager().getExpansionLoc(Begin);
+
+  if (UsageLocations.insert(Begin).second)
+    Usages.push_back(U);
+}
+
----------------
Now that I take a step back - shouldn't we go to the *spelling* location to deduplicate? The spelling location is the location that will be edited, after all.


http://reviews.llvm.org/D12631





More information about the cfe-commits mailing list