LCOV - code coverage report
Current view: top level - build-llvm/tools/clang/include/clang/Parse - AttrSubMatchRulesParserStringSwitches.inc (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 46 49 93.9 %
Date: 2018-10-20 13:21:21 Functions: 7 7 100.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.13