Skip to content

[clang][modules][deps] Cherry-pick explicit modules commits #5568

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
merged 9 commits into from
Nov 18, 2022

Conversation

jansvoboda11
Copy link

This PR cherry-picks upstream commits motivated by implicitly discovered, explicitly built Clang modules.

This is a fix related to D135414. The original intention was to keep `BaseFS` as a member of the worker and conditionally overlay it with local in-memory FS. The `move` of ref-counted `BaseFS` was not intended, and it's a bug.

Disabling parallelism in the "by-module-name" test reliably reproduces this, and the test itself doesn't *need* parallelism. (I think `-j 4` was cargo culted from another test.) Reusing that test to check for correct behavior...

Reviewed By: DavidSpickett

Differential Revision: https://reviews.llvm.org/D136124

(cherry picked from commit d239f3c)
This patch adds new functions for writing/reading `FileID`s and uses them to replace some ad-hoc code.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D137211

(cherry picked from commit fdbc55a)
…instead of SourceLocation

For pragma diagnostic mappings, we always write/read `SourceLocation` with offset 0. This is equivalent to just writing a `FileID`, which is exactly what this patch starts doing.

Depends on D137211.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D137213

(cherry picked from commit f61c135)
…ceManager offsets

This patch is a NFC prep for D136624, where we start adjusting offsets into `SourceManager`.

Depends on D137213.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D137214

(cherry picked from commit 0bfc97e)
This is a prep-patch for D136624 which allows querying `SourceManager` with raw offsets instead of `SourceLocation`s.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D137215

(cherry picked from commit 9ae6e6a)
…affecting files

This patch delays some `ASTWriter` logic until after we've checked whether the source location entry we're serializing as an affecting file or not.

Depends on D137214.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D137216

(cherry picked from commit a13122c)
In D106876, we stopped serializing module map files that didn't affect compilation of the current module.

However, since each `SourceLocation` is simply an offset into `SourceManager`'s global buffer of concatenated input files in, these need to be adjusted during serialization. Otherwise, they can incorrectly point after the buffer or into subsequent input file.

This patch starts adjusting `SourceLocation`s, `FileID`s and other `SourceManager` offsets in `ASTWriter`.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D136624

(cherry picked from commit 6924a49)
The dependency scanner relies on the module map filtering logic in `ASTWriter`. The algorithm currently considers all system module maps affecting, which is not only sub-optimal, but can also cause failures when building a module explicitly (see attached test case).

This patch applies the same filtering logic to system module maps.

Reviewed By: Bigcheese

Differential Revision: https://reviews.llvm.org/D136007

(cherry picked from commit f33173a)
@jansvoboda11
Copy link
Author

@swift-ci please test

1 similar comment
@dcci
Copy link
Member

dcci commented Nov 9, 2022

@swift-ci please test

@dcci dcci self-requested a review November 9, 2022 18:59
Copy link
Member

@dcci dcci left a comment

Choose a reason for hiding this comment

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

LGTM. This should fix an assertion we're seeing in rdar://problem/102119326 (cc: @fredriss)

@artemcm
Copy link

artemcm commented Nov 10, 2022

Any chance we can also include 060b253?

@jansvoboda11
Copy link
Author

That commit already is in the target branch: 35515c9.

@artemcm
Copy link

artemcm commented Nov 10, 2022

That commit already is in the target branch: 35515c9.

Ah. I was looking it up by hash. Thank you!

@porglezomp
Copy link

porglezomp commented Nov 14, 2022

I believe some Swift fixes came in recently that might unblock this
@swift-ci please test

@dcci dcci merged commit fcaaa82 into stable/20221013 Nov 18, 2022
@jansvoboda11 jansvoboda11 deleted the jan_svoboda/stable-20221013-cherry-pick branch November 28, 2022 18:10
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.

4 participants