[PATCH] D56656: [clangd] Fix a reference invalidation
Kadir Cetinkaya via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 14 01:53:02 PST 2019
kadircet created this revision.
Herald added subscribers: cfe-commits, arphaman, jkorous, MaskRay, ioeric, ilya-biryukov.
Fix for the breakage in http://green.lab.llvm.org/green/job/clang-stage1-configure-RA/52811/consoleFull#-42777206a1ca8a51-895e-46c6-af87-ce24fa4cd561
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D56656
Files:
clangd/index/Background.cpp
Index: clangd/index/Background.cpp
===================================================================
--- clangd/index/Background.cpp
+++ clangd/index/Background.cpp
@@ -510,8 +510,12 @@
if (!AbsolutePath)
continue;
// Add file as dependency if haven't seen before.
- if (InQueue.try_emplace(*AbsolutePath).second)
+ if (InQueue.try_emplace(*AbsolutePath).second) {
Dependencies.emplace_back(*AbsolutePath, true);
+ // The insertion above might invalidate the reference, so update it as
+ // well.
+ CurDependencyPath = Dependencies[CurrentDependency].Path;
+ }
// The node contains symbol information only for current file, the rest is
// just edges.
if (*AbsolutePath != CurDependencyPath)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56656.181507.patch
Type: text/x-patch
Size: 782 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190114/c74c2e00/attachment.bin>
More information about the cfe-commits
mailing list