[all-commits] [llvm/llvm-project] d3676d: [clang][modules] Build inferred modules

Michael Spencer via All-commits all-commits at lists.llvm.org
Mon May 17 01:41:33 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d3676d4b666ead794fc58bbc7e07aa406dcf487a
      https://github.com/llvm/llvm-project/commit/d3676d4b666ead794fc58bbc7e07aa406dcf487a
  Author: Michael Spencer <bigcheesegs at gmail.com>
  Date:   2021-05-17 (Mon, 17 May 2021)

  Changed paths:
    M clang/include/clang/Basic/Module.h
    M clang/include/clang/Lex/ModuleMap.h
    M clang/lib/Basic/Module.cpp
    M clang/lib/Frontend/FrontendAction.cpp
    M clang/lib/Frontend/FrontendActions.cpp
    M clang/lib/Lex/ModuleMap.cpp
    M clang/lib/Serialization/ASTReader.cpp
    A clang/test/Modules/Inputs/explicit-build-inferred/frameworks/Inferred.framework/Headers/Inferred.h
    A clang/test/Modules/Inputs/explicit-build-inferred/frameworks/module.modulemap
    A clang/test/Modules/explicit-build-inferred.cpp

  Log Message:
  -----------
  [clang][modules] Build inferred modules

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).

2. [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.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D102491




More information about the All-commits mailing list