[PATCH] D59757: [clangd] Send empty diagnostics when a file is closed

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 25 03:00:31 PDT 2019


ilya-biryukov added inline comments.


================
Comment at: clang-tools-extra/clangd/ClangdLSPServer.cpp:1000
     std::lock_guard<std::mutex> Lock(FixItsMutex);
     FixItsMap[File] = LocalFixIts;
   }
----------------
hokein wrote:
> ilya-biryukov wrote:
> > hokein wrote:
> > > IIUC, it seems that we might have race condition here, considering:
> > > 
> > > - open a file which will take a long time to get diagnostic
> > > - the file gets closed, we publish an empty diagnostic
> > > - we get the diagnostics of the file, and we cache them, and emit them to clients
> > We should be fine there, `TUScheduler` won't send diagnostics after the call to `remove` returns.
> > This is ensured by calling `ASTWorker::stop()`, which sets the `ASTWorker::ReportDiagnostics` flag to `false`.
> That makes sense, thanks for the clarification. Maybe add a comment in onDocumentDidClose for future readers. 
Added a comment. Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D59757





More information about the cfe-commits mailing list