Skip to content

[NFC, Incremental] Refactoring to facilitate replacing the inputDependencySourceMap with the right thing #685

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 5 commits into from
May 28, 2021

Conversation

davidungar
Copy link
Contributor

Redo of reverted #664 ; reverted because I forgot to add a new file to CMakeLists.txt.

This PR paves the way for bug fixes by adding an intentions layer to the usage of a bidirectional map to go from input files (.swift) to and from dependency files (.swiftdeps).

  1. Wrap the BidirectionalMap into its own type, and put that into InputDependencySourceMap.swift
  2. Make the interface very explicit as to intentions:
    • Add an enum to explain why entries are being added (AdditionPurpose) and pass that through calls that add entries
    • addMapEntry in the ModuleDependencyGraph becomes addEntry on the new type
    • The new type does lookups via sourceIfKnown(for:) and inputIfKnown(for:) to contrast the possibility of failure with sourceRequired(for:), which is the new name for getSource(for:) in the graph method.
  3. Fixes a misnomer in a local variable in collectInputsInvalidatedBy(input:)
  4. The reduce in populateInputDependencySourceMap has been rewritten for clarity.

In preparation for: rdar://77998890

David Ungar added 5 commits May 28, 2021 14:10
# Conflicts:
#	Sources/SwiftDriver/IncrementalCompilation/ModuleDependencyGraph.swift
# Conflicts:
#	Sources/SwiftDriver/IncrementalCompilation/ModuleDependencyGraph.swift
@davidungar
Copy link
Contributor Author

@swift-ci please test

@davidungar davidungar requested a review from artemcm May 28, 2021 21:54
@davidungar davidungar merged commit 4df7faa into swiftlang:main May 28, 2021
@davidungar
Copy link
Contributor Author

Thanks, @akyrtzi !

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