Skip to content

Conversation

artemcm
Copy link
Contributor

@artemcm artemcm commented Feb 16, 2024

We previously blanket omitted -Xcc -vfsoverlay flags from Swift module dependencies' command-line recipes. This is incorrect as the Swift module must have an exact matching VFS overlay that its Clang dependencies use, in order to load said Clang dependnecies successfully and resolve their headers as expected and as was done during the scan.

Resolves rdar://122667530

@artemcm
Copy link
Contributor Author

artemcm commented Feb 16, 2024

@swift-ci test

@artemcm artemcm changed the title [Dependency Scanning] Only omit Clang VFS overlays from Swift dependencies if unused by Clang dependencies [Dependency Scanning] Only omit Clang VFS overlays from Swift dependencies if unused by their Clang dependencies Feb 16, 2024
@artemcm
Copy link
Contributor Author

artemcm commented Feb 16, 2024

@swift-ci smoke test

@artemcm
Copy link
Contributor Author

artemcm commented Feb 16, 2024

@swift-ci smoke test

Copy link
Contributor

@cachemeifyoucan cachemeifyoucan left a comment

Choose a reason for hiding this comment

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

LGTM with a small improvement suggestion in line.

I had an idea of fixing this problem completely long term by:

  • switch clang importer to use direct cc1 only: #71118
  • do a dependency scanning for clang importer for each swift invocation and use the returning cc1 arg to construct clang importer
    Then any optimization can be done in clang scanner, swift will get it for free.

I had a prototype for clang importer dep scanning too. I just need to find it somewhere.

…ncies if unused by Clang dependencies We previously blanket omitted `-Xcc -vfsoverlay` flags from Swift module dependencies' command-line recipes. This is incorrect as the Swift module must have an exact matching VFS overlay that its Clang dependencies use, in order to load said Clang dependnecies successfully and resolve their headers as expected and as was done during the scan. Resolves rdar://122667530
@artemcm
Copy link
Contributor Author

artemcm commented Feb 16, 2024

@swift-ci smoke test

@artemcm
Copy link
Contributor Author

artemcm commented Feb 16, 2024

LGTM with a small improvement suggestion in line.

I had an idea of fixing this problem completely long term by:

  • switch clang importer to use direct cc1 only: [Caching] Create clang importer from cc1 args directly #71118
  • do a dependency scanning for clang importer for each swift invocation and use the returning cc1 arg to construct clang importer
    Then any optimization can be done in clang scanner, swift will get it for free.

I had a prototype for clang importer dep scanning too. I just need to find it somewhere.

I think this sounds very promising! I assume we would do this faux-scan after we actually resolved all the Clang dependencies so that it is as near to free as possible? Would be cool to get the benefit of all the command-line optimization work Clang is doing "for free".

@artemcm artemcm enabled auto-merge February 17, 2024 00:42
@artemcm artemcm merged commit 3c8073e into swiftlang:main Feb 17, 2024
@artemcm artemcm deleted the DepScanSmartVFSOpt branch February 22, 2024 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants