Determining the required set of LLVM components for a certain functionality

When setting up the CMakeLists.txt for my project, I’ve often hit a bit of a snag when it comes to deciding what LLVM components to list in the CMake llvm_map_components_to_libnames() call.

Normally, I use a default set of components (specifically, the ones taken from the samples of any of the later chapters of Kaleidoscope) and things just work most of the time. When I happen to use a bit of functionality that isn’t available, I dump the list of components (with llvm-config --components) and then make an educated guess about which ones to use based on the LLVM libraries that my project will be linked against as a result. As you (the reader) might guess, this process can involve some trial-and-error.

So I have been wondering: is there a way to remove the guesswork from this process? In other words, can I determine the exact set of LLVM components I need to use in order to get my project up and running?

I would also like to know the answer to this question ?