This is an archive of the discontinued LLVM Phabricator instance.

[clang][clang-scan-deps] Aggregate the full dependency information.
ClosedPublic

Authored by Bigcheese on Nov 14 2019, 1:00 PM.

Diff Detail

Event Timeline

Bigcheese created this revision.Nov 14 2019, 1:00 PM
arphaman added inline comments.Nov 20 2019, 3:33 PM
clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h
32

Are the strings supposed to represent the module names here? For C++20 modules, will a single string be enough to represent both the module's name and its partition name?

100

Can you add a comment on how AlreadySeen is supposed to be used. Are clients expected to update it once they get more dependencies?

Bigcheese marked 2 inline comments as done.Nov 20 2019, 4:19 PM
Bigcheese added inline comments.
clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h
32

If it's a partition the module name will just contain a :.

100

Will do. I'm still working out exactly how AlreadySeen should work. Ideally it would be shared across all workers of the same DependencyScanningService, but that needs thread synchronization and could have rather high overhead. The current model is that it's per worker, and you should expect to need to deduplicate modules across workers.

arphaman added inline comments.Nov 21 2019, 2:39 PM
clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp
109

What if Opts.Targets is empty?

Bigcheese marked an inline comment as done.Nov 21 2019, 3:00 PM
Bigcheese added inline comments.
clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp
109

If I recall correctly, Opts.Targets can never be empty. I gets set to <basename>.o if it would be empty.

arphaman added inline comments.Nov 21 2019, 5:49 PM
clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp
109

What I mean is, what if the client didn't request a dependency file in the original compilation command? ScanDeps worker currently has a fake "clang-scan-deps dependency" target that it adds if the target is empty, but I do't think that should be reported as an output file.

Bigcheese updated this revision to Diff 232483.Dec 5 2019, 6:01 PM
Bigcheese marked 2 inline comments as done.
  • Removed OutputPaths.
  • Add documentation for AlreadySeen.
Bigcheese added inline comments.Dec 5 2019, 6:03 PM
clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp
109

Ah, I see now. This is only needed for the compilation database case (as that's the only way to map back to a compile command), it's not needed if you're calling getFullDependencies directly. I can remove it for now, but I'm not really sure what to replace it with.

arphaman added inline comments.Dec 9 2019, 11:28 AM
clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
29

@Bigcheese It looks like there's some duplication in argument logic between this function and getAdditionalCommandLine. Can it be factored out into one function?

Bigcheese updated this revision to Diff 233233.Dec 10 2019, 5:02 PM

Refactored FullDependencies::getAdditionalCommandLine and ModuleDeps::getFullCommandLine to share code.

This revision is now accepted and ready to land.Dec 10 2019, 5:17 PM

Build result: pass - 60692 tests passed, 0 failed and 726 were skipped.

Log files: console-log.txt, CMakeCache.txt

Looks like the test for -full-command-line got dropped. I'll add that when I commit.

This revision was automatically updated to reflect the committed changes.