Skip to content

[Driver] A Pile of Nits #34991

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
Dec 8, 2020
Merged

[Driver] A Pile of Nits #34991

merged 5 commits into from
Dec 8, 2020

Conversation

CodaFi
Copy link
Contributor

@CodaFi CodaFi commented Dec 7, 2020

  • Correct the stream we dump the fingerprint status of a dep graph node to
  • Formalize the ownership contract with the UsedDeclEnumerator - llvm::function_ref is non-owning.
  • Move a template definition into the header and delete some manual specializations.

Not doing so causes the IDE and terminals to interleave the output of the dump.
This class was relying on the caller to keep this member alive. In general, this will lead to startling memory ownership bugs if, say, the enumerators were returned from these functions. Pass it in as a parameter instead to formalize that contract.
So the compiler has a chance to see the definition for itself, rather than having to. manually force a specialization.
@CodaFi
Copy link
Contributor Author

CodaFi commented Dec 7, 2020

@swift-ci smoke test

Copy link
Contributor

@davidungar davidungar left a comment

Choose a reason for hiding this comment

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

Looks great to me! Might be nice to comment that one function ref parameter, but it's not strictly necessary. Something like: "Will be passed down to all callees in order to record the uses", maybe. Nice cleanups.

Comment on lines +496 to +501
findJobsToRecompileWhenNodesChange(const Nodes &nodes) {
std::vector<ModuleDepGraphNode *> foundDependents;
for (ModuleDepGraphNode *n : nodes)
findPreviouslyUntracedDependents(foundDependents, n);
return jobsContaining(foundDependents);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like you were able to remove some template foo by moving the code to here. Is that right? If so, great!

Comment on lines +342 to +344
os << "fingerprint: " << fingerprint.getValue() << "";
else
llvm::errs() << "no fingerprint";
os << "no fingerprint";
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes!

Comment on lines +412 to +413
UsedDeclEnumerator(const SourceFile *SF, const DependencyTracker &depTracker,
StringRef swiftDeps)
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the advantage in passing the function ref down recursively vs storing it in the instance?
Since you did it, I bet there is a good reason. Would be nice to have a comment, though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

llvm::function_ref is non-owning. It makes me nervous to see it stored.

Copy link
Contributor

Choose a reason for hiding this comment

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

D'Oh! Thank you for fixing this!

@@ -406,26 +406,19 @@ class UsedDeclEnumerator {
StringRef swiftDeps;

/// Cache these for efficiency
const DependencyKey sourceFileInterface;
Copy link
Contributor

Choose a reason for hiding this comment

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

I see... looks like this wasn't even used. Is that right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup.

Comment on lines -491 to -497
return reloadAndRemarkFineGrainedDepsOnNormalExit(
FinishedCmd, cmdFailed, forRanges, DependenciesFile);
}

std::vector<const Job *> reloadAndRemarkFineGrainedDepsOnNormalExit(
const Job *FinishedCmd, const bool cmdFailed, const bool forRanges,
StringRef DependenciesFile) {
Copy link
Contributor

Choose a reason for hiding this comment

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

LOL!

@CodaFi
Copy link
Contributor Author

CodaFi commented Dec 8, 2020

@swift-ci test

@CodaFi
Copy link
Contributor Author

CodaFi commented Dec 8, 2020

@CodaFi CodaFi merged commit 1687855 into swiftlang:main Dec 8, 2020
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