-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[clang][deps] Store common, partially-formed invocation #65677
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
Conversation
CI.getHeaderSearchOpts().ModulesIgnoreMacros.clear(); | ||
} | ||
|
||
return CI; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going through CowCompilerInvocation(const CompilerInvocation &X)
, right? Could we add an &&
version that steals the sub objects without copying them? Obviously less important than avoiding the per-module copies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I'm happy to do that in a follow-up (constantly rebasing is kinda annoying).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented in #66301.
@@ -117,14 +112,37 @@ ModuleDepCollector::makeInvocationForModuleBuildWithoutOutputs( | |||
CI.getFrontendOpts().ARCMTAction = FrontendOptions::ARCMT_None; | |||
CI.getFrontendOpts().ObjCMTAction = FrontendOptions::ObjCMT_None; | |||
CI.getFrontendOpts().MTMigrateDir.clear(); | |||
CI.getLangOpts().ModuleName = Deps.ID.ModuleName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could clear this string to make sure it won't get copied.
7c54eae
to
0b4be90
Compare
We create one `CompilerInvocation` for each modular dependency we discover. This means we create a lot of copies, even though most of the invocation is the same between modules. This patch makes use of the copy-on-write flavor of `CompilerInvocation` to share the common parts, reducing memory usage and speeding up the scan.
We create one `CompilerInvocation` for each modular dependency we discover. This means we create a lot of copies, even though most of the invocation is the same between modules. This patch makes use of the copy-on-write flavor of `CompilerInvocation` to share the common parts, reducing memory usage and speeding up the scan.
We create one
CompilerInvocation
for each modular dependency we discover. This means we create a lot of copies, even though most of the invocation is the same between modules. This patch makes use of the copy-on-write flavor ofCompilerInvocation
to share the common parts, reducing memory usage and speeding up the scan.