The fourth field in the property struct is the default unsigned or enum value for all types, except for Array and Dictionary types. For those, it is the element type. During the tablegen conversion, this was incorrectly translated to DefaultValueUnsigned with a value corresponding to the OptionValue: enum type. So for OptionValue::eTypeString this became DefaultUnsignedValue<16>. This patch extends the tablegen backend to understand ElementType to express this as ElementType<"String">. Differential revision: https://reviews.llvm.org/D76535
58 lines
1.3 KiB
TableGen
58 lines
1.3 KiB
TableGen
// Base class for all options.
|
|
class Property<string name, string type> {
|
|
string Name = name;
|
|
string Type = type;
|
|
string Definition;
|
|
}
|
|
|
|
// Sets the description for the property that should be displayed to the user.
|
|
class Desc<string description> {
|
|
string Description = description;
|
|
}
|
|
|
|
// Marks the property as global.
|
|
class Global {
|
|
bit Global = 1;
|
|
}
|
|
|
|
class DefaultTrue {
|
|
int DefaultUnsignedValue = 1;
|
|
bit HasDefaultUnsignedValue = 1;
|
|
bit HasDefaultBooleanValue = 1;
|
|
}
|
|
|
|
class DefaultFalse {
|
|
int DefaultUnsignedValue = 0;
|
|
bit HasDefaultUnsignedValue = 1;
|
|
bit HasDefaultBooleanValue = 1;
|
|
}
|
|
|
|
// Gives the property a default string value.
|
|
class DefaultStringValue<string value> {
|
|
string DefaultStringValue = value;
|
|
bit HasDefaultStringValue = 1;
|
|
}
|
|
|
|
// Gives the property a default enum value.
|
|
class DefaultEnumValue<string value> {
|
|
string DefaultEnumValue = value;
|
|
bit HasDefaultEnumValue = 1;
|
|
}
|
|
|
|
// Gives the property a default string value.
|
|
class DefaultUnsignedValue<int value> {
|
|
int DefaultUnsignedValue = value;
|
|
bit HasDefaultUnsignedValue = 1;
|
|
}
|
|
|
|
// Gives the property enum values.
|
|
class EnumValues<string enum> {
|
|
string EnumValues = enum;
|
|
}
|
|
|
|
// Determines the element type for arrays and dictionaries.
|
|
class ElementType<string value> {
|
|
string ElementType = value;
|
|
bit HasElementType = 1;
|
|
}
|