-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[🍒][cxx-interop] Use translation unit scope when doing lookups; disambiguate math functions. #67020
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
Merged
zoecarver
merged 12 commits into
swiftlang:release/5.9
from
zoecarver:pick-math-and-tu-commits
Jun 30, 2023
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
68631b3
[cxx-interop] Pull over fix from 8e7766b and apply to strstr, sin, an…
zoecarver a71fbb5
[cxx-interop] Fix ambiguous 'exit' (same solution as above).
zoecarver 20eb29a
[cxx-interop] check file and directory, not or.
zoecarver c9de9e4
[cxx-interop] Re-work control flow when checking for duplicate functi…
zoecarver 4a790ad
[cxx-interop][nfc] remove `print-swiftconcurrencyshims-interface.swif…
zoecarver fbb4901
[cxx-interop] only ban strstr, sin, cos, and exit on darwin where the…
zoecarver eb417c8
[cxx-interop] Don't import `exit` from `Darwin` module, use the one f…
zoecarver db1e73c
[cxx-interop][nfc] Disable test for div.
zoecarver 64da260
[cxx-interop] Fix sema lookup scope so we find NSNotification interfa…
zoecarver 8839229
[cxx-interop] A little macros fix; breadcrumbs for future fixes.
zoecarver eff1ed8
[cxx-interop] fix how we import CF types.
zoecarver 4c21dd4
[nfc] Fix notification test
zoecarver File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
test/Interop/Cxx/objc-correctness/Inputs/nsnotification-bridging.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#import <Foundation/Foundation.h> | ||
|
||
extern NSString * const SpaceShipNotification; |
7 changes: 7 additions & 0 deletions
7
test/Interop/Cxx/objc-correctness/nsnotification-bridging-ide-test.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// RUN: %target-swift-ide-test -print-module -module-to-print=NSNofiticationBridging -I %S/Inputs -source-filename=x -enable-experimental-cxx-interop -enable-objc-interop | %FileCheck %s | ||
|
||
// REQUIRES: objc_interop | ||
|
||
// CHECK: import Foundation | ||
|
||
// CHECK: let SpaceShipNotification: String |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 0 additions & 10 deletions
10
test/Interop/Cxx/stdlib/print-swiftconcurrencyshims-interface.swift
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -enable-experimental-cxx-interop -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library) | ||
// | ||
// REQUIRES: executable_test | ||
// REQUIRES: concurrency | ||
// REQUIRES: libdispatch | ||
// REQUIRES: concurrency_runtime | ||
|
||
import StdlibUnittest | ||
|
||
import CxxStdlib | ||
import Cxx | ||
|
||
import _Concurrency | ||
import Dispatch | ||
|
||
@main struct Main { | ||
static func main() async { | ||
var ConcurrencyTestSuite = TestSuite("Concurrency") | ||
|
||
ConcurrencyTestSuite.test("Task.sleep") { | ||
let start = DispatchTime.now() | ||
await Task.sleep(100_000_000) | ||
let stop = DispatchTime.now() | ||
expectTrue(stop >= (start + .nanoseconds(100_000_000))) | ||
} | ||
|
||
ConcurrencyTestSuite.test("Task.sleep (non-blocking)") { | ||
let task = detach { | ||
std.string("Hello, Swift!") | ||
} | ||
|
||
await Task.sleep(100_000_000) | ||
expectEqual(await task.get(), "Hello, Swift!") | ||
} | ||
|
||
await runAllTestsAsync() | ||
} | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@zoecarver: is there some reason for not doing this check like
!topLevelModuleEq(decl, "SwiftConcurrencyShims") && decl->getDeclName().isIdentifier() && decl->getName() == "exit"
instead? HardcodingSwiftConcurrencyShims
is bad, but at least it is just one module name, and not two. I found out about this becauseSwiftGlibc
is the name of the overlaid module provided by Swift, but what if the system provides its own modulemap for the system headers and it is called differently?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 want to import user-defined overloaded or nested exit functions.