[all-commits] [llvm/llvm-project] 7388c3: [clangd][SwapIndex] ensure that the old index is a...

Aleksandr Platonov via All-commits all-commits at lists.llvm.org
Fri Jan 22 05:31:11 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7388c34685954862e5f1fa4734f42f7087e697a2
      https://github.com/llvm/llvm-project/commit/7388c34685954862e5f1fa4734f42f7087e697a2
  Author: Aleksandr Platonov <platonov.aleksandr at huawei.com>
  Date:   2021-01-22 (Fri, 22 Jan 2021)

  Changed paths:
    M clang-tools-extra/clangd/index/Index.cpp
    M clang-tools-extra/clangd/index/Merge.cpp

  Log Message:
  -----------
  [clangd][SwapIndex] ensure that the old index is alive while we are using it via the function returned by `SwapIndex::indexedFiles()` call

Without this patch the old index could be freed, but there still could be tries to access it via the function returned by `SwapIndex::indexedFiles()` call.
This leads to hard to reproduce clangd crashes at code completion.
This patch keeps the old index alive until the function returned by `SwapIndex::indexedFiles()` call is alive.

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D95206




More information about the All-commits mailing list