This is an archive of the discontinued LLVM Phabricator instance.

[WIP][clang] Add a cmake flag for choosing to build clang-repl
Changes PlannedPublic

Authored by leonardchan on Aug 16 2021, 5:14 PM.

Details

Summary

Not all downstream users may want to build all tools shipped with clang. clang-repl for us in particular can sometimes lead to flaky builds when testing a toolchain built with LTO.

This is a WIP patch that demonstrates:

  • Allowing clang-repl to be built (by default) as part of check-all. Note that this doesn't remove it as a build target. It just makes it so that it's not built by default.
  • Only running tests that require clang-repl via a REQUIRES line.

Diff Detail

Event Timeline

leonardchan created this revision.Aug 16 2021, 5:14 PM
leonardchan requested review of this revision.Aug 16 2021, 5:14 PM
leonardchan planned changes to this revision.
leonardchan added inline comments.
clang/CMakeLists.txt
468

Apart from name bikeshedding, it's more likely we'll want this ON by default to match current upstream behavior, then downstream users like us can just set this to OFF in our configs.

Not all downstream users may want to build all tools shipped with clang. clang-repl for us in particular can sometimes lead to flaky builds when testing a toolchain built with LTO.

Can we just fix clang-repl instead? I think there needs to be a more compelling case to add a new cmake options for this.

Rather than hardcoding this only for clang-repl, I'd prefer to use a more generic approach.

We already have LLVM_DISTRIBUTION_COMPONENTS so one possibility would be to set a lit feature for every component. For example, if LLVM_DISTRIBUTION_COMPONENTS=foo;bar we would set foo-distribution-component and bar-distribution-component. The challenge is handling the default case where you want to build and test everything. We might be able to use CMake properties for that purpose to get the list of all tools and define the corresponding features.

Alternative would be to iterate over the CLANG_TEST_DEPS list and check if each entry is in LLVM_DISTRIBUTION_COMPONENTS, and if so add it to the list of dependencies and set a feature for it. If LLVM_DISTRIBUTION_COMPONENTS is empty, then include everything.