Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
14 | pmbaty | 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(std::nullopt); |
||
9 | return llvm::StringSwitch<std::optional<attr::SubjectMatchRule>>(Name). |
||
10 | Case("is_member", attr::SubjectMatchRule_function_is_member). |
||
11 | Default(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(std::nullopt); |
||
18 | return llvm::StringSwitch<std::optional<attr::SubjectMatchRule>>(Name). |
||
19 | Case("is_instance", attr::SubjectMatchRule_objc_method_is_instance). |
||
20 | Default(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("is_union", attr::SubjectMatchRule_record_not_is_union). |
||
27 | Default(std::nullopt); |
||
28 | return llvm::StringSwitch<std::optional<attr::SubjectMatchRule>>(Name). |
||
29 | Default(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(std::nullopt); |
||
36 | return llvm::StringSwitch<std::optional<attr::SubjectMatchRule>>(Name). |
||
37 | Case("functionType", attr::SubjectMatchRule_hasType_functionType). |
||
38 | Default(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("is_parameter", attr::SubjectMatchRule_variable_not_is_parameter). |
||
45 | Default(std::nullopt); |
||
46 | return llvm::StringSwitch<std::optional<attr::SubjectMatchRule>>(Name). |
||
47 | Case("is_thread_local", attr::SubjectMatchRule_variable_is_thread_local). |
||
48 | Case("is_global", attr::SubjectMatchRule_variable_is_global). |
||
49 | Case("is_local", attr::SubjectMatchRule_variable_is_local). |
||
50 | Case("is_parameter", attr::SubjectMatchRule_variable_is_parameter). |
||
51 | Default(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("block", std::make_pair(attr::SubjectMatchRule_block, defaultIsAttributeSubjectMatchSubRuleFor)). |
||
57 | Case("enum", std::make_pair(attr::SubjectMatchRule_enum, defaultIsAttributeSubjectMatchSubRuleFor)). |
||
58 | Case("enum_constant", std::make_pair(attr::SubjectMatchRule_enum_constant, defaultIsAttributeSubjectMatchSubRuleFor)). |
||
59 | Case("field", std::make_pair(attr::SubjectMatchRule_field, defaultIsAttributeSubjectMatchSubRuleFor)). |
||
60 | Case("function", std::make_pair(attr::SubjectMatchRule_function, isAttributeSubjectMatchSubRuleFor_function)). |
||
61 | Case("namespace", std::make_pair(attr::SubjectMatchRule_namespace, defaultIsAttributeSubjectMatchSubRuleFor)). |
||
62 | Case("objc_category", std::make_pair(attr::SubjectMatchRule_objc_category, defaultIsAttributeSubjectMatchSubRuleFor)). |
||
63 | Case("objc_implementation", std::make_pair(attr::SubjectMatchRule_objc_implementation, defaultIsAttributeSubjectMatchSubRuleFor)). |
||
64 | Case("objc_interface", std::make_pair(attr::SubjectMatchRule_objc_interface, defaultIsAttributeSubjectMatchSubRuleFor)). |
||
65 | Case("objc_method", std::make_pair(attr::SubjectMatchRule_objc_method, isAttributeSubjectMatchSubRuleFor_objc_method)). |
||
66 | Case("objc_property", std::make_pair(attr::SubjectMatchRule_objc_property, defaultIsAttributeSubjectMatchSubRuleFor)). |
||
67 | Case("objc_protocol", std::make_pair(attr::SubjectMatchRule_objc_protocol, defaultIsAttributeSubjectMatchSubRuleFor)). |
||
68 | Case("record", std::make_pair(attr::SubjectMatchRule_record, isAttributeSubjectMatchSubRuleFor_record)). |
||
69 | Case("hasType", std::make_pair(attr::SubjectMatchRule_hasType_abstract, isAttributeSubjectMatchSubRuleFor_hasType)). |
||
70 | Case("type_alias", std::make_pair(attr::SubjectMatchRule_type_alias, defaultIsAttributeSubjectMatchSubRuleFor)). |
||
71 | Case("variable", std::make_pair(attr::SubjectMatchRule_variable, isAttributeSubjectMatchSubRuleFor_variable)). |
||
72 | Default(std::make_pair(std::nullopt, 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 |