This is an archive of the discontinued LLVM Phabricator instance.

[clang][modules] Build inferred modules
ClosedPublic

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

Details

Summary

This patch enables explicitly building inferred modules.

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

Contains the following changes:

  1. [Clang] Fix the header paths in clang::Module for inferred modules.
    • The UmbrellaAsWritten and NameAsWritten fields in clang::Module are a lie for framework modules. For those they actually are the path to the header or umbrella relative to the clang::Module::Directory.
    • The exception to this case is for inferred modules. Here it actually is the name as written, because we print out the module and read it back in when implicitly building modules. This causes a problem when explicitly building an inferred module, as we skip the printing out step.
    • In order to fix this issue this patch adds a new field for the path we want to use in getInputBufferForModule. It also makes NameAsWritten actually be the name written in the module map file (or that would be, in the case of an inferred module).
  1. [Clang] Allow explicitly building an inferred module.
    • Building the actual module still fails, but make sure it fails for the right reason.

Split from D100934.

Diff Detail

Event Timeline

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

Looks great — thanks for splitting this out!

This revision is now accepted and ready to land.May 14 2021, 11:56 AM
This revision was landed with ongoing or failed builds.May 17 2021, 1:41 AM
This revision was automatically updated to reflect the committed changes.