diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-08-31 06:26:43 +0000 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-08-31 06:26:43 +0000 |
commit | d30446fd773e9571a287bb2c3e5d06ab86f7e18b (patch) | |
tree | 33333cfa1ff0bf4559655240ddc861f4c9ee9147 /clang/lib/Serialization/GlobalModuleIndex.cpp | |
parent | b8198f02e689b2234c09c1171539ecfa3a0f59b2 (diff) | |
download | llvm-d30446fd773e9571a287bb2c3e5d06ab86f7e18b.zip llvm-d30446fd773e9571a287bb2c3e5d06ab86f7e18b.tar.gz llvm-d30446fd773e9571a287bb2c3e5d06ab86f7e18b.tar.bz2 |
[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
llvm-svn: 312220
Diffstat (limited to 'clang/lib/Serialization/GlobalModuleIndex.cpp')
-rw-r--r-- | clang/lib/Serialization/GlobalModuleIndex.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Serialization/GlobalModuleIndex.cpp b/clang/lib/Serialization/GlobalModuleIndex.cpp index 6978e7e..20c114297b 100644 --- a/clang/lib/Serialization/GlobalModuleIndex.cpp +++ b/clang/lib/Serialization/GlobalModuleIndex.cpp @@ -619,6 +619,10 @@ bool GlobalModuleIndexBuilder::loadModuleFile(const FileEntry *File) { (uint32_t)Record[Idx++], (uint32_t)Record[Idx++], (uint32_t)Record[Idx++]}}}; + // Skip the module name (currently this is only used for prebuilt + // modules while here we are only dealing with cached). + Idx += Record[Idx] + 1; + // Retrieve the imported file name. unsigned Length = Record[Idx++]; SmallString<128> ImportedFile(Record.begin() + Idx, |