[PATCH] D100638: [AST][Introspection] Avoid creating temporary strings when comparing LocationCalls.

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 16 05:06:11 PDT 2021


njames93 added inline comments.


================
Comment at: clang/lib/Tooling/NodeIntrospection.cpp:84
+
+  auto LI = Left.rbegin(), LE = Left.rend(), RI = Right.rbegin();
+  for (; LI != LE; ++LI, ++RI) {
----------------
steveire wrote:
> Would it make sense to compare the sizes `(leftsize < rightsize) return true` etc and only loop if the containers are the same size?
That wouldn't work as we are comparing lexicographically. If leftsize was smaller than rightsize, but the first item in left was `zzzz`, and first in right was `aaaa`. We'd want right to be marked as less then left.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100638/new/

https://reviews.llvm.org/D100638



More information about the cfe-commits mailing list