[PATCH] D48940: [clangd] Wait for first preamble before code completion

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 5 00:58:36 PDT 2018

sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.

Nice fix!
Possible test: add a file with complicated preamble (billion laughs?) and immediately schedule 5 preamble actions. They should all get a non-null preamble and the pointers should all be the same.

Comment at: clangd/TUScheduler.cpp:408
+void ASTWorker::waitForFirstPreamble() const {
+  PreambleWasBuilt.wait();
inline? should fit on one line...

Comment at: clangd/TUScheduler.h:104
   ///   source code from headers.
+  /// However, Action will be scheduled to run after the first rebuild of the
+  /// preamble for the corresponding file finishes. Note that the rebuild can
Not sure what "however" is contrasting with.

Could be just: "If there's no preamble yet (because the file was just opened), we'll wait for it to build. The preamble may still be null if it fails to build or is empty."

  rCTE Clang Tools Extra


More information about the cfe-commits mailing list