Skip to content

[CAS] Cache symbol graph outputs #77935

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 1 commit into from
Dec 4, 2024

Conversation

benlangmuir
Copy link
Contributor

The symbol graph output from a module can contain an arbitrary number of files, depending on what extensions it contains, so cache a list of symbol graph files with their base name and contents so that they can be replayed.

rdar://140286819

The symbol graph output from a module can contain an arbitrary number of
files, depending on what extensions it contains, so cache a list of
symbol graph files with their base name and contents so that they can be
replayed.

rdar://140286819
@benlangmuir
Copy link
Contributor Author

@swift-ci please smoke test

initBackend(InputsAndOutputs);
}

llvm::Expected<std::unique_ptr<llvm::vfs::OutputFileImpl>>
createFileImpl(llvm::StringRef ResolvedPath,
std::optional<llvm::vfs::OutputConfig> Config) {
auto ProducingInput = OutputToInputMap.find(ResolvedPath);
if (ProducingInput == OutputToInputMap.end() &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of doing this special condition, I prefer add symbol graph to SupplementaryOutputPaths and compute the path in ArgsToFrontendOutputsConverter.cpp.

Hope it is not too bad to pass the output path to the location where the file is generated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I prefer add symbol graph to SupplementaryOutputPaths and compute the path in ArgsToFrontendOutputsConverter.cpp.

The symbol graph contains an arbitrary number of files, and I think you can't know how many files there will be until you typecheck, because if you have module A that contains import B; extension B.Foo { public func bar() {} } there will be A.symbols.json and [email protected]. That's why I didn't model it as a "normal" output.

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.

It seems that symbol graph doesn't emit in batch mode so the current CAS writer works. Maybe it is good to emit a warning to ignore symbol graph command-line options when batch mode is used.

@benlangmuir benlangmuir merged commit 2e33a9a into swiftlang:main Dec 4, 2024
3 checks passed
@benlangmuir benlangmuir deleted the cache-symbol-graph branch December 4, 2024 18:30
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