[PATCH] D49783: [clangd] Do not rebuild AST if inputs have not changed

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 26 02:21:37 PDT 2018


ilya-biryukov added inline comments.


================
Comment at: clangd/TUScheduler.cpp:360
       std::lock_guard<std::mutex> Lock(Mutex);
+      OldPreamble.reset();
       if (NewPreamble)
----------------
ioeric wrote:
> ilya-biryukov wrote:
> > ioeric wrote:
> > > Why reset?
> > We don't need the old preamble at this point, so we give it a chance to die (if there are no more references).
> > Note that there's an expensive operation that follows (building the AST), so removing the preamble before it seems like a win
> sg. and do we guard this with mutex because the same old preamble data can be accessed  by other threads? might worth a comment.
Guarding with mutex is not actually required. Moved it out of the locked section and added a comment, thanks!


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D49783





More information about the cfe-commits mailing list