[PATCH] D56656: [clangd] Fix a reference invalidation

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 14 02:05:22 PST 2019


ilya-biryukov added inline comments.


================
Comment at: clangd/index/Background.cpp:517
+        // well.
+        CurDependencyPath = Dependencies[CurrentDependency].Path;
+      }
----------------
We should avoid modifying the container we're iterating over instead.
I suggest we separate the queue and the return value into two separate vectors.

We would `pop()` from the queue and `push()` to the result vector, therefore making bugs like this impossible.


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D56656





More information about the cfe-commits mailing list