[clang] 75d6363 - [clang][cli] NFC: Move parseSimpleArgs
Jan Svoboda via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 7 05:15:31 PST 2021
Author: Jan Svoboda
Date: 2021-01-07T14:15:08+01:00
New Revision: 75d63630ebb197c338801d6b100ae2e06800c4ce
URL: https://github.com/llvm/llvm-project/commit/75d63630ebb197c338801d6b100ae2e06800c4ce
DIFF: https://github.com/llvm/llvm-project/commit/75d63630ebb197c338801d6b100ae2e06800c4ce.diff
LOG: [clang][cli] NFC: Move parseSimpleArgs
This patch moves `parseSimpleArgs` closer to `ParseDiagnosticArgs` so that sharing the parsing macro between them can be done more locally in a future patch.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D94172
Added:
Modified:
clang/lib/Frontend/CompilerInvocation.cpp
Removed:
################################################################################
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 7f3e39ede281..8b641aabd1af 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -1399,6 +1399,32 @@ static bool checkVerifyPrefixes(const std::vector<std::string> &VerifyPrefixes,
return Success;
}
+bool CompilerInvocation::parseSimpleArgs(const ArgList &Args,
+ DiagnosticsEngine &Diags) {
+ bool Success = true;
+
+#define OPTION_WITH_MARSHALLING( \
+ PREFIX_TYPE, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM, \
+ HELPTEXT, METAVAR, VALUES, SPELLING, SHOULD_PARSE, ALWAYS_EMIT, KEYPATH, \
+ DEFAULT_VALUE, IMPLIED_CHECK, IMPLIED_VALUE, NORMALIZER, DENORMALIZER, \
+ MERGER, EXTRACTOR, TABLE_INDEX) \
+ if ((FLAGS)&options::CC1Option) { \
+ this->KEYPATH = MERGER(this->KEYPATH, DEFAULT_VALUE); \
+ if (IMPLIED_CHECK) \
+ this->KEYPATH = MERGER(this->KEYPATH, IMPLIED_VALUE); \
+ if (SHOULD_PARSE) \
+ if (auto MaybeValue = \
+ NORMALIZER(OPT_##ID, TABLE_INDEX, Args, Diags, Success)) \
+ this->KEYPATH = MERGER( \
+ this->KEYPATH, static_cast<decltype(this->KEYPATH)>(*MaybeValue)); \
+ }
+
+#include "clang/Driver/Options.inc"
+#undef OPTION_WITH_MARSHALLING
+
+ return Success;
+}
+
bool clang::ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args,
DiagnosticsEngine *Diags,
bool DefaultDiagColor) {
@@ -2971,32 +2997,6 @@ static void ParseTargetArgs(TargetOptions &Opts, ArgList &Args,
}
}
-bool CompilerInvocation::parseSimpleArgs(const ArgList &Args,
- DiagnosticsEngine &Diags) {
- bool Success = true;
-
-#define OPTION_WITH_MARSHALLING( \
- PREFIX_TYPE, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM, \
- HELPTEXT, METAVAR, VALUES, SPELLING, SHOULD_PARSE, ALWAYS_EMIT, KEYPATH, \
- DEFAULT_VALUE, IMPLIED_CHECK, IMPLIED_VALUE, NORMALIZER, DENORMALIZER, \
- MERGER, EXTRACTOR, TABLE_INDEX) \
- if ((FLAGS)&options::CC1Option) { \
- this->KEYPATH = MERGER(this->KEYPATH, DEFAULT_VALUE); \
- if (IMPLIED_CHECK) \
- this->KEYPATH = MERGER(this->KEYPATH, IMPLIED_VALUE); \
- if (SHOULD_PARSE) \
- if (auto MaybeValue = \
- NORMALIZER(OPT_##ID, TABLE_INDEX, Args, Diags, Success)) \
- this->KEYPATH = MERGER( \
- this->KEYPATH, static_cast<decltype(this->KEYPATH)>(*MaybeValue)); \
- }
-
-#include "clang/Driver/Options.inc"
-#undef OPTION_WITH_MARSHALLING
-
- return Success;
-}
-
bool CompilerInvocation::CreateFromArgs(CompilerInvocation &Res,
ArrayRef<const char *> CommandLineArgs,
DiagnosticsEngine &Diags,
More information about the cfe-commits
mailing list