State of LLVM_ENABLE_MODULES build

https://llvm.org/docs/CMake.html

Whenever I’ve tested this option so far it broke in some different part of the code.
Is it supported at all? Is there any CI out there testing it?

I found out (the hard way) that there is a build job on Apple’s public CI here: LLDB Incremental [Jenkins] that sets LLVM_ENABLE_MODULES=On (example console log with cmake command here: LLDB Incremental #48457 Console [Jenkins]).

Thanks for the info, so one obvious difference is the use of libc++ vs libstdc++.
Maybe that explains the error?

While building module 'LLVM_Utils' imported from /home/runner/work/llvm-project/llvm-project/llvm/lib/Support/ARMTargetParser.cpp:14:
In file included from <module-includes>:1:
In file included from /home/runner/work/llvm-project/llvm-project/llvm/include/llvm/ADT/APFixedPoint.h:20:
In file included from /home/runner/work/llvm-project/llvm-project/llvm/include/llvm/ADT/DenseMapInfo.h:20:
In file included from /usr/include/c++/11/tuple:38:
/usr/include/c++/11/utility:378:27: error: redefinition of '__is_in_place_type_v<in_place_type_t<_Tp>>'
    inline constexpr bool __is_in_place_type_v<in_place_type_t<_Tp>> = true;
                          ^
/home/runner/work/llvm-project/llvm-project/llvm/include/llvm/ADT/APInt.h:23:10: note: '/usr/include/c++/11/utility' included multiple times, additional include site in header from module 'LLVM_Utils.ADT.APInt'
#include <utility>
         ^
/usr/include/c++/11/tuple:38:10: note: '/usr/include/c++/11/utility' included multiple times, additional include site in header from module 'LLVM_Utils.ADT.DenseMapInfo'
#include <utility>
         ^

It is most probably a Mac and thus uses libc++. Note that it is an LLDB incremental build. It is not a full LLVM build.

Looks like it works better with clang-16 but still this build flag would benefit from some more coverage.

Ah no, just getting different errors.
libstdc++:

In file included from /home/runner/work/llvm-project/llvm-project/clang/include/clang/Analysis/FlowSensitive/MapLattice.h:18:
In file included from /usr/include/c++/11/ostream:38:
In file included from /usr/include/c++/11/ios:44:
In file included from /usr/include/c++/11/bits/basic_ios.h:37:
/usr/include/c++/11/bits/locale_facets.h:2596:5: error: inline declaration of 'isspace' follows non-inline definition
    isspace(_CharT __c, const locale& __loc)
    ^
/usr/include/c++/11/bits/locale_facets.h:2596:5: note: previous definition is here
    isspace(_CharT __c, const locale& __loc)

libc++:

ld.lld: error: undefined symbol: clang::FieldDecl::getBitWidthValue(clang::ASTContext const&) const
>>> referenced by UnimplementedClient.cpp
>>>               tools/clang/tools/extra/clangd/index/remote/unimplemented/CMakeFiles/obj.clangdRemoteIndex.dir/UnimplementedClient.cpp.o:(clang::ast_matchers::internal::matcher_hasBitWidth0Matcher::matches(clang::FieldDecl const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const)

The Clang Stage 2 build also builds with modules. The LLDB bot is usually the first one to catch module related issues as it’s a faster, incremental bot.