1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

[clang][cli] Remove NormalizerRetTy and use the decltype of the KeyPath instead

Depends on D83315

Reviewed By: Bigcheese

Original patch by Daniel Grumberg.

Differential Revision: https://reviews.llvm.org/D83406
This commit is contained in:
Jan Svoboda 2020-11-16 15:59:35 +01:00
parent 548ee2937f
commit 896eefbaeb
3 changed files with 7 additions and 14 deletions

View File

@ -156,20 +156,17 @@ class MarshallingInfo<code keypath, code defaultvalue> {
code DefaultValue = defaultvalue;
}
class MarshallingInfoString<code keypath, code defaultvalue, code normalizerretty>
: MarshallingInfo<keypath, defaultvalue> {
code NormalizerRetTy = normalizerretty;
}
class MarshallingInfoString<code keypath, code defaultvalue>
: MarshallingInfo<keypath, defaultvalue> {}
class MarshallingInfoFlag<code keypath, DefaultAnyOf defaults = DefaultAnyOf<[]>, code ty="unsigned">
class MarshallingInfoFlag<code keypath, DefaultAnyOf defaults = DefaultAnyOf<[]>>
: MarshallingInfo<keypath, defaults.DefaultValue> {
code NormalizerRetTy = ty;
code Normalizer = "normalizeSimpleFlag";
code Denormalizer = "denormalizeSimpleFlag";
}
class MarshallingInfoBitfieldFlag<code keypath, code value>
: MarshallingInfoFlag<keypath, DefaultAnyOf<[], "0u", " | ">, "unsigned"> {
: MarshallingInfoFlag<keypath, DefaultAnyOf<[], "0u", " | ">> {
code Normalizer = "(normalizeFlagToValue<unsigned, "#value#">)";
code ValueMerger = "mergeMaskValue";
code ValueExtractor = "(extractMaskValue<unsigned, decltype("#value#"), "#value#">)";

View File

@ -18,7 +18,7 @@ static const OptionWithMarshallingInfo MarshallingTable[] = {
#define OPTION_WITH_MARSHALLING( \
PREFIX_TYPE, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM, \
HELPTEXT, METAVAR, VALUES, SPELLING, ALWAYS_EMIT, KEYPATH, DEFAULT_VALUE, \
TYPE, NORMALIZER, DENORMALIZER, MERGER, EXTRACTOR, TABLE_INDEX) \
NORMALIZER, DENORMALIZER, MERGER, EXTRACTOR, TABLE_INDEX) \
{NAME, #KEYPATH, #DEFAULT_VALUE},
#include "Opts.inc"
#undef OPTION_WITH_MARSHALLING

View File

@ -71,7 +71,6 @@ public:
StringRef KeyPath;
StringRef DefaultValue;
StringRef NormalizedValuesScope;
StringRef NormalizerRetTy;
StringRef Normalizer;
StringRef Denormalizer;
StringRef ValueMerger;
@ -114,8 +113,6 @@ struct SimpleEnumValueTable {
OS << ", ";
emitScopedNormalizedValue(OS, DefaultValue);
OS << ", ";
OS << NormalizerRetTy;
OS << ", ";
OS << Normalizer;
OS << ", ";
OS << Denormalizer;
@ -174,9 +171,9 @@ public:
static MarshallingInfo::Ptr createMarshallingInfo(const Record &R) {
assert(!isa<UnsetInit>(R.getValueInit("KeyPath")) &&
!isa<UnsetInit>(R.getValueInit("DefaultValue")) &&
!isa<UnsetInit>(R.getValueInit("NormalizerRetTy")) &&
!isa<UnsetInit>(R.getValueInit("ValueMerger")) &&
"MarshallingInfo must have a type");
"MarshallingInfo must have a provide a keypath, default value and a "
"value merger");
MarshallingInfo::Ptr Ret;
StringRef KindString = R.getValueAsString("MarshallingInfoKind");
@ -191,7 +188,6 @@ static MarshallingInfo::Ptr createMarshallingInfo(const Record &R) {
Ret->KeyPath = R.getValueAsString("KeyPath");
Ret->DefaultValue = R.getValueAsString("DefaultValue");
Ret->NormalizedValuesScope = R.getValueAsString("NormalizedValuesScope");
Ret->NormalizerRetTy = R.getValueAsString("NormalizerRetTy");
Ret->Normalizer = R.getValueAsString("Normalizer");
Ret->Denormalizer = R.getValueAsString("Denormalizer");