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

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


ilya-biryukov added inline comments.


================
Comment at: clangd/index/Background.cpp:488
+    Dependencies.push_back(std::move(ToVisit.front()));
+    auto &CurDependency = Dependencies.back();
+    ToVisit.pop();
----------------
This reference makes it just as easy to access the vector we'll be modifying inside the loop.
Can we avoid modifying the values inside the vector completely? I.e. ideally we'll have only `push_back` into the vector and no modifications of the internal references?



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