mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
[clang][cli] Add flexible TableGen multiclass for boolean options
This introduces more flexible multiclass for declaring two flags controlling the same boolean keypath. Compared to existing Opt{In,Out}FFlag multiclasses, the new syntax makes it easier to read option declarations and reason about the keypath. This also makes specifying common properties of both flags possible. I'm open to suggestions on the class names. Not 100% sure the benefits are worth the added complexity. Depends on D92774. Reviewed By: dexonsmith Differential Revision: https://reviews.llvm.org/D92775
This commit is contained in:
parent
2bf0908f96
commit
fa6c9b63ca
@ -171,10 +171,12 @@ class MarshallingInfoBitfieldFlag<code keypath, code value>
|
||||
code ValueExtractor = "(extractMaskValue<unsigned, decltype("#value#"), "#value#">)";
|
||||
}
|
||||
|
||||
class MarshallingInfoBooleanFlag<code keypath, code defaultvalue, code neg_name, string neg_spelling>
|
||||
// Marshalling info for booleans. Applied to the flag setting keypath to false.
|
||||
class MarshallingInfoBooleanFlag<code keypath, code defaultvalue, code value, code name,
|
||||
code other_value, code other_name, string other_spelling>
|
||||
: MarshallingInfoFlag<keypath, defaultvalue> {
|
||||
code Normalizer = "makeBooleanFlagNormalizer(OPT_"#neg_name#")";
|
||||
code Denormalizer = "makeBooleanFlagDenormalizer(\""#neg_spelling#"\")";
|
||||
code Normalizer = "makeBooleanOptionNormalizer("#value#", "#other_value#", OPT_"#other_name#")";
|
||||
code Denormalizer = "makeBooleanOptionDenormalizer("#value#", \""#other_spelling#"\")";
|
||||
}
|
||||
|
||||
// Mixins for additional marshalling attributes.
|
||||
|
Loading…
Reference in New Issue
Block a user