This is an archive of the discontinued LLVM Phabricator instance.

[clang][deps] Remove '-fmodules-cache-path=' arguments
ClosedPublic

Authored by jansvoboda11 on Feb 24 2022, 4:46 AM.

Details

Summary

With explicit modules build, the '-fmodules-cache-path=' argument is unused.

This patch removes the argument to avoid warnings or errors (with '-Werror') stemming from that.

Depends on D118915.

Diff Detail

Event Timeline

jansvoboda11 requested review of this revision.Feb 24 2022, 4:46 AM
jansvoboda11 created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 24 2022, 4:46 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
dexonsmith added inline comments.Mar 1 2022, 4:39 PM
clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp
36

Is that the only one to remove? (asking because you dropped the FIXME, which suggested it might only be one example)

Also, could this just be an assertion, since makeInvocationForModuleBuildWithoutPaths() is already clearing things?

  • In other words, why do you need this in two places?
  • And if you do need it in both, does the test cover both, or should there be another test or RUN line for the other code path?
Herald added a project: Restricted Project. · View Herald TranscriptMar 1 2022, 4:39 PM
jansvoboda11 added inline comments.Mar 2 2022, 7:21 AM
clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp
36

Ah, there are some others (e.g. -fmodules-prune-interval=, -fmodules-prune-after=) so you're right dropping the FIXME might be a bit hasty. I'll update the fixme instead of removing it.

This cannot be an assertion unfortunately. makeInvocationForModuleBuildWithoutPaths() is clearing the modules cache path in the -cc1 command lines for building modules. This however, is dealing with the driver command line for building the original translation unit, which doesn't go through the CompilerInvocation machinery at all. We're relying on textual manipulation here at this moment. (TU command lines are driver command lines that might expand into multiple commands and therefore are not guaranteed to be representable by single CompilerInvocation.)

The test I touched covers only this change to the driver command line for building the TU. The error (-Wunused-command-line-argument) I test is only produced by the driver. This means the other change (clearing modules cache path in -cc1 CompilerInvocation) is just a preventive measure, not necessary to make the updated test pass and not testable.

Update TODO instead of removing it

This revision is now accepted and ready to land.Mar 10 2022, 4:08 PM
This revision was landed with ongoing or failed builds.Mar 12 2022, 3:04 AM
This revision was automatically updated to reflect the committed changes.