1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +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<"", "">;
class ImpliedByAnyOf<list<Option> options, code value = "true"> {
code ImpliedCheck = !foldl("false", options, accumulator, option,
!strconcat(accumulator, " || ", option.KeyPath));
class ImpliedByAnyOf<list<string> key_paths, code value = "true"> {
code ImpliedCheck = !foldl("false", key_paths, accumulator, key_path,
!strconcat(accumulator, " || ", key_path));
code ImpliedValue = value;
}

View File

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