diff --git a/clang-tools-extra/clangd/TUScheduler.cpp b/clang-tools-extra/clangd/TUScheduler.cpp --- a/clang-tools-extra/clangd/TUScheduler.cpp +++ b/clang-tools-extra/clangd/TUScheduler.cpp @@ -795,7 +795,7 @@ // FIXME: It might be better to not reuse this AST. That way queued AST builds // won't be required for diags. llvm::Optional> AST = IdleASTs.take(this); - if (!AST) { + if (!AST || !InputsAreLatest) { auto RebuildStartTime = DebouncePolicy::clock::now(); llvm::Optional NewAST = buildAST( FileName, std::move(Invocation), CIDiags, Inputs, LatestPreamble); @@ -817,8 +817,6 @@ }); AST = NewAST ? std::make_unique(std::move(*NewAST)) : nullptr; } else { - assert(InputsAreLatest && !RanASTCallback && - "forgot to invalidate cached ast?"); log("Skipping rebuild of the AST for {0}, inputs are the same.", FileName); Status.update([](TUStatus &Status) { Status.Details.ReuseAST = true;