Debugging Swift Module generation in Xcode


I'm trying to test the waters for importing a few select modules a large C++20 codebase into the swift compiler.

I reported one issue already, where the Swift compiler doesn't understand the new char types (char8_t, char16_t, char32_t). Interop: Use of c++20 type char8_t confuses the swift compiler and Xcode · Issue #68726 · apple/swift · GitHub

After commenting out the type traits we have with those types in them, I get the next error when trying to ctrl+click the imported module in my main.swift file of the example project:

...which is less than helpful. The project builds fine when running the build procedure in Xcode and when building from the command line with cmake --build Xcode-build-dir.

Where can I view the logs for this conversion process to see exactly what part of my library is tripping the Swift compiler so I can reduce the test case?


1 Like

Oh, this is actually related to the second problem in my issue. If I put

#if __cplusplus < 201703L
#    error "not even C++17, need C++20"
#if __cplusplus < 202002L
#    error "Not C++20"

At the top of my first header file, the project builds just fine with the C/C++ Language Dialect set to C++20, and the Swift interop setting set to C++, but the swift representation generator in Xcode doesn't seem to look at either of those values when it is compiling my header file. and compiles it with the default std version. And the error message now says "not even C++17, need C++20".