diff options
author | Michael Spencer <bigcheesegs@gmail.com> | 2020-02-28 17:31:52 -0800 |
---|---|---|
committer | Michael Spencer <bigcheesegs@gmail.com> | 2020-03-03 14:14:24 -0800 |
commit | 27a3ecee45584f6e78b46741111ebbbe5554faad (patch) | |
tree | 4851a5c2f35bb5990e2b0cc5e44373625bb39805 /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | aa85b437a970a12b74a8793cbd98dbb2f95afb6d (diff) | |
download | llvm-27a3ecee45584f6e78b46741111ebbbe5554faad.zip llvm-27a3ecee45584f6e78b46741111ebbbe5554faad.tar.gz llvm-27a3ecee45584f6e78b46741111ebbbe5554faad.tar.bz2 |
[clang][Modules] Add -fsystem-module flag
The -fsystem-module flag is used when explicitly building a module. It
forces the module to be treated as a system module. This is used when
converting an implicit build to an explicit build to match the
systemness the implicit build would have had for a given module.
Differential Revision: https://reviews.llvm.org/D75395
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 8638d43..48c65ad 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1905,6 +1905,11 @@ static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args, Opts.ModulesEmbedAllFiles = Args.hasArg(OPT_fmodules_embed_all_files); Opts.IncludeTimestamps = !Args.hasArg(OPT_fno_pch_timestamp); Opts.UseTemporary = !Args.hasArg(OPT_fno_temp_file); + Opts.IsSystemModule = Args.hasArg(OPT_fsystem_module); + + if (Opts.ProgramAction != frontend::GenerateModule && Opts.IsSystemModule) + Diags.Report(diag::err_drv_argument_only_allowed_with) << "-fsystem-module" + << "-emit-module"; Opts.CodeCompleteOpts.IncludeMacros = Args.hasArg(OPT_code_completion_macros); @@ -2061,12 +2066,16 @@ static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args, DashX = IK; } + bool IsSystem = false; + // The -emit-module action implicitly takes a module map. if (Opts.ProgramAction == frontend::GenerateModule && - IK.getFormat() == InputKind::Source) + IK.getFormat() == InputKind::Source) { IK = IK.withFormat(InputKind::ModuleMap); + IsSystem = Opts.IsSystemModule; + } - Opts.Inputs.emplace_back(std::move(Inputs[i]), IK); + Opts.Inputs.emplace_back(std::move(Inputs[i]), IK, IsSystem); } return DashX; |