This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Add tests that no-op changes are cheap
ClosedPublic

Authored by sammccall on Apr 13 2020, 1:07 PM.

Details

Summary

We want to be sure they don't cause AST rebuilds or evict items from the cache.
D77847 is going to start sending spurious no-op changes (in case the preamble
was invalidated), this is cheap enough but we shouldn't regress that in future.

Diff Detail

Event Timeline

sammccall created this revision.Apr 13 2020, 1:07 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 13 2020, 1:07 PM
kadircet accepted this revision.Apr 14 2020, 1:27 AM

thanks for doing this LGTM!

clang-tools-extra/clangd/unittests/ClangdTests.cpp
501

nit:

std::make_tuple(arg.first(), arg.second.UsedBytes != 0, arg.second.PreambleBuilds, arg.second.ASTBuilds) == std::tie(Name, UsesMemory, PreambleBuilds, ASTBuilds);
clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
762

nit: maybe we drop these noop updates except the first one.

This revision is now accepted and ready to land.Apr 14 2020, 1:27 AM
sammccall marked 3 inline comments as done.Apr 14 2020, 7:15 AM
sammccall added inline comments.
clang-tools-extra/clangd/unittests/ClangdTests.cpp
501

Switched to tie for the trivial fields, but I don't like separating out the unnamed (first()) or nonobvious (UsedBytes!=0) things from what they're compared to.

clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
762

I think that allows an implementation that always compares the compile command to the first-ever (i.e. changes to the compile command don't "stick")
This is the primary test that verifies that no-op changes are recognized, so I think we should keep testing that (it's pretty cheap)

This revision was automatically updated to reflect the committed changes.
sammccall marked an inline comment as done.