diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-11-24 04:22:21 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-11-24 04:22:21 +0000 |
commit | 8100fed41b3e0501eea8d18525a17d76902283dc (patch) | |
tree | fc825e43210465ea403922f9e6ff5b69d1206d6d /include/clang | |
parent | e475fd3abeab4721255fa8b410a000f53915f040 (diff) |
[modules] Add -cc1 flag -fmodules-embed-all-files.
This flag causes all files that were read by the compilation to be embedded
into a produced module file. This is useful for distributed build systems that
use an include scanning system to determine which files are "needed" by a
compilation, and only provide those files to remote compilation workers. Since
using a module can require any file that is part of that module (or anything it
transitively includes), files that are not found by an include scanner can be
required in a regular build using explicit modules. With this flag, only files
that are actually referenced by transitively-#included files are required to be
present on the build machine.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253950 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang')
-rw-r--r-- | include/clang/Basic/SourceManager.h | 11 | ||||
-rw-r--r-- | include/clang/Driver/CC1Options.td | 3 | ||||
-rw-r--r-- | include/clang/Frontend/FrontendOptions.h | 4 |
3 files changed, 17 insertions, 1 deletions
diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h index ae5f2bde37..5006b00929 100644 --- a/include/clang/Basic/SourceManager.h +++ b/include/clang/Basic/SourceManager.h @@ -566,6 +566,11 @@ class SourceManager : public RefCountedBase<SourceManager> { /// (likely to change while trying to use them). Defaults to false. bool UserFilesAreVolatile; + /// \brief True if all files read during this compilation should be treated + /// as transient (may not be present in later compilations using a module + /// file created from this compilation). Defaults to false. + bool FilesAreTransient; + struct OverriddenFilesInfoTy { /// \brief Files that have been overridden with the contents from another /// file. @@ -864,6 +869,12 @@ public: /// the module is used). void embedFileContentsInModule(const FileEntry *SourceFile); + /// \brief Request that all files that are read during this compilation be + /// written to any created module file. + void setEmbedAllFileContentsInModule(bool Embed) { + FilesAreTransient = Embed; + } + //===--------------------------------------------------------------------===// // FileID manipulation methods. //===--------------------------------------------------------------------===// diff --git a/include/clang/Driver/CC1Options.td b/include/clang/Driver/CC1Options.td index 56caea85b1..d510e19ea9 100644 --- a/include/clang/Driver/CC1Options.td +++ b/include/clang/Driver/CC1Options.td @@ -381,6 +381,9 @@ def fmodules_embed_file_EQ : Joined<["-"], "fmodules-embed-file=">, MetaVarName<"<file>">, HelpText<"Embed the contents of the specified file into the module file " "being compiled.">; +def fmodules_embed_all_files : Joined<["-"], "fmodules-embed-all-files">, + HelpText<"Embed the contents of all files read by this compilation into " + "the produced module file.">; def fmodules_local_submodule_visibility : Flag<["-"], "fmodules-local-submodule-visibility">, HelpText<"Enforce name visibility rules across submodules of the same " diff --git a/include/clang/Frontend/FrontendOptions.h b/include/clang/Frontend/FrontendOptions.h index 186e8cf3e7..c800a5148e 100644 --- a/include/clang/Frontend/FrontendOptions.h +++ b/include/clang/Frontend/FrontendOptions.h @@ -150,6 +150,8 @@ public: ///< dumps in AST dumps. unsigned BuildingImplicitModule : 1; ///< Whether we are performing an ///< implicit module build. + unsigned ModulesEmbedAllFiles : 1; ///< Whether we should embed all used + ///< files into the PCM file. CodeCompleteOptions CodeCompleteOpts; @@ -272,7 +274,7 @@ public: FixToTemporaries(false), ARCMTMigrateEmitARCErrors(false), SkipFunctionBodies(false), UseGlobalModuleIndex(true), GenerateGlobalModuleIndex(true), ASTDumpDecls(false), ASTDumpLookups(false), - BuildingImplicitModule(false), + BuildingImplicitModule(false), ModulesEmbedAllFiles(false), ARCMTAction(ARCMT_None), ObjCMTAction(ObjCMT_None), ProgramAction(frontend::ParseSyntaxOnly) {} |