diff options
author | Michael Spencer <bigcheesegs@gmail.com> | 2021-05-17 09:40:29 +0200 |
---|---|---|
committer | Jan Svoboda <jan_svoboda@apple.com> | 2021-05-17 10:40:51 +0200 |
commit | d3676d4b666ead794fc58bbc7e07aa406dcf487a (patch) | |
tree | e6bd8757bf390c926ef87571afeee9be90764fcd /clang/lib/Basic/Module.cpp | |
parent | 65936b952964d257c387ce2a7a9362a2ce297a63 (diff) | |
download | llvm-d3676d4b666ead794fc58bbc7e07aa406dcf487a.zip llvm-d3676d4b666ead794fc58bbc7e07aa406dcf487a.tar.gz llvm-d3676d4b666ead794fc58bbc7e07aa406dcf487a.tar.bz2 |
[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
Diffstat (limited to 'clang/lib/Basic/Module.cpp')
-rw-r--r-- | clang/lib/Basic/Module.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp index 8d26149..b6cf162 100644 --- a/clang/lib/Basic/Module.cpp +++ b/clang/lib/Basic/Module.cpp @@ -245,9 +245,10 @@ bool Module::fullModuleNameIs(ArrayRef<StringRef> nameParts) const { Module::DirectoryName Module::getUmbrellaDir() const { if (Header U = getUmbrellaHeader()) - return {"", U.Entry->getDir()}; + return {"", "", U.Entry->getDir()}; - return {UmbrellaAsWritten, Umbrella.dyn_cast<const DirectoryEntry *>()}; + return {UmbrellaAsWritten, UmbrellaRelativeToRootModuleDirectory, + Umbrella.dyn_cast<const DirectoryEntry *>()}; } void Module::addTopHeader(const FileEntry *File) { |