This is an archive of the discontinued LLVM Phabricator instance.

[gn build] Add missing clangd dependencies
ClosedPublic

Authored by aeubanks on Oct 18 2020, 1:41 PM.

Details

Summary

Fixes
$ ninja obj/build/rel/gen/clang-tools-extra/clangd/CompletionModel.CompletionModel.obj

Some tablegen include files from clang/include/clang/AST and
clang/include/clang/Sema need to be generated before CompletionModel is
compiled.

Diff Detail

Event Timeline

aeubanks created this revision.Oct 18 2020, 1:41 PM
aeubanks requested review of this revision.Oct 18 2020, 1:41 PM

Not really sure what the proper way to depend on indirectly included headers is...

thakis accepted this revision.Oct 22 2020, 7:10 AM
This revision is now accepted and ready to land.Oct 22 2020, 7:10 AM

Oh sorry didn't see the question about the proper way.

The Right Way to do this in theory: gn check can be used to verify that a target only includes headers from targets in the deps list. You can then put all public headers of a directory in a target and make gn check that all deps are correct. If a target's public headers include generated headers, the public header target would then have a dep on the generation action and everything works well.

However, llvm's cmake files don't list .h files in the cmakelist files, and I don't want to keep .h lists updated in the gn build without the cmake ground truth. (Actually, maybe sync_from_cmake.py could sync .h files against disk globs instead?). If we did list .h files, there'd probably be targets for {clang,llvm,...}/include/Foo and every lib target would depend on the header targets it included, or something. This is the "investigate feasibility of gn check" in llvm/utils/gn/TODO.txt. At the moment, the llvm gn bots always build everything and run all tests if any .h file is touched since gn doesn't know about .h files. If it did, https://github.com/nico/hack/blob/master/llvmgnsyncbot/syncbot.py#L143 could not list .h and then a change touching a .h file in clang would only run clang and clang-tidy and clangd and compiler-rt tests, not llvm tests. So that'd be lowkey nice.

But for now, I think this here as-is is an ok-if-a-bit-iffy fix.

This revision was automatically updated to reflect the committed changes.