]> granicus.if.org Git - clang/commit
[modules] Add ability to specify module name to module file mapping (reapply)
authorBoris Kolpackov <boris@codesynthesis.com>
Thu, 31 Aug 2017 06:26:43 +0000 (06:26 +0000)
committerBoris Kolpackov <boris@codesynthesis.com>
Thu, 31 Aug 2017 06:26:43 +0000 (06:26 +0000)
commit90051f7676a0198fd55d8435eb27815493c7bf4e
tree23cb22e10a28fe26d90ffe861a7f23ad3359d3c1
parent2dd48cf4767f2bbcf35fa7b00d66771b8d31c2ec
[modules] Add ability to specify module name to module file mapping (reapply)

Extend the -fmodule-file option to support the [<name>=]<file> value format.
If the name is omitted, then the old semantics is preserved (the module file
is loaded whether needed or not). If the name is specified, then the mapping
is treated as just another prebuilt module search mechanism, similar to
-fprebuilt-module-path, and the module file is only loaded if actually used
(e.g., via import). With one exception: this mapping also overrides module
file references embedded in other modules (which can be useful if module files
are moved/renamed as often happens during remote compilation).

This override semantics requires some extra work: we now store the module name
in addition to the file name in the serialized AST representation.

Reviewed By: rsmith

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@312220 91177308-0d34-0410-b5e6-96231b3b80d8
16 files changed:
docs/Modules.rst
include/clang/Driver/Options.td
include/clang/Lex/HeaderSearch.h
include/clang/Lex/HeaderSearchOptions.h
include/clang/Serialization/ASTReader.h
include/clang/Serialization/ModuleManager.h
lib/Driver/ToolChains/Clang.cpp
lib/Frontend/CompilerInstance.cpp
lib/Frontend/CompilerInvocation.cpp
lib/Frontend/FrontendActions.cpp
lib/Lex/HeaderSearch.cpp
lib/Serialization/ASTReader.cpp
lib/Serialization/ASTWriter.cpp
lib/Serialization/GlobalModuleIndex.cpp
lib/Serialization/ModuleManager.cpp
test/CXX/modules-ts/basic/basic.search/module-import.cpp [new file with mode: 0644]