[PATCH] D93702: [clang][cli] NFC: Make marshalling macros reusable
Duncan P. N. Exon Smith via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 22 23:18:33 PST 2020
dexonsmith added inline comments.
================
Comment at: clang/lib/Frontend/CompilerInvocation.cpp:3040
-#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) \
- 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)) \
- this->KEYPATH = MERGER( \
- this->KEYPATH, static_cast<decltype(this->KEYPATH)>(*MaybeValue)); \
- }
-
+#define OPTION_WITH_MARSHALLING PARSE_OPTION_WITH_MARSHALLING
#include "clang/Driver/Options.inc"
----------------
One concern I have with this change is that the macro is using local variable names; it really would be better to have the macro content local to the function(s) where the variables are defined.
Can you give more context about why this has to be called from another place? Maybe there's another way to solve the problem.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D93702/new/
https://reviews.llvm.org/D93702
More information about the cfe-commits
mailing list