1 | std::optional<attr::SubjectMatchRule> defaultIsAttributeSubjectMatchSubRuleFor(StringRef, bool) { |
2 | return std::nullopt; |
3 | } |
4 | |
5 | std::optional<attr::SubjectMatchRule> isAttributeSubjectMatchSubRuleFor_function(StringRef Name, bool IsUnless) { |
6 | if (IsUnless) |
7 | return llvm::StringSwitch<std::optional<attr::SubjectMatchRule>>(Name). |
8 | Default(Value: std::nullopt); |
9 | return llvm::StringSwitch<std::optional<attr::SubjectMatchRule>>(Name). |
10 | Case(S: "is_member" , Value: attr::SubjectMatchRule_function_is_member). |
11 | Default(Value: std::nullopt); |
12 | } |
13 | |
14 | std::optional<attr::SubjectMatchRule> isAttributeSubjectMatchSubRuleFor_objc_method(StringRef Name, bool IsUnless) { |
15 | if (IsUnless) |
16 | return llvm::StringSwitch<std::optional<attr::SubjectMatchRule>>(Name). |
17 | Default(Value: std::nullopt); |
18 | return llvm::StringSwitch<std::optional<attr::SubjectMatchRule>>(Name). |
19 | Case(S: "is_instance" , Value: attr::SubjectMatchRule_objc_method_is_instance). |
20 | Default(Value: std::nullopt); |
21 | } |
22 | |
23 | std::optional<attr::SubjectMatchRule> isAttributeSubjectMatchSubRuleFor_record(StringRef Name, bool IsUnless) { |
24 | if (IsUnless) |
25 | return llvm::StringSwitch<std::optional<attr::SubjectMatchRule>>(Name). |
26 | Case(S: "is_union" , Value: attr::SubjectMatchRule_record_not_is_union). |
27 | Default(Value: std::nullopt); |
28 | return llvm::StringSwitch<std::optional<attr::SubjectMatchRule>>(Name). |
29 | Default(Value: std::nullopt); |
30 | } |
31 | |
32 | std::optional<attr::SubjectMatchRule> isAttributeSubjectMatchSubRuleFor_hasType(StringRef Name, bool IsUnless) { |
33 | if (IsUnless) |
34 | return llvm::StringSwitch<std::optional<attr::SubjectMatchRule>>(Name). |
35 | Default(Value: std::nullopt); |
36 | return llvm::StringSwitch<std::optional<attr::SubjectMatchRule>>(Name). |
37 | Case(S: "functionType" , Value: attr::SubjectMatchRule_hasType_functionType). |
38 | Default(Value: std::nullopt); |
39 | } |
40 | |
41 | std::optional<attr::SubjectMatchRule> isAttributeSubjectMatchSubRuleFor_variable(StringRef Name, bool IsUnless) { |
42 | if (IsUnless) |
43 | return llvm::StringSwitch<std::optional<attr::SubjectMatchRule>>(Name). |
44 | Case(S: "is_parameter" , Value: attr::SubjectMatchRule_variable_not_is_parameter). |
45 | Default(Value: std::nullopt); |
46 | return llvm::StringSwitch<std::optional<attr::SubjectMatchRule>>(Name). |
47 | Case(S: "is_thread_local" , Value: attr::SubjectMatchRule_variable_is_thread_local). |
48 | Case(S: "is_global" , Value: attr::SubjectMatchRule_variable_is_global). |
49 | Case(S: "is_local" , Value: attr::SubjectMatchRule_variable_is_local). |
50 | Case(S: "is_parameter" , Value: attr::SubjectMatchRule_variable_is_parameter). |
51 | Default(Value: std::nullopt); |
52 | } |
53 | |
54 | std::pair<std::optional<attr::SubjectMatchRule>, std::optional<attr::SubjectMatchRule> (*)(StringRef, bool)> isAttributeSubjectMatchRule(StringRef Name) { |
55 | return llvm::StringSwitch<std::pair<std::optional<attr::SubjectMatchRule>, std::optional<attr::SubjectMatchRule> (*) (StringRef, bool)>>(Name). |
56 | Case(S: "block" , Value: std::make_pair(x: attr::SubjectMatchRule_block, y&: defaultIsAttributeSubjectMatchSubRuleFor)). |
57 | Case(S: "enum" , Value: std::make_pair(x: attr::SubjectMatchRule_enum, y&: defaultIsAttributeSubjectMatchSubRuleFor)). |
58 | Case(S: "enum_constant" , Value: std::make_pair(x: attr::SubjectMatchRule_enum_constant, y&: defaultIsAttributeSubjectMatchSubRuleFor)). |
59 | Case(S: "field" , Value: std::make_pair(x: attr::SubjectMatchRule_field, y&: defaultIsAttributeSubjectMatchSubRuleFor)). |
60 | Case(S: "function" , Value: std::make_pair(x: attr::SubjectMatchRule_function, y&: isAttributeSubjectMatchSubRuleFor_function)). |
61 | Case(S: "namespace" , Value: std::make_pair(x: attr::SubjectMatchRule_namespace, y&: defaultIsAttributeSubjectMatchSubRuleFor)). |
62 | Case(S: "objc_category" , Value: std::make_pair(x: attr::SubjectMatchRule_objc_category, y&: defaultIsAttributeSubjectMatchSubRuleFor)). |
63 | Case(S: "objc_implementation" , Value: std::make_pair(x: attr::SubjectMatchRule_objc_implementation, y&: defaultIsAttributeSubjectMatchSubRuleFor)). |
64 | Case(S: "objc_interface" , Value: std::make_pair(x: attr::SubjectMatchRule_objc_interface, y&: defaultIsAttributeSubjectMatchSubRuleFor)). |
65 | Case(S: "objc_method" , Value: std::make_pair(x: attr::SubjectMatchRule_objc_method, y&: isAttributeSubjectMatchSubRuleFor_objc_method)). |
66 | Case(S: "objc_property" , Value: std::make_pair(x: attr::SubjectMatchRule_objc_property, y&: defaultIsAttributeSubjectMatchSubRuleFor)). |
67 | Case(S: "objc_protocol" , Value: std::make_pair(x: attr::SubjectMatchRule_objc_protocol, y&: defaultIsAttributeSubjectMatchSubRuleFor)). |
68 | Case(S: "record" , Value: std::make_pair(x: attr::SubjectMatchRule_record, y&: isAttributeSubjectMatchSubRuleFor_record)). |
69 | Case(S: "hasType" , Value: std::make_pair(x: attr::SubjectMatchRule_hasType_abstract, y&: isAttributeSubjectMatchSubRuleFor_hasType)). |
70 | Case(S: "type_alias" , Value: std::make_pair(x: attr::SubjectMatchRule_type_alias, y&: defaultIsAttributeSubjectMatchSubRuleFor)). |
71 | Case(S: "variable" , Value: std::make_pair(x: attr::SubjectMatchRule_variable, y&: isAttributeSubjectMatchSubRuleFor_variable)). |
72 | Default(Value: std::make_pair(x: std::nullopt, y&: defaultIsAttributeSubjectMatchSubRuleFor)); |
73 | } |
74 | |
75 | const char *validAttributeSubjectMatchSubRules(attr::SubjectMatchRule Rule) { |
76 | switch (Rule) { |
77 | case attr::SubjectMatchRule_function: |
78 | return "'is_member'" ; |
79 | case attr::SubjectMatchRule_objc_method: |
80 | return "'is_instance'" ; |
81 | case attr::SubjectMatchRule_record: |
82 | return "'unless(is_union)'" ; |
83 | case attr::SubjectMatchRule_hasType_abstract: |
84 | return "'functionType'" ; |
85 | case attr::SubjectMatchRule_variable: |
86 | return "'is_thread_local', 'is_global', 'is_local', 'is_parameter', 'unless(is_parameter)'" ; |
87 | default: return nullptr; |
88 | } |
89 | } |
90 | |
91 | |