-
Notifications
You must be signed in to change notification settings - Fork 10.5k
C++ Interop: add a test for std module interface #39562
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@swift-ci please smoke test |
// CHECK-STD: import std.chrono | ||
// CHECK-STD: import std.iosfwd | ||
|
||
// CHECK-IOSFWD: extension std.__1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will probably need to be different on Linux. I think it's std.__cxx11.string
or something like that.
@@ -0,0 +1,33 @@ | |||
// RUN: %target-swift-ide-test -print-module -module-to-print=std -source-filename=x -enable-cxx-interop -Xcc -stdlib=libc++ -tools-directory=%llvm_obj_root/bin -module-cache-path %t | %FileCheck %s -check-prefix=CHECK-STD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm so it looks like here you're specifically testing libc++. I think it would be good to test with whatever stdlib the client's is using.
I'm not sure libstdc++ will work until #38675 lands, so this is OK for now.
// Clang driver on Windows doesn't support -stdlib=libc++ | ||
// XFAIL: OS=windows-msvc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to see if we can import MSVC's STL. (And if so, add a test for it.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't currently import it: the problem with MSVC's stdlib is that it doesn't have a module map. This should be possible to workaround by manually adding the std
definition here: https://github.com/apple/swift/blob/main/stdlib/public/Platform/visualc.modulemap, but I'm not sure that's the best approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good. I'm super excited to start testing this!
Other than the nit about std.string
, I think this is good to go. Once we have lazy member loading, let's re-visit this test and start checking the system's stdlib rather than libc++ on all platforms.
Probably best to just disable this test on Linux until we support libstdc++ (very soon). But I don't feel strongly. |
The test checks that the Swift module interface for `std` & its submodules can be generated & that it contains a couple of known declarations.
b175771
to
bb5f9eb
Compare
Agreed, I disabled it on Linux for now. |
@swift-ci please smoke test |
@swift-ci please test Windows |
@swift-ci please smoke test Linux |
This test is "unexpectedly passing" on my Linux box, so the whole test suite fails. :-( I think the test should just be |
That or |
The test checks that the Swift module interface for
std
& its submodules can be generated & that it contains a couple of known declarations.This is a follow-up after #37806.