[PATCH] D93702: [clang][cli] NFC: Make marshalling macros reusable
Jan Svoboda via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 6 06:19:42 PST 2021
jansvoboda11 updated this revision to Diff 314877.
jansvoboda11 added a comment.
Rebase
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D93702/new/
https://reviews.llvm.org/D93702
Files:
clang/lib/Frontend/CompilerInvocation.cpp
Index: clang/lib/Frontend/CompilerInvocation.cpp
===================================================================
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -1397,31 +1397,39 @@
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, ALWAYS_EMIT, KEYPATH, DEFAULT_VALUE, \
- IMPLIED_CHECK, IMPLIED_VALUE, NORMALIZER, DENORMALIZER, MERGER, EXTRACTOR, \
- TABLE_INDEX) \
+#define PARSE_OPTION_WITH_MARSHALLING( \
+ ARGS, DIAGS, SUCCESS, ID, FLAGS, PARAM, KEYPATH, DEFAULT_VALUE, \
+ IMPLIED_CHECK, IMPLIED_VALUE, NORMALIZER, MERGER, TABLE_INDEX) \
if ((FLAGS)&options::CC1Option) { \
this->KEYPATH = MERGER(this->KEYPATH, DEFAULT_VALUE); \
if (IMPLIED_CHECK) \
this->KEYPATH = MERGER(this->KEYPATH, IMPLIED_VALUE); \
if (auto MaybeValue = \
- NORMALIZER(OPT_##ID, TABLE_INDEX, Args, Diags, Success)) \
+ NORMALIZER(OPT_##ID, TABLE_INDEX, ARGS, DIAGS, SUCCESS)) \
this->KEYPATH = MERGER( \
this->KEYPATH, static_cast<decltype(this->KEYPATH)>(*MaybeValue)); \
}
+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, ALWAYS_EMIT, KEYPATH, DEFAULT_VALUE, \
+ IMPLIED_CHECK, IMPLIED_VALUE, NORMALIZER, DENORMALIZER, MERGER, EXTRACTOR, \
+ TABLE_INDEX) \
+ PARSE_OPTION_WITH_MARSHALLING( \
+ Args, Diags, Success, ID, FLAGS, PARAM, KEYPATH, DEFAULT_VALUE, \
+ IMPLIED_CHECK, IMPLIED_VALUE, NORMALIZER, MERGER, TABLE_INDEX)
#include "clang/Driver/Options.inc"
#undef OPTION_WITH_MARSHALLING
return Success;
}
+#undef PARSE_OPTION_WITH_MARSHALLING
+
bool clang::ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args,
DiagnosticsEngine &Diags,
bool DefaultDiagColor) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93702.314877.patch
Type: text/x-patch
Size: 2945 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210106/9d9d76be/attachment-0001.bin>
More information about the cfe-commits
mailing list