1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

[clang][cli] Accept strings instead of options in ImpliedByAnyOf

To be able to refer to constant keypaths (e.g. `defvar cplusplus = LangOpts<"CPlusPlus">`) inside `ImpliedByAnyOf`, let's accept strings instead of `Option` instances.

This somewhat weakens the guarantees that we're referring to an existing (option) record, but we can still use the option.KeyPath syntax to simulate this.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D95344
This commit is contained in:
Jan Svoboda 2021-01-26 09:21:55 +01:00
parent 055e4097e3
commit 8d411fdc2d
2 changed files with 6 additions and 6 deletions

View File

@ -154,9 +154,9 @@ class KeyPathAndMacro<string key_path_prefix, string key_path_base,
def EmptyKPM : KeyPathAndMacro<"", "">; def EmptyKPM : KeyPathAndMacro<"", "">;
class ImpliedByAnyOf<list<Option> options, code value = "true"> { class ImpliedByAnyOf<list<string> key_paths, code value = "true"> {
code ImpliedCheck = !foldl("false", options, accumulator, option, code ImpliedCheck = !foldl("false", key_paths, accumulator, key_path,
!strconcat(accumulator, " || ", option.KeyPath)); !strconcat(accumulator, " || ", key_path));
code ImpliedValue = value; code ImpliedValue = value;
} }

View File

@ -51,10 +51,10 @@ def marshalled_flag_d : Flag<["-"], "marshalled-flag-d">,
MarshallingInfoFlag<XOpts<"MarshalledFlagD">>; MarshallingInfoFlag<XOpts<"MarshalledFlagD">>;
def marshalled_flag_c : Flag<["-"], "marshalled-flag-c">, def marshalled_flag_c : Flag<["-"], "marshalled-flag-c">,
MarshallingInfoFlag<XOpts<"MarshalledFlagC">>, MarshallingInfoFlag<XOpts<"MarshalledFlagC">>,
ImpliedByAnyOf<[marshalled_flag_d], "true">; ImpliedByAnyOf<[marshalled_flag_d.KeyPath], "true">;
def marshalled_flag_b : Flag<["-"], "marshalled-flag-b">, def marshalled_flag_b : Flag<["-"], "marshalled-flag-b">,
MarshallingInfoFlag<XOpts<"MarshalledFlagB">>, MarshallingInfoFlag<XOpts<"MarshalledFlagB">>,
ImpliedByAnyOf<[marshalled_flag_d], "true">; ImpliedByAnyOf<[marshalled_flag_d.KeyPath], "true">;
def marshalled_flag_a : Flag<["-"], "marshalled-flag-a">, def marshalled_flag_a : Flag<["-"], "marshalled-flag-a">,
MarshallingInfoFlag<XOpts<"MarshalledFlagA">>, MarshallingInfoFlag<XOpts<"MarshalledFlagA">>,
ImpliedByAnyOf<[marshalled_flag_c, marshalled_flag_b]>; ImpliedByAnyOf<[marshalled_flag_c.KeyPath, marshalled_flag_b.KeyPath]>;