[llvm-branch-commits] [clang] e20d466 - [clang][cli] Port more options to new parsing system
Jan Svoboda via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Jan 20 01:53:20 PST 2021
Author: Jan Svoboda
Date: 2021-01-20T10:48:22+01:00
New Revision: e20d46628a31a984074f2e1029e67734d5c2ab0d
URL: https://github.com/llvm/llvm-project/commit/e20d46628a31a984074f2e1029e67734d5c2ab0d
DIFF: https://github.com/llvm/llvm-project/commit/e20d46628a31a984074f2e1029e67734d5c2ab0d.diff
LOG: [clang][cli] Port more options to new parsing system
This patch adds marshalling information to more options.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D94957
Added:
Modified:
clang/include/clang/Driver/Options.td
clang/lib/Frontend/CompilerInvocation.cpp
Removed:
################################################################################
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 8150b24e337b..500022c2c99b 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -3071,10 +3071,10 @@ def mwavefrontsize64 : Flag<["-"], "mwavefrontsize64">, Group<m_Group>,
def mno_wavefrontsize64 : Flag<["-"], "mno-wavefrontsize64">, Group<m_Group>,
HelpText<"Specify wavefront size 32 mode (AMDGPU only)">;
-def munsafe_fp_atomics : Flag<["-"], "munsafe-fp-atomics">, Group<m_Group>,
- HelpText<"Enable unsafe floating point atomic instructions (AMDGPU only)">,
- Flags<[CC1Option]>;
-def mno_unsafe_fp_atomics : Flag<["-"], "mno-unsafe-fp-atomics">, Group<m_Group>;
+defm unsafe_fp_atomics : BoolCC1Option<"unsafe-fp-atomics",
+ TargetOpts<"AllowAMDGPUUnsafeFPAtomics">, DefaultsToFalse,
+ ChangedBy<PosFlag, [], "Enable unsafe floating point atomic instructions (AMDGPU only)">,
+ ResetBy<NegFlag>, BothFlags<[]>, "m">, Group<m_Group>;
def faltivec : Flag<["-"], "faltivec">, Group<f_Group>, Flags<[NoXarchOption]>;
def fno_altivec : Flag<["-"], "fno-altivec">, Group<f_Group>, Flags<[NoXarchOption]>;
@@ -4378,7 +4378,10 @@ def analyzer_checker_option_help_developer : Flag<["-"], "analyzer-checker-optio
MarshallingInfoFlag<AnalyzerOpts<"ShowCheckerOptionDeveloperList">>;
def analyzer_config_compatibility_mode : Separate<["-"], "analyzer-config-compatibility-mode">,
- HelpText<"Don't emit errors on invalid analyzer-config inputs">;
+ HelpText<"Don't emit errors on invalid analyzer-config inputs">,
+ Values<"true,false">, NormalizedValues<[[{false}], [{true}]]>,
+ MarshallingInfoString<AnalyzerOpts<"ShouldEmitErrorsOnInvalidConfigValue">, [{true}]>,
+ AutoNormalizeEnum;
def analyzer_config_compatibility_mode_EQ : Joined<["-"], "analyzer-config-compatibility-mode=">,
Alias<analyzer_config_compatibility_mode>;
@@ -4842,7 +4845,8 @@ def plugin_arg : JoinedAndSeparate<["-"], "plugin-arg-">,
MetaVarName<"<name> <arg>">,
HelpText<"Pass <arg> to plugin <name>">;
def add_plugin : Separate<["-"], "add-plugin">, MetaVarName<"<name>">,
- HelpText<"Use the named plugin action in addition to the default action">;
+ HelpText<"Use the named plugin action in addition to the default action">,
+ MarshallingInfoStringVector<FrontendOpts<"AddPluginActions">>;
def ast_dump_filter : Separate<["-"], "ast-dump-filter">,
MetaVarName<"<dump_filter>">,
HelpText<"Use with -ast-dump or -ast-print to dump/print only AST declaration"
@@ -5118,10 +5122,13 @@ def fhalf_no_semantic_interposition : Flag<["-"], "fhalf-no-semantic-interpositi
def fno_validate_pch : Flag<["-"], "fno-validate-pch">,
HelpText<"Disable validation of precompiled headers">,
MarshallingInfoFlag<PreprocessorOpts<"DisablePCHValidation">>;
-def fallow_pch_with_errors : Flag<["-"], "fallow-pch-with-compiler-errors">,
- HelpText<"Accept a PCH file that was created with compiler errors">;
def fallow_pcm_with_errors : Flag<["-"], "fallow-pcm-with-compiler-errors">,
- HelpText<"Accept a PCM file that was created with compiler errors">;
+ HelpText<"Accept a PCM file that was created with compiler errors">,
+ MarshallingInfoFlag<FrontendOpts<"AllowPCMWithCompilerErrors">>;
+def fallow_pch_with_errors : Flag<["-"], "fallow-pch-with-compiler-errors">,
+ HelpText<"Accept a PCH file that was created with compiler errors">,
+ MarshallingInfoFlag<PreprocessorOpts<"AllowPCHWithCompilerErrors">>,
+ ImpliedByAnyOf<[fallow_pcm_with_errors]>;
def dump_deserialized_pch_decls : Flag<["-"], "dump-deserialized-decls">,
HelpText<"Dump declarations that are deserialized from PCH, for testing">,
MarshallingInfoFlag<PreprocessorOpts<"DumpDeserializedPCHDecls">>;
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index dac0dc6921a5..24b8fd19dd50 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -634,13 +634,6 @@ static bool ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args,
}
}
- Opts.ShouldEmitErrorsOnInvalidConfigValue =
- /* negated */!llvm::StringSwitch<bool>(
- Args.getLastArgValue(OPT_analyzer_config_compatibility_mode))
- .Case("true", true)
- .Case("false", false)
- .Default(false);
-
Opts.CheckersAndPackages.clear();
for (const Arg *A :
Args.filtered(OPT_analyzer_checker, OPT_analyzer_disable_checker)) {
@@ -828,10 +821,6 @@ static void parseAnalyzerConfigs(AnalyzerOptions &AnOpts,
<< "a filename";
}
-static void ParseCommentArgs(CommentOptions &Opts, ArgList &Args) {
- Opts.ParseAllComments = Args.hasArg(OPT_fparse_all_comments);
-}
-
/// Create a new Regex instance out of the string value in \p RpassArg.
/// It returns a pointer to the newly generated Regex instance.
static std::shared_ptr<llvm::Regex>
@@ -1645,7 +1634,6 @@ static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args,
Opts.ProgramAction = frontend::PluginAction;
Opts.ActionName = A->getValue();
}
- Opts.AddPluginActions = Args.getAllArgValues(OPT_add_plugin);
for (const auto *AA : Args.filtered(OPT_plugin_arg))
Opts.PluginArgs[AA->getValue(0)].emplace_back(AA->getValue(1));
@@ -1686,7 +1674,6 @@ static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args,
if (Val.find('=') == StringRef::npos)
Opts.ModuleFiles.push_back(std::string(Val));
}
- Opts.AllowPCMWithCompilerErrors = Args.hasArg(OPT_fallow_pcm_with_errors);
if (Opts.ProgramAction != frontend::GenerateModule && Opts.IsSystemModule)
Diags.Report(diag::err_drv_argument_only_allowed_with) << "-fsystem-module"
@@ -2845,8 +2832,6 @@ static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args,
frontend::ActionKind Action) {
Opts.PCHWithHdrStop = Args.hasArg(OPT_pch_through_hdrstop_create) ||
Args.hasArg(OPT_pch_through_hdrstop_use);
- Opts.AllowPCHWithCompilerErrors =
- Args.hasArg(OPT_fallow_pch_with_errors, OPT_fallow_pcm_with_errors);
for (const auto *A : Args.filtered(OPT_error_on_deserialized_pch_decl))
Opts.DeserializedPCHDeclsToErrorOn.insert(A->getValue());
@@ -2930,9 +2915,6 @@ static void ParsePreprocessorOutputArgs(PreprocessorOutputOptions &Opts,
static void ParseTargetArgs(TargetOptions &Opts, ArgList &Args,
DiagnosticsEngine &Diags) {
- Opts.AllowAMDGPUUnsafeFPAtomics =
- Args.hasFlag(options::OPT_munsafe_fp_atomics,
- options::OPT_mno_unsafe_fp_atomics, false);
if (Arg *A = Args.getLastArg(options::OPT_target_sdk_version_EQ)) {
llvm::VersionTuple Version;
if (Version.tryParse(A->getValue()))
@@ -2987,7 +2969,6 @@ bool CompilerInvocation::CreateFromArgs(CompilerInvocation &Res,
}
Success &= ParseDiagnosticArgs(Res.getDiagnosticOpts(), Args, &Diags,
/*DefaultDiagColor=*/false);
- ParseCommentArgs(LangOpts.CommentOpts, Args);
// FIXME: We shouldn't have to pass the DashX option around here
InputKind DashX = ParseFrontendArgs(Res.getFrontendOpts(), Args, Diags,
LangOpts.IsHeaderFile);
More information about the llvm-branch-commits
mailing list