ilya-biryukov added inline comments.

================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:54
+      if (Conflicting.size() > 1) {
+        Tokens.erase(Tokens.begin() + I,
+                     Tokens.begin() + I + Conflicting.size());
----------------
This is potentially `O(n^2)`. Could we instead create a new vector and fill it 
with the new items?

The memory usage should not matter much - we have the AST stored in the 
background anyway. I bet we would be looking at it first if we wanted to 
minimize memory usage.

If we really wanted to **not** waste any memory, we could do it 
`std::erase_if`-style, i.e. move the items we want to remove to the end of the 
vector, call `vector::erase` once at the end.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64741



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to