Skip to content

[clang][Modules] Reporting Errors for Duplicating Link Declarations in modulemaps #148959

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

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

qiongsiwu
Copy link
Contributor

@qiongsiwu qiongsiwu commented Jul 15, 2025

This PR teaches the modulemap parsing logic to report errors if the parsing logic sees duplicating link declarations in the same module. Specifically, duplicating link declarations means multiple link declarations with the same string-literal in the same module. No errors are reported if a same link declaration exist in a submodule and its enclosing module.

rdar://155880064

@qiongsiwu qiongsiwu self-assigned this Jul 15, 2025
@qiongsiwu
Copy link
Contributor Author

A different approach we can take is to deduplicate link libraries per module silently, and avoid adding any error checks. I think that is probably fine since there are no correctness issues. But I think it is also beneficial to report to the user that their modulemap contains duplicating link declarations. @Bigcheese @jansvoboda11 what do you think?

@jansvoboda11
Copy link
Contributor

I think a hard error is a bit too much initially, maybe let's introduce a warning first and then tighten the screws later?

…an error whe link declarations are used in submodules.
…ure as indicated by the test case clang/test/Modules/autolink.m
…s a feature as indicated by the test case clang/test/Modules/autolink.m"

This reverts commit 3286622.
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.

2 participants