-
Notifications
You must be signed in to change notification settings - Fork 341
Lazy initialize Swift runtime in backwards interop synth provider #7593
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
Lazy initialize Swift runtime in backwards interop synth provider #7593
Conversation
@swift-ci test |
if (!ts) | ||
return {}; | ||
|
||
swift_type = ts->GetTypeFromMangledTypename(ConstString(swift_name)); |
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.
Do you think you could change this loop to fid the swift_name
instead, and get the type system after the loop, only if you found a name? This way you don't need to have TypeSystemSwift *ts = nullptr;
and setting it inside the statement.
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.
Sure.
An alternative implementation would be to extract the part that finds the swift name into it's own function:
And have This way, you can check for the swift name in the beginning of the formatter closure:
And no need to pass in closures to the extract function. I think breaking |
4949de5
to
08d60e3
Compare
How would that work for the recursive case? |
@swift-ci test |
You just call the other function in the closure:
|
Otherwise the Swift runtime and scratch context will be initialized in any process that contains C++ struct types, which costs performance and produces spurious warnings if no Swift runtime is available. rdar://116533409
08d60e3
to
3bce4a2
Compare
Done. |
@swift-ci test |
@swift-ci test windows |
1 similar comment
@swift-ci test windows |
Otherwise the Swift runtime and scratch context will be initialized in
any process that contains C++ struct types, which costs performance
and produces spurious warnings if no Swift runtime is available.
rdar://116533409