-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Dependency Scanning] Initialize Swift modules in libSwiftScan on scanner creation #72104
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 test |
f2c8941
to
96d09d2
Compare
lib/SIL/Utils/SILBridging.cpp
Outdated
@@ -110,8 +110,8 @@ void registerBridgedClass(BridgedStringRef bridgedClassName, SwiftMetatype metat | |||
SILNodeKind kind = iter->second; | |||
SwiftMetatype existingTy = nodeMetatypes[(unsigned)kind]; | |||
if (existingTy) { | |||
llvm::errs() << "Double registration of class " << className << '\n'; | |||
abort(); | |||
// We have already registered this class |
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.
@egorzhdan @eeckstein
What's the possible harm in doing this?
We have a library (libSwiftScan
) that gets loaded from a long-running process which needs to occasionally initialize a new instance of the tool the library provides (swiftscan_scanner_create
in this same PR diff), which needs the ability to initializeSwiftModules
. The same place currently calls INITIALIZE_LLVM
and that seems to support doing nothing on repeated initialization calls.
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.
I added this check to catch possible inconsistencies when registering classes. Your change works, though it would be somehow nicer to keep this check and guard the initialization call with
if (!swiftModulesInitialized())
initializeSwiftModules();
Then there is no problem if (for whatever reason) we add some registration code which truly must not run twice.
@swift-ci test |
96d09d2
to
11ea462
Compare
@swift-ci test |
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.
lgtm
@swift-ci test macOS platform |
@swift-ci test Windows platform |
@swift-ci test macOS platform |
1 similar comment
@swift-ci test macOS platform |
@swift-ci test macOS Platform |
Hmm, we seem to be getting:
From SPM tests that actually may be using this libSwiftScan. |
@swift-ci test macOS Platform |
…nner creation Resolves rdar://124100615
11ea462
to
e755e72
Compare
@swift-ci test |
Resolves rdar://124100615