clangTesting is a few helpers used in clang unittests.
It’s currently set up as a public clang library like any other: it’s part of libclang-cpp.so
, debian provides /usr/lib/llvm-13/include/clang/testing/TestClangConfig.h
on my system, etc.
I don’t think this was particularly intended or useful (though it could conceivably be used).
I’d like to remove this from the public libraries, and have it been an in-tree unittest helper only. Mechanically, this means making it an add_llvm_library(... BUILDTREE_ONLY)
instead of an add_clang_library()
, and only building it if unittests are on. This is how llvmTestingSupport
works.
Any objections to this? I plan to send a patch soon and will link it here.
Immediate motivation: I’d like to add some test helpers that would depend on gtest, just as the llvmTestingSupport library does. However, the public clangd libraries can’t depend on gtest, and in fact you can do a standalone build of clangd without gtest (you can’t build the unittests, obviously).
Specifically, a helper object to parse some code and keep the AST alive, for use in AST unittests and include cleaner. We’ve used this approach in clangd to good effect.