This is an archive of the discontinued LLVM Phabricator instance.

[clang][deps] Support inferred modules
ClosedPublic

Authored by jansvoboda11 on May 14 2021, 6:34 AM.

Details

Summary

This patch adds support for inferred modules to the dependency scanner.

Effectively a cherry-pick of https://github.com/apple/llvm-project/pull/699 authored by @Bigcheese with libclang and other changes omitted.

Contains following changes:

  1. [Clang][ScanDeps] Ignore __inferred_module.map dependency.
    • This shows up with inferred modules, but it doesn't exist on disk, so don't report it as a dependency.
  1. [Clang][ScanDeps] Use the module map a module was inferred from for inferred modules.

Also includes a smoke test that uses clang-scan-deps output to perform an explicit build. There's no intention to duplicate whatever test/Modules contains, just to verify the produced command-line does "work" (with very loose definition of work).

Split from D100934.

Diff Detail

Event Timeline

jansvoboda11 requested review of this revision.May 14 2021, 6:34 AM
jansvoboda11 created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptMay 14 2021, 6:34 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
dexonsmith accepted this revision.May 14 2021, 12:47 PM

LGTM, thanks for splitting out and moving the tool to clang/utils.

This revision is now accepted and ready to land.May 14 2021, 12:47 PM
This revision was landed with ongoing or failed builds.May 17 2021, 2:42 AM
This revision was automatically updated to reflect the committed changes.
RKSimon added inline comments.
clang/utils/module-deps-to-rsp.py
1

@Bigcheese - https://lab.llvm.org/buildbot/#/builders/139/builds/4147 doesn't like this - should this be python3 ?

thakis added a subscriber: thakis.May 17 2021, 4:04 AM

Looks like this breaks tests on windows: http://45.33.8.238/win/38908/step_7.txt

jansvoboda11 added inline comments.May 17 2021, 4:16 AM
clang/utils/module-deps-to-rsp.py
1

Looks like this breaks tests on windows: http://45.33.8.238/win/38908/step_7.txt

Thanks for the heads-up. This might be hitting behavior introduced here: https://reviews.llvm.org/D102491#C2576775NL1045

Reverting this patch for now.

Did you see my message about the windows breakage?

Did you see my message about the windows breakage?

Yes, reverted in ccd485e55424b78c07c2f9520faf00b805f78c9b.

Re-landed this in c98833cdaad01787ea70ecdfabb05a7e142a6671 after reproducing and fixing the Windows failure.

frgossen added inline comments.
clang/test/ClangScanDeps/modules-inferred-explicit-build.m
13–15

These three commands rely on file creations in the current working directory.

jansvoboda11 added inline comments.May 20 2021, 3:48 AM
clang/test/ClangScanDeps/modules-inferred-explicit-build.m
13–15

Thanks for the heads-up and for the revert. Fixed in 7defab082070.