This is an archive of the discontinued LLVM Phabricator instance.

[clang][deps] Ensure module invocation can be serialized
ClosedPublic

Authored by benlangmuir on Feb 6 2023, 4:54 PM.

Details

Summary

When reseting modular options, propagate the values from certain options
that have ImpliedBy relations instead of setting to the default. Also,
verify in clang-scan-deps that the command line produced round trips
exactly.

Ideally we would automatically derive the set of options that need this
kind of propagation, but for now there aren't very many impacted.

Diff Detail

Event Timeline

benlangmuir created this revision.Feb 6 2023, 4:54 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 6 2023, 4:54 PM
benlangmuir requested review of this revision.Feb 6 2023, 4:54 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 6 2023, 4:54 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript

Having this check is great! Left some nits in-line.

clang/lib/Frontend/CompilerInvocation.cpp
643–661

The logic is getting a bit complicated here. I think it'd be good to break down what the CheckAgainstOriginalInvocation flag does. Feel free to come up with your own description.

756–757

This name is now not accurate (along with the comment below). Can you make sure these still make sense with the new logic?

clang/tools/clang-scan-deps/ClangScanDeps.cpp
668

The call to getNumOccurrences() is a bit odd. Can you drop that if you add llvm::cl::init(false) to the option definition?

  • Improved doc comment for RoundTrip (mostly followed the suggested text; also converted from to /).
  • Renamed variables
  • Moved default value for RoundTripArgs
benlangmuir marked 3 inline comments as done.Feb 8 2023, 1:28 PM
benlangmuir added inline comments.
clang/tools/clang-scan-deps/ClangScanDeps.cpp
668

I did this so that you can do -round-trip-args=false even if the default is true. But I simplified it by doing lvm::cl::init(DoRoundTripDefault) instead.

jansvoboda11 accepted this revision.Feb 8 2023, 1:44 PM

LGTM, thanks!

This revision is now accepted and ready to land.Feb 8 2023, 1:44 PM
This revision was landed with ongoing or failed builds.Feb 8 2023, 2:23 PM
This revision was automatically updated to reflect the committed changes.
benlangmuir marked an inline comment as done.