Skip to content

Modify clang declaration weakly-imported query to use Swift's code-gen target triple #81113

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

artemcm
Copy link
Contributor

@artemcm artemcm commented Apr 25, 2025

Similarly to how #70564 configures 'ClangImporter's 'CodeGenerator' using Swift's compilation target triple, we must use the versioned version of the 'isWeakImported' query to determine linkage for imported Clang symbols.

@artemcm
Copy link
Contributor Author

artemcm commented Apr 25, 2025

@artemcm artemcm force-pushed the ParameterizeWeakQueryForSwift branch from 1e4a388 to 427c0ce Compare April 28, 2025 18:11
@artemcm
Copy link
Contributor Author

artemcm commented Apr 28, 2025

@@ -140,6 +140,7 @@ class ClangModuleLoader : public ModuleLoader {
/// (The implementing `ClangImporter` class maintains separate Target info
/// for use by IRGen/CodeGen clients)
virtual clang::TargetInfo &getModuleAvailabilityTarget() const = 0;
virtual clang::TargetInfo &getTargetInfo() const = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, a vestige of a prior approach. Removed. Thank you.


//--- cheaders/Bar.h
#pragma clang attribute push (__attribute__((availability(macOS, introduced=15.00))), apply_to=function)
extern int funcBar(void);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For completeness I think it would be helpful to also test that a declaration with a < 15.0 introduction is not weak imported.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

…n target triple

Similarly to how swiftlang#70564 configures 'ClangImporter's 'CodeGenerator' using Swift's compilation target triple, we must use the versioned version of the 'isWeakImported' query to determine linkage for imported Clang symbols.
@artemcm artemcm force-pushed the ParameterizeWeakQueryForSwift branch from 427c0ce to dde7fd4 Compare April 28, 2025 18:43
@artemcm
Copy link
Contributor Author

artemcm commented Apr 28, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants