LCOV - code coverage report
Current view: top level - lib/BinaryFormat - Dwarf.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 149 240 62.1 %
Date: 2018-10-20 13:21:21 Functions: 33 50 66.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===-- llvm/BinaryFormat/Dwarf.cpp - Dwarf Framework ------------*- C++-*-===//
       2             : //
       3             : //                     The LLVM Compiler Infrastructure
       4             : //
       5             : // This file is distributed under the University of Illinois Open Source
       6             : // License. See LICENSE.TXT for details.
       7             : //
       8             : //===----------------------------------------------------------------------===//
       9             : //
      10             : // This file contains support for generic dwarf information.
      11             : //
      12             : //===----------------------------------------------------------------------===//
      13             : 
      14             : #include "llvm/BinaryFormat/Dwarf.h"
      15             : #include "llvm/ADT/StringSwitch.h"
      16             : #include "llvm/Support/ErrorHandling.h"
      17             : 
      18             : using namespace llvm;
      19             : using namespace dwarf;
      20             : 
      21       31808 : StringRef llvm::dwarf::TagString(unsigned Tag) {
      22       31808 :   switch (Tag) {
      23          19 :   default:
      24          19 :     return StringRef();
      25             : #define HANDLE_DW_TAG(ID, NAME, VERSION, VENDOR)                               \
      26             :   case DW_TAG_##NAME:                                                          \
      27             :     return "DW_TAG_" #NAME;
      28             : #include "llvm/BinaryFormat/Dwarf.def"
      29             :   }
      30             : }
      31             : 
      32        3929 : unsigned llvm::dwarf::getTag(StringRef TagString) {
      33        3929 :   return StringSwitch<unsigned>(TagString)
      34             : #define HANDLE_DW_TAG(ID, NAME, VERSION, VENDOR)                               \
      35             :   .Case("DW_TAG_" #NAME, DW_TAG_##NAME)
      36             : #include "llvm/BinaryFormat/Dwarf.def"
      37        3929 :       .Default(DW_TAG_invalid);
      38             : }
      39             : 
      40           0 : unsigned llvm::dwarf::TagVersion(dwarf::Tag Tag) {
      41             :   switch (Tag) {
      42             :   default:
      43             :     return 0;
      44             : #define HANDLE_DW_TAG(ID, NAME, VERSION, VENDOR)                               \
      45             :   case DW_TAG_##NAME:                                                          \
      46             :     return VERSION;
      47             : #include "llvm/BinaryFormat/Dwarf.def"
      48             :   }
      49             : }
      50             : 
      51           0 : unsigned llvm::dwarf::TagVendor(dwarf::Tag Tag) {
      52           0 :   switch (Tag) {
      53             :   default:
      54             :     return 0;
      55             : #define HANDLE_DW_TAG(ID, NAME, VERSION, VENDOR)                               \
      56             :   case DW_TAG_##NAME:                                                          \
      57             :     return DWARF_VENDOR_##VENDOR;
      58             : #include "llvm/BinaryFormat/Dwarf.def"
      59             :   }
      60             : }
      61             : 
      62       14247 : StringRef llvm::dwarf::ChildrenString(unsigned Children) {
      63       14247 :   switch (Children) {
      64             :   case DW_CHILDREN_no:
      65        8315 :     return "DW_CHILDREN_no";
      66             :   case DW_CHILDREN_yes:
      67        5932 :     return "DW_CHILDREN_yes";
      68             :   }
      69           0 :   return StringRef();
      70             : }
      71             : 
      72      111923 : StringRef llvm::dwarf::AttributeString(unsigned Attribute) {
      73      111923 :   switch (Attribute) {
      74         131 :   default:
      75         131 :     return StringRef();
      76             : #define HANDLE_DW_AT(ID, NAME, VERSION, VENDOR)                                \
      77             :   case DW_AT_##NAME:                                                           \
      78             :     return "DW_AT_" #NAME;
      79             : #include "llvm/BinaryFormat/Dwarf.def"
      80             :   }
      81             : }
      82             : 
      83           0 : unsigned llvm::dwarf::AttributeVersion(dwarf::Attribute Attribute) {
      84             :   switch (Attribute) {
      85             :   default:
      86             :     return 0;
      87             : #define HANDLE_DW_AT(ID, NAME, VERSION, VENDOR)                                \
      88             :   case DW_AT_##NAME:                                                           \
      89             :     return VERSION;
      90             : #include "llvm/BinaryFormat/Dwarf.def"
      91             :   }
      92             : }
      93             : 
      94           0 : unsigned llvm::dwarf::AttributeVendor(dwarf::Attribute Attribute) {
      95           0 :   switch (Attribute) {
      96             :   default:
      97             :     return 0;
      98             : #define HANDLE_DW_AT(ID, NAME, VERSION, VENDOR)                                \
      99             :   case DW_AT_##NAME:                                                           \
     100             :     return DWARF_VENDOR_##VENDOR;
     101             : #include "llvm/BinaryFormat/Dwarf.def"
     102             :   }
     103             : }
     104             : 
     105       90536 : StringRef llvm::dwarf::FormEncodingString(unsigned Encoding) {
     106       90536 :   switch (Encoding) {
     107           3 :   default:
     108           3 :     return StringRef();
     109             : #define HANDLE_DW_FORM(ID, NAME, VERSION, VENDOR)                              \
     110             :   case DW_FORM_##NAME:                                                         \
     111             :     return "DW_FORM_" #NAME;
     112             : #include "llvm/BinaryFormat/Dwarf.def"
     113             :   }
     114             : }
     115             : 
     116           0 : unsigned llvm::dwarf::FormVersion(dwarf::Form Form) {
     117             :   switch (Form) {
     118             :   default:
     119             :     return 0;
     120             : #define HANDLE_DW_FORM(ID, NAME, VERSION, VENDOR)                              \
     121             :   case DW_FORM_##NAME:                                                         \
     122             :     return VERSION;
     123             : #include "llvm/BinaryFormat/Dwarf.def"
     124             :   }
     125             : }
     126             : 
     127           0 : unsigned llvm::dwarf::FormVendor(dwarf::Form Form) {
     128             :   switch (Form) {
     129             :   default:
     130             :     return 0;
     131             : #define HANDLE_DW_FORM(ID, NAME, VERSION, VENDOR)                              \
     132             :   case DW_FORM_##NAME:                                                         \
     133             :     return DWARF_VENDOR_##VENDOR;
     134             : #include "llvm/BinaryFormat/Dwarf.def"
     135             :   }
     136             : }
     137             : 
     138      110265 : StringRef llvm::dwarf::OperationEncodingString(unsigned Encoding) {
     139      110265 :   switch (Encoding) {
     140           0 :   default:
     141           0 :     return StringRef();
     142             : #define HANDLE_DW_OP(ID, NAME, VERSION, VENDOR)                                \
     143             :   case DW_OP_##NAME:                                                           \
     144             :     return "DW_OP_" #NAME;
     145             : #include "llvm/BinaryFormat/Dwarf.def"
     146             :   case DW_OP_LLVM_fragment:
     147         157 :     return "DW_OP_LLVM_fragment";
     148             :   }
     149             : }
     150             : 
     151         431 : unsigned llvm::dwarf::getOperationEncoding(StringRef OperationEncodingString) {
     152         431 :   return StringSwitch<unsigned>(OperationEncodingString)
     153             : #define HANDLE_DW_OP(ID, NAME, VERSION, VENDOR)                                \
     154             :   .Case("DW_OP_" #NAME, DW_OP_##NAME)
     155             : #include "llvm/BinaryFormat/Dwarf.def"
     156         431 :       .Case("DW_OP_LLVM_fragment", DW_OP_LLVM_fragment)
     157         431 :       .Default(0);
     158             : }
     159             : 
     160           0 : unsigned llvm::dwarf::OperationVersion(dwarf::LocationAtom Op) {
     161             :   switch (Op) {
     162             :   default:
     163             :     return 0;
     164             : #define HANDLE_DW_OP(ID, NAME, VERSION, VENDOR)                                \
     165             :   case DW_OP_##NAME:                                                           \
     166             :     return VERSION;
     167             : #include "llvm/BinaryFormat/Dwarf.def"
     168             :   }
     169             : }
     170             : 
     171           0 : unsigned llvm::dwarf::OperationVendor(dwarf::LocationAtom Op) {
     172           0 :   switch (Op) {
     173             :   default:
     174             :     return 0;
     175             : #define HANDLE_DW_OP(ID, NAME, VERSION, VENDOR)                                \
     176             :   case DW_OP_##NAME:                                                           \
     177             :     return DWARF_VENDOR_##VENDOR;
     178             : #include "llvm/BinaryFormat/Dwarf.def"
     179             :   }
     180             : }
     181             : 
     182        1711 : StringRef llvm::dwarf::AttributeEncodingString(unsigned Encoding) {
     183        1711 :   switch (Encoding) {
     184           3 :   default:
     185           3 :     return StringRef();
     186             : #define HANDLE_DW_ATE(ID, NAME, VERSION, VENDOR)                               \
     187             :   case DW_ATE_##NAME:                                                          \
     188             :     return "DW_ATE_" #NAME;
     189             : #include "llvm/BinaryFormat/Dwarf.def"
     190             :   }
     191             : }
     192             : 
     193        1559 : unsigned llvm::dwarf::getAttributeEncoding(StringRef EncodingString) {
     194        1559 :   return StringSwitch<unsigned>(EncodingString)
     195             : #define HANDLE_DW_ATE(ID, NAME, VERSION, VENDOR)                               \
     196             :   .Case("DW_ATE_" #NAME, DW_ATE_##NAME)
     197             : #include "llvm/BinaryFormat/Dwarf.def"
     198        1559 :       .Default(0);
     199             : }
     200             : 
     201           0 : unsigned llvm::dwarf::AttributeEncodingVersion(dwarf::TypeKind ATE) {
     202             :   switch (ATE) {
     203             :   default:
     204             :     return 0;
     205             : #define HANDLE_DW_ATE(ID, NAME, VERSION, VENDOR)                               \
     206             :   case DW_ATE_##NAME:                                                          \
     207             :     return VERSION;
     208             : #include "llvm/BinaryFormat/Dwarf.def"
     209             :   }
     210             : }
     211             : 
     212           0 : unsigned llvm::dwarf::AttributeEncodingVendor(dwarf::TypeKind ATE) {
     213             :   switch (ATE) {
     214             :   default:
     215             :     return 0;
     216             : #define HANDLE_DW_ATE(ID, NAME, VERSION, VENDOR)                               \
     217             :   case DW_ATE_##NAME:                                                          \
     218             :     return DWARF_VENDOR_##VENDOR;
     219             : #include "llvm/BinaryFormat/Dwarf.def"
     220             :   }
     221             : }
     222             : 
     223           0 : StringRef llvm::dwarf::DecimalSignString(unsigned Sign) {
     224           0 :   switch (Sign) {
     225             :   case DW_DS_unsigned:
     226           0 :     return "DW_DS_unsigned";
     227             :   case DW_DS_leading_overpunch:
     228           0 :     return "DW_DS_leading_overpunch";
     229             :   case DW_DS_trailing_overpunch:
     230           0 :     return "DW_DS_trailing_overpunch";
     231             :   case DW_DS_leading_separate:
     232           0 :     return "DW_DS_leading_separate";
     233             :   case DW_DS_trailing_separate:
     234           0 :     return "DW_DS_trailing_separate";
     235             :   }
     236           0 :   return StringRef();
     237             : }
     238             : 
     239           0 : StringRef llvm::dwarf::EndianityString(unsigned Endian) {
     240           0 :   switch (Endian) {
     241             :   case DW_END_default:
     242           0 :     return "DW_END_default";
     243             :   case DW_END_big:
     244           0 :     return "DW_END_big";
     245             :   case DW_END_little:
     246           0 :     return "DW_END_little";
     247             :   case DW_END_lo_user:
     248           0 :     return "DW_END_lo_user";
     249             :   case DW_END_hi_user:
     250           0 :     return "DW_END_hi_user";
     251             :   }
     252           0 :   return StringRef();
     253             : }
     254             : 
     255         314 : StringRef llvm::dwarf::AccessibilityString(unsigned Access) {
     256         314 :   switch (Access) {
     257             :   // Accessibility codes
     258             :   case DW_ACCESS_public:
     259         220 :     return "DW_ACCESS_public";
     260             :   case DW_ACCESS_protected:
     261          20 :     return "DW_ACCESS_protected";
     262             :   case DW_ACCESS_private:
     263          74 :     return "DW_ACCESS_private";
     264             :   }
     265           0 :   return StringRef();
     266             : }
     267             : 
     268           8 : StringRef llvm::dwarf::VisibilityString(unsigned Visibility) {
     269           8 :   switch (Visibility) {
     270             :   case DW_VIS_local:
     271           8 :     return "DW_VIS_local";
     272             :   case DW_VIS_exported:
     273           0 :     return "DW_VIS_exported";
     274             :   case DW_VIS_qualified:
     275           0 :     return "DW_VIS_qualified";
     276             :   }
     277           0 :   return StringRef();
     278             : }
     279             : 
     280         109 : StringRef llvm::dwarf::VirtualityString(unsigned Virtuality) {
     281         109 :   switch (Virtuality) {
     282           2 :   default:
     283           2 :     return StringRef();
     284             : #define HANDLE_DW_VIRTUALITY(ID, NAME)                                         \
     285             :   case DW_VIRTUALITY_##NAME:                                                   \
     286             :     return "DW_VIRTUALITY_" #NAME;
     287             : #include "llvm/BinaryFormat/Dwarf.def"
     288             :   }
     289             : }
     290             : 
     291          74 : unsigned llvm::dwarf::getVirtuality(StringRef VirtualityString) {
     292          74 :   return StringSwitch<unsigned>(VirtualityString)
     293             : #define HANDLE_DW_VIRTUALITY(ID, NAME)                                         \
     294             :   .Case("DW_VIRTUALITY_" #NAME, DW_VIRTUALITY_##NAME)
     295             : #include "llvm/BinaryFormat/Dwarf.def"
     296          74 :       .Default(DW_VIRTUALITY_invalid);
     297             : }
     298             : 
     299        2027 : StringRef llvm::dwarf::LanguageString(unsigned Language) {
     300        2027 :   switch (Language) {
     301           5 :   default:
     302           5 :     return StringRef();
     303             : #define HANDLE_DW_LANG(ID, NAME, VERSION, VENDOR)                              \
     304             :   case DW_LANG_##NAME:                                                         \
     305             :     return "DW_LANG_" #NAME;
     306             : #include "llvm/BinaryFormat/Dwarf.def"
     307             :   }
     308             : }
     309             : 
     310        2086 : unsigned llvm::dwarf::getLanguage(StringRef LanguageString) {
     311        2086 :   return StringSwitch<unsigned>(LanguageString)
     312             : #define HANDLE_DW_LANG(ID, NAME, VERSION, VENDOR)                              \
     313             :   .Case("DW_LANG_" #NAME, DW_LANG_##NAME)
     314             : #include "llvm/BinaryFormat/Dwarf.def"
     315        2086 :       .Default(0);
     316             : }
     317             : 
     318           0 : unsigned llvm::dwarf::LanguageVersion(dwarf::SourceLanguage Lang) {
     319             :   switch (Lang) {
     320             :   default:
     321             :     return 0;
     322             : #define HANDLE_DW_LANG(ID, NAME, VERSION, VENDOR)                              \
     323             :   case DW_LANG_##NAME:                                                         \
     324             :     return VERSION;
     325             : #include "llvm/BinaryFormat/Dwarf.def"
     326             :   }
     327             : }
     328             : 
     329           0 : unsigned llvm::dwarf::LanguageVendor(dwarf::SourceLanguage Lang) {
     330           0 :   switch (Lang) {
     331             :   default:
     332             :     return 0;
     333             : #define HANDLE_DW_LANG(ID, NAME, VERSION, VENDOR)                              \
     334             :   case DW_LANG_##NAME:                                                         \
     335             :     return DWARF_VENDOR_##VENDOR;
     336             : #include "llvm/BinaryFormat/Dwarf.def"
     337             :   }
     338             : }
     339             : 
     340           0 : StringRef llvm::dwarf::CaseString(unsigned Case) {
     341           0 :   switch (Case) {
     342             :   case DW_ID_case_sensitive:
     343           0 :     return "DW_ID_case_sensitive";
     344             :   case DW_ID_up_case:
     345           0 :     return "DW_ID_up_case";
     346             :   case DW_ID_down_case:
     347           0 :     return "DW_ID_down_case";
     348             :   case DW_ID_case_insensitive:
     349           0 :     return "DW_ID_case_insensitive";
     350             :   }
     351           0 :   return StringRef();
     352             : }
     353             : 
     354         109 : StringRef llvm::dwarf::ConventionString(unsigned CC) {
     355         109 :   switch (CC) {
     356           0 :   default:
     357           0 :     return StringRef();
     358             : #define HANDLE_DW_CC(ID, NAME)                                                 \
     359             :   case DW_CC_##NAME:                                                           \
     360             :     return "DW_CC_" #NAME;
     361             : #include "llvm/BinaryFormat/Dwarf.def"
     362             :   }
     363             : }
     364             : 
     365          79 : unsigned llvm::dwarf::getCallingConvention(StringRef CCString) {
     366          79 :   return StringSwitch<unsigned>(CCString)
     367             : #define HANDLE_DW_CC(ID, NAME) .Case("DW_CC_" #NAME, DW_CC_##NAME)
     368             : #include "llvm/BinaryFormat/Dwarf.def"
     369          79 :       .Default(0);
     370             : }
     371             : 
     372          85 : StringRef llvm::dwarf::InlineCodeString(unsigned Code) {
     373          85 :   switch (Code) {
     374             :   case DW_INL_not_inlined:
     375           0 :     return "DW_INL_not_inlined";
     376             :   case DW_INL_inlined:
     377          85 :     return "DW_INL_inlined";
     378             :   case DW_INL_declared_not_inlined:
     379           0 :     return "DW_INL_declared_not_inlined";
     380             :   case DW_INL_declared_inlined:
     381           0 :     return "DW_INL_declared_inlined";
     382             :   }
     383           0 :   return StringRef();
     384             : }
     385             : 
     386           0 : StringRef llvm::dwarf::ArrayOrderString(unsigned Order) {
     387           0 :   switch (Order) {
     388             :   case DW_ORD_row_major:
     389           0 :     return "DW_ORD_row_major";
     390             :   case DW_ORD_col_major:
     391           0 :     return "DW_ORD_col_major";
     392             :   }
     393           0 :   return StringRef();
     394             : }
     395             : 
     396        5190 : StringRef llvm::dwarf::LNStandardString(unsigned Standard) {
     397        5190 :   switch (Standard) {
     398         189 :   default:
     399         189 :     return StringRef();
     400             : #define HANDLE_DW_LNS(ID, NAME)                                                \
     401             :   case DW_LNS_##NAME:                                                          \
     402             :     return "DW_LNS_" #NAME;
     403             : #include "llvm/BinaryFormat/Dwarf.def"
     404             :   }
     405             : }
     406             : 
     407         262 : StringRef llvm::dwarf::LNExtendedString(unsigned Encoding) {
     408         262 :   switch (Encoding) {
     409           2 :   default:
     410           2 :     return StringRef();
     411             : #define HANDLE_DW_LNE(ID, NAME)                                                \
     412             :   case DW_LNE_##NAME:                                                          \
     413             :     return "DW_LNE_" #NAME;
     414             : #include "llvm/BinaryFormat/Dwarf.def"
     415             :   }
     416             : }
     417             : 
     418        1589 : StringRef llvm::dwarf::MacinfoString(unsigned Encoding) {
     419        1589 :   switch (Encoding) {
     420             :   // Macinfo Type Encodings
     421             :   case DW_MACINFO_define:
     422        1554 :     return "DW_MACINFO_define";
     423             :   case DW_MACINFO_undef:
     424          23 :     return "DW_MACINFO_undef";
     425             :   case DW_MACINFO_start_file:
     426           6 :     return "DW_MACINFO_start_file";
     427             :   case DW_MACINFO_end_file:
     428           6 :     return "DW_MACINFO_end_file";
     429             :   case DW_MACINFO_vendor_ext:
     430           0 :     return "DW_MACINFO_vendor_ext";
     431             :   case DW_MACINFO_invalid:
     432           0 :     return "DW_MACINFO_invalid";
     433             :   }
     434           0 :   return StringRef();
     435             : }
     436             : 
     437          23 : unsigned llvm::dwarf::getMacinfo(StringRef MacinfoString) {
     438          23 :   return StringSwitch<unsigned>(MacinfoString)
     439          23 :       .Case("DW_MACINFO_define", DW_MACINFO_define)
     440          23 :       .Case("DW_MACINFO_undef", DW_MACINFO_undef)
     441          23 :       .Case("DW_MACINFO_start_file", DW_MACINFO_start_file)
     442          23 :       .Case("DW_MACINFO_end_file", DW_MACINFO_end_file)
     443          23 :       .Case("DW_MACINFO_vendor_ext", DW_MACINFO_vendor_ext)
     444          23 :       .Default(DW_MACINFO_invalid);
     445             : }
     446             : 
     447          58 : StringRef llvm::dwarf::RangeListEncodingString(unsigned Encoding) {
     448          58 :   switch (Encoding) {
     449           0 :   default:
     450           0 :     return StringRef();
     451             : #define HANDLE_DW_RLE(ID, NAME)                                                \
     452             :   case DW_RLE_##NAME:                                                          \
     453             :     return "DW_RLE_" #NAME;
     454             : #include "llvm/BinaryFormat/Dwarf.def"
     455             :   }
     456             : }
     457             : 
     458        2882 : StringRef llvm::dwarf::CallFrameString(unsigned Encoding) {
     459        2882 :   switch (Encoding) {
     460           0 :   default:
     461           0 :     return StringRef();
     462             : #define HANDLE_DW_CFA(ID, NAME)                                                \
     463             :   case DW_CFA_##NAME:                                                          \
     464             :     return "DW_CFA_" #NAME;
     465             : #include "llvm/BinaryFormat/Dwarf.def"
     466             :   }
     467             : }
     468             : 
     469          98 : StringRef llvm::dwarf::ApplePropertyString(unsigned Prop) {
     470          98 :   switch (Prop) {
     471           0 :   default:
     472           0 :     return StringRef();
     473             : #define HANDLE_DW_APPLE_PROPERTY(ID, NAME)                                     \
     474             :   case DW_APPLE_PROPERTY_##NAME:                                               \
     475             :     return "DW_APPLE_PROPERTY_" #NAME;
     476             : #include "llvm/BinaryFormat/Dwarf.def"
     477             :   }
     478             : }
     479             : 
     480          74 : StringRef llvm::dwarf::UnitTypeString(unsigned UT) {
     481          74 :   switch (UT) {
     482           0 :   default:
     483           0 :     return StringRef();
     484             : #define HANDLE_DW_UT(ID, NAME)                                                 \
     485             :   case DW_UT_##NAME:                                                           \
     486             :     return "DW_UT_" #NAME;
     487             : #include "llvm/BinaryFormat/Dwarf.def"
     488             :   }
     489             : }
     490             : 
     491        2271 : StringRef llvm::dwarf::AtomTypeString(unsigned AT) {
     492        2271 :   switch (AT) {
     493             :   case dwarf::DW_ATOM_null:
     494           0 :     return "DW_ATOM_null";
     495             :   case dwarf::DW_ATOM_die_offset:
     496        1433 :     return "DW_ATOM_die_offset";
     497             :   case DW_ATOM_cu_offset:
     498           0 :     return "DW_ATOM_cu_offset";
     499             :   case DW_ATOM_die_tag:
     500         360 :     return "DW_ATOM_die_tag";
     501             :   case DW_ATOM_type_flags:
     502             :   case DW_ATOM_type_type_flags:
     503         360 :     return "DW_ATOM_type_flags";
     504             :   case DW_ATOM_qual_name_hash:
     505         118 :     return "DW_ATOM_qual_name_hash";
     506             :   }
     507           0 :   return StringRef();
     508             : }
     509             : 
     510          81 : StringRef llvm::dwarf::GDBIndexEntryKindString(GDBIndexEntryKind Kind) {
     511          81 :   switch (Kind) {
     512             :   case GIEK_NONE:
     513           0 :     return "NONE";
     514             :   case GIEK_TYPE:
     515          32 :     return "TYPE";
     516             :   case GIEK_VARIABLE:
     517          27 :     return "VARIABLE";
     518             :   case GIEK_FUNCTION:
     519          22 :     return "FUNCTION";
     520             :   case GIEK_OTHER:
     521           0 :     return "OTHER";
     522             :   case GIEK_UNUSED5:
     523           0 :     return "UNUSED5";
     524             :   case GIEK_UNUSED6:
     525           0 :     return "UNUSED6";
     526             :   case GIEK_UNUSED7:
     527           0 :     return "UNUSED7";
     528             :   }
     529           0 :   llvm_unreachable("Unknown GDBIndexEntryKind value");
     530             : }
     531             : 
     532             : StringRef
     533          81 : llvm::dwarf::GDBIndexEntryLinkageString(GDBIndexEntryLinkage Linkage) {
     534          81 :   switch (Linkage) {
     535             :   case GIEL_EXTERNAL:
     536          60 :     return "EXTERNAL";
     537             :   case GIEL_STATIC:
     538          21 :     return "STATIC";
     539             :   }
     540           0 :   llvm_unreachable("Unknown GDBIndexEntryLinkage value");
     541             : }
     542             : 
     543       10182 : StringRef llvm::dwarf::AttributeValueString(uint16_t Attr, unsigned Val) {
     544       10182 :   switch (Attr) {
     545         275 :   case DW_AT_accessibility:
     546         275 :     return AccessibilityString(Val);
     547           8 :   case DW_AT_virtuality:
     548           8 :     return VirtualityString(Val);
     549         699 :   case DW_AT_language:
     550         699 :     return LanguageString(Val);
     551         570 :   case DW_AT_encoding:
     552         570 :     return AttributeEncodingString(Val);
     553           0 :   case DW_AT_decimal_sign:
     554           0 :     return DecimalSignString(Val);
     555           0 :   case DW_AT_endianity:
     556           0 :     return EndianityString(Val);
     557           8 :   case DW_AT_visibility:
     558           8 :     return VisibilityString(Val);
     559           0 :   case DW_AT_identifier_case:
     560           0 :     return CaseString(Val);
     561           7 :   case DW_AT_calling_convention:
     562           7 :     return ConventionString(Val);
     563          85 :   case DW_AT_inline:
     564          85 :     return InlineCodeString(Val);
     565           0 :   case DW_AT_ordering:
     566           0 :     return ArrayOrderString(Val);
     567          27 :   case DW_AT_APPLE_runtime_class:
     568          27 :     return LanguageString(Val);
     569             :   }
     570             : 
     571        8503 :   return StringRef();
     572             : }
     573             : 
     574        1295 : StringRef llvm::dwarf::AtomValueString(uint16_t Atom, unsigned Val) {
     575        1295 :   switch (Atom) {
     576             :   case DW_ATOM_null:
     577           0 :     return "NULL";
     578         230 :   case DW_ATOM_die_tag:
     579         230 :     return TagString(Val);
     580             :   }
     581             : 
     582        1065 :   return StringRef();
     583             : }
     584             : 
     585        1640 : StringRef llvm::dwarf::IndexString(unsigned Idx) {
     586        1640 :   switch (Idx) {
     587           2 :   default:
     588           2 :     return StringRef();
     589             : #define HANDLE_DW_IDX(ID, NAME)                                                \
     590             :   case DW_IDX_##NAME:                                                          \
     591             :     return "DW_IDX_" #NAME;
     592             : #include "llvm/BinaryFormat/Dwarf.def"
     593             :   }
     594             : }
     595             : 
     596     1470609 : Optional<uint8_t> llvm::dwarf::getFixedFormByteSize(dwarf::Form Form,
     597             :                                                     FormParams Params) {
     598     1470609 :   switch (Form) {
     599       10252 :   case DW_FORM_addr:
     600             :     if (Params)
     601             :       return Params.AddrSize;
     602             :     return None;
     603             : 
     604             :   case DW_FORM_block:          // ULEB128 length L followed by L bytes.
     605             :   case DW_FORM_block1:         // 1 byte length L followed by L bytes.
     606             :   case DW_FORM_block2:         // 2 byte length L followed by L bytes.
     607             :   case DW_FORM_block4:         // 4 byte length L followed by L bytes.
     608             :   case DW_FORM_string:         // C-string with null terminator.
     609             :   case DW_FORM_sdata:          // SLEB128.
     610             :   case DW_FORM_udata:          // ULEB128.
     611             :   case DW_FORM_ref_udata:      // ULEB128.
     612             :   case DW_FORM_indirect:       // ULEB128.
     613             :   case DW_FORM_exprloc:        // ULEB128 length L followed by L bytes.
     614             :   case DW_FORM_strx:           // ULEB128.
     615             :   case DW_FORM_addrx:          // ULEB128.
     616             :   case DW_FORM_loclistx:       // ULEB128.
     617             :   case DW_FORM_rnglistx:       // ULEB128.
     618             :   case DW_FORM_GNU_addr_index: // ULEB128.
     619             :   case DW_FORM_GNU_str_index:  // ULEB128.
     620             :     return None;
     621             : 
     622        1199 :   case DW_FORM_ref_addr:
     623             :     if (Params)
     624             :       return Params.getRefAddrByteSize();
     625             :     return None;
     626             : 
     627      906883 :   case DW_FORM_flag:
     628             :   case DW_FORM_data1:
     629             :   case DW_FORM_ref1:
     630             :   case DW_FORM_strx1:
     631             :   case DW_FORM_addrx1:
     632             :     return 1;
     633             : 
     634      314070 :   case DW_FORM_data2:
     635             :   case DW_FORM_ref2:
     636             :   case DW_FORM_strx2:
     637             :   case DW_FORM_addrx2:
     638             :     return 2;
     639             : 
     640           8 :   case DW_FORM_strx3:
     641             :     return 3;
     642             : 
     643       32205 :   case DW_FORM_data4:
     644             :   case DW_FORM_ref4:
     645             :   case DW_FORM_ref_sup4:
     646             :   case DW_FORM_strx4:
     647             :   case DW_FORM_addrx4:
     648             :     return 4;
     649             : 
     650       58544 :   case DW_FORM_strp:
     651             :   case DW_FORM_GNU_ref_alt:
     652             :   case DW_FORM_GNU_strp_alt:
     653             :   case DW_FORM_line_strp:
     654             :   case DW_FORM_sec_offset:
     655             :   case DW_FORM_strp_sup:
     656             :     if (Params)
     657             :       return Params.getDwarfOffsetByteSize();
     658             :     return None;
     659             : 
     660         602 :   case DW_FORM_data8:
     661             :   case DW_FORM_ref8:
     662             :   case DW_FORM_ref_sig8:
     663             :   case DW_FORM_ref_sup8:
     664             :     return 8;
     665             : 
     666      120589 :   case DW_FORM_flag_present:
     667             :     return 0;
     668             : 
     669           2 :   case DW_FORM_data16:
     670             :     return 16;
     671             : 
     672           5 :   case DW_FORM_implicit_const:
     673             :     // The implicit value is stored in the abbreviation as a SLEB128, and
     674             :     // there no data in debug info.
     675             :     return 0;
     676             : 
     677             :   default:
     678             :     break;
     679             :   }
     680             :   return None;
     681             : }
     682             : 
     683           0 : bool llvm::dwarf::isValidFormForVersion(Form F, unsigned Version,
     684             :                                         bool ExtensionsOk) {
     685           0 :   if (FormVendor(F) == DWARF_VENDOR_DWARF) {
     686           0 :     unsigned FV = FormVersion(F);
     687           0 :     return FV > 0 && FV <= Version;
     688             :   }
     689             :   return ExtensionsOk;
     690             : }
     691             : 
     692             : constexpr char llvm::dwarf::EnumTraits<Attribute>::Type[];
     693             : constexpr char llvm::dwarf::EnumTraits<Form>::Type[];
     694             : constexpr char llvm::dwarf::EnumTraits<Index>::Type[];
     695             : constexpr char llvm::dwarf::EnumTraits<Tag>::Type[];

Generated by: LCOV version 1.13