diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-08-14 05:02:58 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-08-14 05:02:58 +0000 |
commit | fb1e7f7d1aca7bcfc341e9214bda8b554f5ae9b6 (patch) | |
tree | 093ac406bd59d18b3971e52091ad0204b6e0032a /clang/lib/Frontend/FrontendActions.cpp | |
parent | 526ff155467dd70f79ee8bcf65a801a0f989b19e (diff) | |
download | llvm-fb1e7f7d1aca7bcfc341e9214bda8b554f5ae9b6.zip llvm-fb1e7f7d1aca7bcfc341e9214bda8b554f5ae9b6.tar.gz llvm-fb1e7f7d1aca7bcfc341e9214bda8b554f5ae9b6.tar.bz2 |
[modules] Add an experimental -cc1 feature to embed the contents of an input
file in the .pcm files. This allows a smaller set of files to be sent to a
remote build worker when building with explicit modules (for instance, module
map files need not be sent along with the corresponding precompiled modules).
This doesn't actually make the embedded files visible to header search, so
it's not useful as a packaging format for public header files.
llvm-svn: 245028
Diffstat (limited to 'clang/lib/Frontend/FrontendActions.cpp')
-rw-r--r-- | clang/lib/Frontend/FrontendActions.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/clang/lib/Frontend/FrontendActions.cpp b/clang/lib/Frontend/FrontendActions.cpp index 40277bd..0573618 100644 --- a/clang/lib/Frontend/FrontendActions.cpp +++ b/clang/lib/Frontend/FrontendActions.cpp @@ -268,8 +268,9 @@ collectModuleHeaderIncludes(const LangOptions &LangOpts, FileManager &FileMgr, bool GenerateModuleAction::BeginSourceFileAction(CompilerInstance &CI, StringRef Filename) { - // Find the module map file. - const FileEntry *ModuleMap = CI.getFileManager().getFile(Filename); + // Find the module map file. + const FileEntry *ModuleMap = + CI.getFileManager().getFile(Filename, /*openFile*/true); if (!ModuleMap) { CI.getDiagnostics().Report(diag::err_module_map_not_found) << Filename; @@ -291,6 +292,14 @@ bool GenerateModuleAction::BeginSourceFileAction(CompilerInstance &CI, return false; } + // Set up embedding for any specified files. + for (const auto &F : CI.getFrontendOpts().ModulesEmbedFiles) { + if (const auto *FE = CI.getFileManager().getFile(F, /*openFile*/true)) + CI.getSourceManager().embedFileContentsInModule(FE); + else + CI.getDiagnostics().Report(diag::err_modules_embed_file_not_found) << F; + } + // If we're being run from the command-line, the module build stack will not // have been filled in yet, so complete it now in order to allow us to detect // module cycles. |