LCOV - code coverage report
Current view: top level - lib/BinaryFormat - Dwarf.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 133 223 59.6 %
Date: 2018-06-17 00:07:59 Functions: 32 49 65.3 %
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       88910 : StringRef llvm::dwarf::TagString(unsigned Tag) {
      22       88910 :   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        3813 : unsigned llvm::dwarf::getTag(StringRef TagString) {
      33        3813 :   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        3813 :       .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       72275 : StringRef llvm::dwarf::ChildrenString(unsigned Children) {
      63       72275 :   switch (Children) {
      64             :   case DW_CHILDREN_no:
      65       41775 :     return "DW_CHILDREN_no";
      66             :   case DW_CHILDREN_yes:
      67       30500 :     return "DW_CHILDREN_yes";
      68             :   }
      69           0 :   return StringRef();
      70             : }
      71             : 
      72      369007 : StringRef llvm::dwarf::AttributeString(unsigned Attribute) {
      73      369007 :   switch (Attribute) {
      74          92 :   default:
      75          92 :     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      348484 : StringRef llvm::dwarf::FormEncodingString(unsigned Encoding) {
     106      348484 :   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       41183 : StringRef llvm::dwarf::OperationEncodingString(unsigned Encoding) {
     139       41183 :   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         411 : unsigned llvm::dwarf::getOperationEncoding(StringRef OperationEncodingString) {
     152         411 :   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             :       .Case("DW_OP_LLVM_fragment", DW_OP_LLVM_fragment)
     157         411 :       .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        1598 : StringRef llvm::dwarf::AttributeEncodingString(unsigned Encoding) {
     183        1598 :   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        1432 : unsigned llvm::dwarf::getAttributeEncoding(StringRef EncodingString) {
     194        1432 :   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        1432 :       .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         308 : StringRef llvm::dwarf::AccessibilityString(unsigned Access) {
     256         308 :   switch (Access) {
     257             :   // Accessibility codes
     258             :   case DW_ACCESS_public:
     259         214 :     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        1876 : StringRef llvm::dwarf::LanguageString(unsigned Language) {
     300        1876 :   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        1974 : unsigned llvm::dwarf::getLanguage(StringRef LanguageString) {
     311        1974 :   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        1974 :       .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         102 : StringRef llvm::dwarf::ConventionString(unsigned CC) {
     355         102 :   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          84 : StringRef llvm::dwarf::InlineCodeString(unsigned Code) {
     373          84 :   switch (Code) {
     374             :   case DW_INL_not_inlined:
     375           0 :     return "DW_INL_not_inlined";
     376             :   case DW_INL_inlined:
     377          84 :     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        4863 : StringRef llvm::dwarf::LNStandardString(unsigned Standard) {
     397        4863 :   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         238 : StringRef llvm::dwarf::LNExtendedString(unsigned Encoding) {
     408         238 :   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        1235 : StringRef llvm::dwarf::MacinfoString(unsigned Encoding) {
     419        1235 :   switch (Encoding) {
     420             :   // Macinfo Type Encodings
     421             :   case DW_MACINFO_define:
     422        1204 :     return "DW_MACINFO_define";
     423             :   case DW_MACINFO_undef:
     424          19 :     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             :       .Case("DW_MACINFO_define", DW_MACINFO_define)
     440             :       .Case("DW_MACINFO_undef", DW_MACINFO_undef)
     441             :       .Case("DW_MACINFO_start_file", DW_MACINFO_start_file)
     442             :       .Case("DW_MACINFO_end_file", DW_MACINFO_end_file)
     443             :       .Case("DW_MACINFO_vendor_ext", DW_MACINFO_vendor_ext)
     444          23 :       .Default(DW_MACINFO_invalid);
     445             : }
     446             : 
     447          30 : StringRef llvm::dwarf::RangeListEncodingString(unsigned Encoding) {
     448          30 :   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        2783 : StringRef llvm::dwarf::CallFrameString(unsigned Encoding) {
     459        2783 :   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          57 : StringRef llvm::dwarf::UnitTypeString(unsigned UT) {
     481          57 :   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        2273 : StringRef llvm::dwarf::AtomTypeString(unsigned AT) {
     492        2273 :   switch (AT) {
     493             :   case dwarf::DW_ATOM_null:
     494           0 :     return "DW_ATOM_null";
     495             :   case dwarf::DW_ATOM_die_offset:
     496        1439 :     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         361 :     return "DW_ATOM_die_tag";
     501             :   case DW_ATOM_type_flags:
     502             :   case DW_ATOM_type_type_flags:
     503         361 :     return "DW_ATOM_type_flags";
     504             :   case DW_ATOM_qual_name_hash:
     505         112 :     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        9846 : StringRef llvm::dwarf::AttributeValueString(uint16_t Attr, unsigned Val) {
     544        9846 :   switch (Attr) {
     545         274 :   case DW_AT_accessibility:
     546         274 :     return AccessibilityString(Val);
     547           8 :   case DW_AT_virtuality:
     548           8 :     return VirtualityString(Val);
     549         665 :   case DW_AT_language:
     550         665 :     return LanguageString(Val);
     551         554 :   case DW_AT_encoding:
     552         554 :     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           4 :   case DW_AT_calling_convention:
     562           4 :     return ConventionString(Val);
     563          84 :   case DW_AT_inline:
     564          84 :     return InlineCodeString(Val);
     565           0 :   case DW_AT_ordering:
     566           0 :     return ArrayOrderString(Val);
     567             :   }
     568             : 
     569        8249 :   return StringRef();
     570             : }
     571             : 
     572        1363 : StringRef llvm::dwarf::IndexString(unsigned Idx) {
     573        1363 :   switch (Idx) {
     574           2 :   default:
     575           2 :     return StringRef();
     576             : #define HANDLE_DW_IDX(ID, NAME)                                                \
     577             :   case DW_IDX_##NAME:                                                          \
     578             :     return "DW_IDX_" #NAME;
     579             : #include "llvm/BinaryFormat/Dwarf.def"
     580             :   }
     581             : }
     582             : 
     583     5006656 : Optional<uint8_t> llvm::dwarf::getFixedFormByteSize(dwarf::Form Form,
     584             :                                                     FormParams Params) {
     585     5006656 :   switch (Form) {
     586             :   case DW_FORM_addr:
     587             :     if (Params)
     588             :       return Params.AddrSize;
     589             :     return None;
     590             : 
     591             :   case DW_FORM_block:          // ULEB128 length L followed by L bytes.
     592             :   case DW_FORM_block1:         // 1 byte length L followed by L bytes.
     593             :   case DW_FORM_block2:         // 2 byte length L followed by L bytes.
     594             :   case DW_FORM_block4:         // 4 byte length L followed by L bytes.
     595             :   case DW_FORM_string:         // C-string with null terminator.
     596             :   case DW_FORM_sdata:          // SLEB128.
     597             :   case DW_FORM_udata:          // ULEB128.
     598             :   case DW_FORM_ref_udata:      // ULEB128.
     599             :   case DW_FORM_indirect:       // ULEB128.
     600             :   case DW_FORM_exprloc:        // ULEB128 length L followed by L bytes.
     601             :   case DW_FORM_strx:           // ULEB128.
     602             :   case DW_FORM_addrx:          // ULEB128.
     603             :   case DW_FORM_loclistx:       // ULEB128.
     604             :   case DW_FORM_rnglistx:       // ULEB128.
     605             :   case DW_FORM_GNU_addr_index: // ULEB128.
     606             :   case DW_FORM_GNU_str_index:  // ULEB128.
     607             :     return None;
     608             : 
     609             :   case DW_FORM_ref_addr:
     610             :     if (Params)
     611             :       return Params.getRefAddrByteSize();
     612             :     return None;
     613             : 
     614     3178924 :   case DW_FORM_flag:
     615             :   case DW_FORM_data1:
     616             :   case DW_FORM_ref1:
     617             :   case DW_FORM_strx1:
     618             :   case DW_FORM_addrx1:
     619             :     return 1;
     620             : 
     621      636838 :   case DW_FORM_data2:
     622             :   case DW_FORM_ref2:
     623             :   case DW_FORM_strx2:
     624             :   case DW_FORM_addrx2:
     625             :     return 2;
     626             : 
     627           2 :   case DW_FORM_strx3:
     628             :     return 3;
     629             : 
     630       31757 :   case DW_FORM_data4:
     631             :   case DW_FORM_ref4:
     632             :   case DW_FORM_ref_sup4:
     633             :   case DW_FORM_strx4:
     634             :   case DW_FORM_addrx4:
     635             :     return 4;
     636             : 
     637             :   case DW_FORM_strp:
     638             :   case DW_FORM_GNU_ref_alt:
     639             :   case DW_FORM_GNU_strp_alt:
     640             :   case DW_FORM_line_strp:
     641             :   case DW_FORM_sec_offset:
     642             :   case DW_FORM_strp_sup:
     643             :     if (Params)
     644             :       return Params.getDwarfOffsetByteSize();
     645             :     return None;
     646             : 
     647        3052 :   case DW_FORM_data8:
     648             :   case DW_FORM_ref8:
     649             :   case DW_FORM_ref_sig8:
     650             :   case DW_FORM_ref_sup8:
     651             :     return 8;
     652             : 
     653      820725 :   case DW_FORM_flag_present:
     654             :     return 0;
     655             : 
     656           2 :   case DW_FORM_data16:
     657             :     return 16;
     658             : 
     659           5 :   case DW_FORM_implicit_const:
     660             :     // The implicit value is stored in the abbreviation as a SLEB128, and
     661             :     // there no data in debug info.
     662             :     return 0;
     663             : 
     664             :   default:
     665             :     break;
     666             :   }
     667             :   return None;
     668             : }
     669             : 
     670           0 : bool llvm::dwarf::isValidFormForVersion(Form F, unsigned Version,
     671             :                                         bool ExtensionsOk) {
     672           0 :   if (FormVendor(F) == DWARF_VENDOR_DWARF) {
     673           0 :     unsigned FV = FormVersion(F);
     674           0 :     return FV > 0 && FV <= Version;
     675             :   }
     676             :   return ExtensionsOk;
     677             : }
     678             : 
     679             : constexpr char llvm::dwarf::EnumTraits<Attribute>::Type[];
     680             : constexpr char llvm::dwarf::EnumTraits<Form>::Type[];
     681             : constexpr char llvm::dwarf::EnumTraits<Index>::Type[];
     682             : constexpr char llvm::dwarf::EnumTraits<Tag>::Type[];

Generated by: LCOV version 1.13