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)


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)
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to