[PATCH] D64741: [clangd] Added highlighting for tokens that are macro arguments.

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 19 03:04:04 PDT 2019


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





More information about the cfe-commits mailing list