Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 1 | //===-- llvm/Support/Dwarf.cpp - Dwarf Framework ----------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | f3ebc3f | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file contains support for generic dwarf information. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #include "llvm/Support/Dwarf.h" |
Duncan P. N. Exon Smith | 6f5546c | 2015-02-03 21:16:49 +0000 | [diff] [blame] | 15 | #include "llvm/ADT/StringSwitch.h" |
David Blaikie | d0a869d | 2013-09-19 22:19:37 +0000 | [diff] [blame] | 16 | #include "llvm/Support/ErrorHandling.h" |
| 17 | |
Chris Lattner | 3b32672 | 2009-12-29 07:28:33 +0000 | [diff] [blame] | 18 | using namespace llvm; |
| 19 | using namespace dwarf; |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 20 | |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 21 | StringRef llvm::dwarf::TagString(unsigned Tag) { |
Mike Stump | 889285d | 2009-05-13 23:23:20 +0000 | [diff] [blame] | 22 | switch (Tag) { |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 23 | default: |
| 24 | return StringRef(); |
Duncan P. N. Exon Smith | 981811e | 2015-02-03 21:13:16 +0000 | [diff] [blame] | 25 | #define HANDLE_DW_TAG(ID, NAME) \ |
| 26 | case DW_TAG_##NAME: \ |
| 27 | return "DW_TAG_" #NAME; |
| 28 | #include "llvm/Support/Dwarf.def" |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 29 | } |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 30 | } |
| 31 | |
Duncan P. N. Exon Smith | 6f5546c | 2015-02-03 21:16:49 +0000 | [diff] [blame] | 32 | unsigned llvm::dwarf::getTag(StringRef TagString) { |
| 33 | return StringSwitch<unsigned>(TagString) |
| 34 | #define HANDLE_DW_TAG(ID, NAME) .Case("DW_TAG_" #NAME, DW_TAG_##NAME) |
| 35 | #include "llvm/Support/Dwarf.def" |
| 36 | .Default(DW_TAG_invalid); |
| 37 | } |
| 38 | |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 39 | StringRef llvm::dwarf::ChildrenString(unsigned Children) { |
Mike Stump | 889285d | 2009-05-13 23:23:20 +0000 | [diff] [blame] | 40 | switch (Children) { |
Jason Molenda | dd6a4ca | 2010-06-17 01:23:24 +0000 | [diff] [blame] | 41 | case DW_CHILDREN_no: return "DW_CHILDREN_no"; |
| 42 | case DW_CHILDREN_yes: return "DW_CHILDREN_yes"; |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 43 | } |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 44 | return StringRef(); |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 45 | } |
| 46 | |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 47 | StringRef llvm::dwarf::AttributeString(unsigned Attribute) { |
Mike Stump | 889285d | 2009-05-13 23:23:20 +0000 | [diff] [blame] | 48 | switch (Attribute) { |
Chris Lattner | 0709a27 | 2009-12-29 21:09:57 +0000 | [diff] [blame] | 49 | case DW_AT_sibling: return "DW_AT_sibling"; |
| 50 | case DW_AT_location: return "DW_AT_location"; |
| 51 | case DW_AT_name: return "DW_AT_name"; |
| 52 | case DW_AT_ordering: return "DW_AT_ordering"; |
| 53 | case DW_AT_byte_size: return "DW_AT_byte_size"; |
| 54 | case DW_AT_bit_offset: return "DW_AT_bit_offset"; |
| 55 | case DW_AT_bit_size: return "DW_AT_bit_size"; |
| 56 | case DW_AT_stmt_list: return "DW_AT_stmt_list"; |
| 57 | case DW_AT_low_pc: return "DW_AT_low_pc"; |
| 58 | case DW_AT_high_pc: return "DW_AT_high_pc"; |
| 59 | case DW_AT_language: return "DW_AT_language"; |
| 60 | case DW_AT_discr: return "DW_AT_discr"; |
| 61 | case DW_AT_discr_value: return "DW_AT_discr_value"; |
| 62 | case DW_AT_visibility: return "DW_AT_visibility"; |
| 63 | case DW_AT_import: return "DW_AT_import"; |
| 64 | case DW_AT_string_length: return "DW_AT_string_length"; |
| 65 | case DW_AT_common_reference: return "DW_AT_common_reference"; |
| 66 | case DW_AT_comp_dir: return "DW_AT_comp_dir"; |
| 67 | case DW_AT_const_value: return "DW_AT_const_value"; |
| 68 | case DW_AT_containing_type: return "DW_AT_containing_type"; |
| 69 | case DW_AT_default_value: return "DW_AT_default_value"; |
| 70 | case DW_AT_inline: return "DW_AT_inline"; |
| 71 | case DW_AT_is_optional: return "DW_AT_is_optional"; |
| 72 | case DW_AT_lower_bound: return "DW_AT_lower_bound"; |
| 73 | case DW_AT_producer: return "DW_AT_producer"; |
| 74 | case DW_AT_prototyped: return "DW_AT_prototyped"; |
| 75 | case DW_AT_return_addr: return "DW_AT_return_addr"; |
| 76 | case DW_AT_start_scope: return "DW_AT_start_scope"; |
| 77 | case DW_AT_bit_stride: return "DW_AT_bit_stride"; |
| 78 | case DW_AT_upper_bound: return "DW_AT_upper_bound"; |
| 79 | case DW_AT_abstract_origin: return "DW_AT_abstract_origin"; |
| 80 | case DW_AT_accessibility: return "DW_AT_accessibility"; |
| 81 | case DW_AT_address_class: return "DW_AT_address_class"; |
| 82 | case DW_AT_artificial: return "DW_AT_artificial"; |
| 83 | case DW_AT_base_types: return "DW_AT_base_types"; |
| 84 | case DW_AT_calling_convention: return "DW_AT_calling_convention"; |
| 85 | case DW_AT_count: return "DW_AT_count"; |
| 86 | case DW_AT_data_member_location: return "DW_AT_data_member_location"; |
| 87 | case DW_AT_decl_column: return "DW_AT_decl_column"; |
| 88 | case DW_AT_decl_file: return "DW_AT_decl_file"; |
| 89 | case DW_AT_decl_line: return "DW_AT_decl_line"; |
| 90 | case DW_AT_declaration: return "DW_AT_declaration"; |
| 91 | case DW_AT_discr_list: return "DW_AT_discr_list"; |
| 92 | case DW_AT_encoding: return "DW_AT_encoding"; |
| 93 | case DW_AT_external: return "DW_AT_external"; |
| 94 | case DW_AT_frame_base: return "DW_AT_frame_base"; |
| 95 | case DW_AT_friend: return "DW_AT_friend"; |
| 96 | case DW_AT_identifier_case: return "DW_AT_identifier_case"; |
| 97 | case DW_AT_macro_info: return "DW_AT_macro_info"; |
| 98 | case DW_AT_namelist_item: return "DW_AT_namelist_item"; |
| 99 | case DW_AT_priority: return "DW_AT_priority"; |
| 100 | case DW_AT_segment: return "DW_AT_segment"; |
| 101 | case DW_AT_specification: return "DW_AT_specification"; |
| 102 | case DW_AT_static_link: return "DW_AT_static_link"; |
| 103 | case DW_AT_type: return "DW_AT_type"; |
| 104 | case DW_AT_use_location: return "DW_AT_use_location"; |
| 105 | case DW_AT_variable_parameter: return "DW_AT_variable_parameter"; |
| 106 | case DW_AT_virtuality: return "DW_AT_virtuality"; |
| 107 | case DW_AT_vtable_elem_location: return "DW_AT_vtable_elem_location"; |
| 108 | case DW_AT_allocated: return "DW_AT_allocated"; |
| 109 | case DW_AT_associated: return "DW_AT_associated"; |
| 110 | case DW_AT_data_location: return "DW_AT_data_location"; |
| 111 | case DW_AT_byte_stride: return "DW_AT_byte_stride"; |
| 112 | case DW_AT_entry_pc: return "DW_AT_entry_pc"; |
| 113 | case DW_AT_use_UTF8: return "DW_AT_use_UTF8"; |
| 114 | case DW_AT_extension: return "DW_AT_extension"; |
| 115 | case DW_AT_ranges: return "DW_AT_ranges"; |
| 116 | case DW_AT_trampoline: return "DW_AT_trampoline"; |
| 117 | case DW_AT_call_column: return "DW_AT_call_column"; |
| 118 | case DW_AT_call_file: return "DW_AT_call_file"; |
| 119 | case DW_AT_call_line: return "DW_AT_call_line"; |
| 120 | case DW_AT_description: return "DW_AT_description"; |
| 121 | case DW_AT_binary_scale: return "DW_AT_binary_scale"; |
| 122 | case DW_AT_decimal_scale: return "DW_AT_decimal_scale"; |
| 123 | case DW_AT_small: return "DW_AT_small"; |
| 124 | case DW_AT_decimal_sign: return "DW_AT_decimal_sign"; |
| 125 | case DW_AT_digit_count: return "DW_AT_digit_count"; |
| 126 | case DW_AT_picture_string: return "DW_AT_picture_string"; |
| 127 | case DW_AT_mutable: return "DW_AT_mutable"; |
| 128 | case DW_AT_threads_scaled: return "DW_AT_threads_scaled"; |
| 129 | case DW_AT_explicit: return "DW_AT_explicit"; |
| 130 | case DW_AT_object_pointer: return "DW_AT_object_pointer"; |
| 131 | case DW_AT_endianity: return "DW_AT_endianity"; |
| 132 | case DW_AT_elemental: return "DW_AT_elemental"; |
| 133 | case DW_AT_pure: return "DW_AT_pure"; |
| 134 | case DW_AT_recursive: return "DW_AT_recursive"; |
Nick Lewycky | 3436812 | 2011-09-15 04:23:44 +0000 | [diff] [blame] | 135 | case DW_AT_signature: return "DW_AT_signature"; |
| 136 | case DW_AT_main_subprogram: return "DW_AT_main_subprogram"; |
| 137 | case DW_AT_data_bit_offset: return "DW_AT_data_bit_offset"; |
| 138 | case DW_AT_const_expr: return "DW_AT_const_expr"; |
| 139 | case DW_AT_enum_class: return "DW_AT_enum_class"; |
| 140 | case DW_AT_linkage_name: return "DW_AT_linkage_name"; |
Adrian Prantl | 31631e4 | 2013-12-18 21:48:14 +0000 | [diff] [blame] | 141 | case DW_AT_string_length_bit_size: return "DW_AT_string_length_bit_size"; |
| 142 | case DW_AT_string_length_byte_size: return "DW_AT_string_length_byte_size"; |
| 143 | case DW_AT_rank: return "DW_AT_rank"; |
| 144 | case DW_AT_str_offsets_base: return "DW_AT_str_offsets_base"; |
| 145 | case DW_AT_addr_base: return "DW_AT_addr_base"; |
Adrian Prantl | c4fbbcf | 2016-10-28 17:59:50 +0000 | [diff] [blame] | 146 | case DW_AT_rnglists_base: return "DW_AT_rnglists_base"; |
Adrian Prantl | 31631e4 | 2013-12-18 21:48:14 +0000 | [diff] [blame] | 147 | case DW_AT_dwo_id: return "DW_AT_dwo_id"; |
| 148 | case DW_AT_dwo_name: return "DW_AT_dwo_name"; |
| 149 | case DW_AT_reference: return "DW_AT_reference"; |
| 150 | case DW_AT_rvalue_reference: return "DW_AT_rvalue_reference"; |
Adrian Prantl | c4fbbcf | 2016-10-28 17:59:50 +0000 | [diff] [blame] | 151 | case DW_AT_macros: return "DW_AT_macros"; |
| 152 | case DW_AT_call_all_calls: return "DW_AT_call_all_calls"; |
| 153 | case DW_AT_call_all_source_calls: return "DW_AT_call_all_source_calls"; |
| 154 | case DW_AT_call_all_tail_calls: return "DW_AT_call_all_tail_calls"; |
| 155 | case DW_AT_call_return_pc: return "DW_AT_call_return_pc"; |
| 156 | case DW_AT_call_value: return "DW_AT_call_value"; |
| 157 | case DW_AT_call_origin: return "DW_AT_call_origin"; |
| 158 | case DW_AT_call_parameter: return "DW_AT_call_parameter"; |
| 159 | case DW_AT_call_pc: return "DW_AT_call_pc"; |
| 160 | case DW_AT_call_tail_call: return "DW_AT_call_tail_call"; |
| 161 | case DW_AT_call_target: return "DW_AT_call_target"; |
| 162 | case DW_AT_call_target_clobbered: return "DW_AT_call_target_clobbered"; |
| 163 | case DW_AT_call_data_location: return "DW_AT_call_data_location"; |
| 164 | case DW_AT_call_data_value: return "DW_AT_call_data_value"; |
Adrian Prantl | c19dee7 | 2016-08-17 16:02:43 +0000 | [diff] [blame] | 165 | case DW_AT_noreturn: return "DW_AT_noreturn"; |
Adrian Prantl | c4fbbcf | 2016-10-28 17:59:50 +0000 | [diff] [blame] | 166 | case DW_AT_alignment: return "DW_AT_alignment"; |
| 167 | case DW_AT_export_symbols: return "DW_AT_export_symbols"; |
| 168 | case DW_AT_deleted: return "DW_AT_deleted"; |
| 169 | case DW_AT_defaulted: return "DW_AT_defaulted"; |
| 170 | case DW_AT_loclists_base: return "DW_AT_loclists_base"; |
Nick Lewycky | ee674b3 | 2011-09-15 05:21:03 +0000 | [diff] [blame] | 171 | case DW_AT_MIPS_loop_begin: return "DW_AT_MIPS_loop_begin"; |
| 172 | case DW_AT_MIPS_tail_loop_begin: return "DW_AT_MIPS_tail_loop_begin"; |
| 173 | case DW_AT_MIPS_epilog_begin: return "DW_AT_MIPS_epilog_begin"; |
| 174 | case DW_AT_MIPS_loop_unroll_factor: return "DW_AT_MIPS_loop_unroll_factor"; |
| 175 | case DW_AT_MIPS_software_pipeline_depth: |
| 176 | return "DW_AT_MIPS_software_pipeline_depth"; |
Chris Lattner | 0709a27 | 2009-12-29 21:09:57 +0000 | [diff] [blame] | 177 | case DW_AT_MIPS_linkage_name: return "DW_AT_MIPS_linkage_name"; |
Nick Lewycky | ee674b3 | 2011-09-15 05:21:03 +0000 | [diff] [blame] | 178 | case DW_AT_MIPS_stride: return "DW_AT_MIPS_stride"; |
| 179 | case DW_AT_MIPS_abstract_name: return "DW_AT_MIPS_abstract_name"; |
| 180 | case DW_AT_MIPS_clone_origin: return "DW_AT_MIPS_clone_origin"; |
| 181 | case DW_AT_MIPS_has_inlines: return "DW_AT_MIPS_has_inlines"; |
| 182 | case DW_AT_MIPS_stride_byte: return "DW_AT_MIPS_stride_byte"; |
| 183 | case DW_AT_MIPS_stride_elem: return "DW_AT_MIPS_stride_elem"; |
| 184 | case DW_AT_MIPS_ptr_dopetype: return "DW_AT_MIPS_ptr_dopetype"; |
| 185 | case DW_AT_MIPS_allocatable_dopetype: |
| 186 | return "DW_AT_MIPS_allocatable_dopetype"; |
| 187 | case DW_AT_MIPS_assumed_shape_dopetype: |
| 188 | return "DW_AT_MIPS_assumed_shape_dopetype"; |
Chris Lattner | 0709a27 | 2009-12-29 21:09:57 +0000 | [diff] [blame] | 189 | case DW_AT_sf_names: return "DW_AT_sf_names"; |
| 190 | case DW_AT_src_info: return "DW_AT_src_info"; |
| 191 | case DW_AT_mac_info: return "DW_AT_mac_info"; |
| 192 | case DW_AT_src_coords: return "DW_AT_src_coords"; |
| 193 | case DW_AT_body_begin: return "DW_AT_body_begin"; |
| 194 | case DW_AT_body_end: return "DW_AT_body_end"; |
| 195 | case DW_AT_GNU_vector: return "DW_AT_GNU_vector"; |
Nick Lewycky | ee674b3 | 2011-09-15 05:21:03 +0000 | [diff] [blame] | 196 | case DW_AT_GNU_template_name: return "DW_AT_GNU_template_name"; |
Eric Christopher | 8e46e7f | 2013-07-14 22:02:31 +0000 | [diff] [blame] | 197 | case DW_AT_GNU_odr_signature: return "DW_AT_GNU_odr_signature"; |
Nick Lewycky | ee674b3 | 2011-09-15 05:21:03 +0000 | [diff] [blame] | 198 | case DW_AT_MIPS_assumed_size: return "DW_AT_MIPS_assumed_size"; |
Chris Lattner | 0709a27 | 2009-12-29 21:09:57 +0000 | [diff] [blame] | 199 | case DW_AT_lo_user: return "DW_AT_lo_user"; |
| 200 | case DW_AT_hi_user: return "DW_AT_hi_user"; |
Dawn Perchik | fc4e1c74 | 2015-11-11 18:47:36 +0000 | [diff] [blame] | 201 | case DW_AT_BORLAND_property_read: return "DW_AT_BORLAND_property_read"; |
| 202 | case DW_AT_BORLAND_property_write: return "DW_AT_BORLAND_property_write"; |
| 203 | case DW_AT_BORLAND_property_implements: return "DW_AT_BORLAND_property_implements"; |
| 204 | case DW_AT_BORLAND_property_index: return "DW_AT_BORLAND_property_index"; |
| 205 | case DW_AT_BORLAND_property_default: return "DW_AT_BORLAND_property_default"; |
| 206 | case DW_AT_BORLAND_Delphi_unit: return "DW_AT_BORLAND_Delphi_unit"; |
| 207 | case DW_AT_BORLAND_Delphi_class: return "DW_AT_BORLAND_Delphi_class"; |
| 208 | case DW_AT_BORLAND_Delphi_record: return "DW_AT_BORLAND_Delphi_record"; |
| 209 | case DW_AT_BORLAND_Delphi_metaclass: return "DW_AT_BORLAND_Delphi_metaclass"; |
| 210 | case DW_AT_BORLAND_Delphi_constructor: return "DW_AT_BORLAND_Delphi_constructor"; |
| 211 | case DW_AT_BORLAND_Delphi_destructor: return "DW_AT_BORLAND_Delphi_destructor"; |
| 212 | case DW_AT_BORLAND_Delphi_anonymous_method: return "DW_AT_BORLAND_Delphi_anonymous_method"; |
| 213 | case DW_AT_BORLAND_Delphi_interface: return "DW_AT_BORLAND_Delphi_interface"; |
| 214 | case DW_AT_BORLAND_Delphi_ABI: return "DW_AT_BORLAND_Delphi_ABI"; |
| 215 | case DW_AT_BORLAND_Delphi_return: return "DW_AT_BORLAND_Delphi_return"; |
| 216 | case DW_AT_BORLAND_Delphi_frameptr: return "DW_AT_BORLAND_Delphi_frameptr"; |
| 217 | case DW_AT_BORLAND_closure: return "DW_AT_BORLAND_closure"; |
Chris Lattner | 0709a27 | 2009-12-29 21:09:57 +0000 | [diff] [blame] | 218 | case DW_AT_APPLE_optimized: return "DW_AT_APPLE_optimized"; |
| 219 | case DW_AT_APPLE_flags: return "DW_AT_APPLE_flags"; |
| 220 | case DW_AT_APPLE_isa: return "DW_AT_APPLE_isa"; |
| 221 | case DW_AT_APPLE_block: return "DW_AT_APPLE_block"; |
Devang Patel | 6188093 | 2010-04-19 19:14:02 +0000 | [diff] [blame] | 222 | case DW_AT_APPLE_major_runtime_vers: return "DW_AT_APPLE_major_runtime_vers"; |
Chris Lattner | 0709a27 | 2009-12-29 21:09:57 +0000 | [diff] [blame] | 223 | case DW_AT_APPLE_runtime_class: return "DW_AT_APPLE_runtime_class"; |
Devang Patel | 561fa849 | 2010-04-19 20:31:39 +0000 | [diff] [blame] | 224 | case DW_AT_APPLE_omit_frame_ptr: return "DW_AT_APPLE_omit_frame_ptr"; |
Devang Patel | 514b400 | 2011-04-16 00:11:51 +0000 | [diff] [blame] | 225 | case DW_AT_APPLE_property_name: return "DW_AT_APPLE_property_name"; |
| 226 | case DW_AT_APPLE_property_getter: return "DW_AT_APPLE_property_getter"; |
| 227 | case DW_AT_APPLE_property_setter: return "DW_AT_APPLE_property_setter"; |
| 228 | case DW_AT_APPLE_property_attribute: return "DW_AT_APPLE_property_attribute"; |
Devang Patel | 839515b | 2012-02-03 23:57:08 +0000 | [diff] [blame] | 229 | case DW_AT_APPLE_property: return "DW_AT_APPLE_property"; |
Devang Patel | 12419ae | 2011-05-12 21:29:42 +0000 | [diff] [blame] | 230 | case DW_AT_APPLE_objc_complete_type: return "DW_AT_APPLE_objc_complete_type"; |
Adrian Prantl | 08a388b | 2015-06-30 02:13:04 +0000 | [diff] [blame] | 231 | case DW_AT_LLVM_include_path: return "DW_AT_LLVM_include_path"; |
| 232 | case DW_AT_LLVM_config_macros: return "DW_AT_LLVM_config_macros"; |
| 233 | case DW_AT_LLVM_isysroot: return "DW_AT_LLVM_isysroot"; |
Eric Christopher | c7e43ff | 2012-11-30 23:20:43 +0000 | [diff] [blame] | 234 | |
Bill Wendling | 3d7b0b8 | 2012-12-19 07:18:57 +0000 | [diff] [blame] | 235 | // DWARF5 Fission Extension Attribute |
Eric Christopher | c7e43ff | 2012-11-30 23:20:43 +0000 | [diff] [blame] | 236 | case DW_AT_GNU_dwo_name: return "DW_AT_GNU_dwo_name"; |
| 237 | case DW_AT_GNU_dwo_id: return "DW_AT_GNU_dwo_id"; |
| 238 | case DW_AT_GNU_ranges_base: return "DW_AT_GNU_ranges_base"; |
| 239 | case DW_AT_GNU_addr_base: return "DW_AT_GNU_addr_base"; |
| 240 | case DW_AT_GNU_pubnames: return "DW_AT_GNU_pubnames"; |
| 241 | case DW_AT_GNU_pubtypes: return "DW_AT_GNU_pubtypes"; |
Dehao Chen | 72fdf44 | 2015-11-11 18:08:18 +0000 | [diff] [blame] | 242 | case DW_AT_GNU_discriminator: return "DW_AT_GNU_discriminator"; |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 243 | } |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 244 | return StringRef(); |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 245 | } |
| 246 | |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 247 | StringRef llvm::dwarf::FormEncodingString(unsigned Encoding) { |
Mike Stump | 889285d | 2009-05-13 23:23:20 +0000 | [diff] [blame] | 248 | switch (Encoding) { |
Jason Molenda | dd6a4ca | 2010-06-17 01:23:24 +0000 | [diff] [blame] | 249 | case DW_FORM_addr: return "DW_FORM_addr"; |
| 250 | case DW_FORM_block2: return "DW_FORM_block2"; |
| 251 | case DW_FORM_block4: return "DW_FORM_block4"; |
| 252 | case DW_FORM_data2: return "DW_FORM_data2"; |
| 253 | case DW_FORM_data4: return "DW_FORM_data4"; |
| 254 | case DW_FORM_data8: return "DW_FORM_data8"; |
| 255 | case DW_FORM_string: return "DW_FORM_string"; |
| 256 | case DW_FORM_block: return "DW_FORM_block"; |
| 257 | case DW_FORM_block1: return "DW_FORM_block1"; |
| 258 | case DW_FORM_data1: return "DW_FORM_data1"; |
| 259 | case DW_FORM_flag: return "DW_FORM_flag"; |
| 260 | case DW_FORM_sdata: return "DW_FORM_sdata"; |
| 261 | case DW_FORM_strp: return "DW_FORM_strp"; |
| 262 | case DW_FORM_udata: return "DW_FORM_udata"; |
| 263 | case DW_FORM_ref_addr: return "DW_FORM_ref_addr"; |
| 264 | case DW_FORM_ref1: return "DW_FORM_ref1"; |
| 265 | case DW_FORM_ref2: return "DW_FORM_ref2"; |
| 266 | case DW_FORM_ref4: return "DW_FORM_ref4"; |
| 267 | case DW_FORM_ref8: return "DW_FORM_ref8"; |
| 268 | case DW_FORM_ref_udata: return "DW_FORM_ref_udata"; |
| 269 | case DW_FORM_indirect: return "DW_FORM_indirect"; |
Nick Lewycky | 3436812 | 2011-09-15 04:23:44 +0000 | [diff] [blame] | 270 | case DW_FORM_sec_offset: return "DW_FORM_sec_offset"; |
| 271 | case DW_FORM_exprloc: return "DW_FORM_exprloc"; |
| 272 | case DW_FORM_flag_present: return "DW_FORM_flag_present"; |
| 273 | case DW_FORM_ref_sig8: return "DW_FORM_ref_sig8"; |
Eric Christopher | c7e43ff | 2012-11-30 23:20:43 +0000 | [diff] [blame] | 274 | |
| 275 | // DWARF5 Fission Extension Forms |
| 276 | case DW_FORM_GNU_addr_index: return "DW_FORM_GNU_addr_index"; |
| 277 | case DW_FORM_GNU_str_index: return "DW_FORM_GNU_str_index"; |
Alexey Samsonov | bf19a57 | 2015-05-19 20:29:28 +0000 | [diff] [blame] | 278 | |
| 279 | // Alternate debug sections proposal (output of "dwz" tool). |
| 280 | case DW_FORM_GNU_ref_alt: return "DW_FORM_GNU_ref_alt"; |
| 281 | case DW_FORM_GNU_strp_alt: return "DW_FORM_GNU_strp_alt"; |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 282 | } |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 283 | return StringRef(); |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 284 | } |
| 285 | |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 286 | StringRef llvm::dwarf::OperationEncodingString(unsigned Encoding) { |
Mike Stump | 889285d | 2009-05-13 23:23:20 +0000 | [diff] [blame] | 287 | switch (Encoding) { |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 288 | default: |
| 289 | return StringRef(); |
Duncan P. N. Exon Smith | 8f46ee6 | 2015-02-13 01:04:08 +0000 | [diff] [blame] | 290 | #define HANDLE_DW_OP(ID, NAME) \ |
| 291 | case DW_OP_##NAME: \ |
| 292 | return "DW_OP_" #NAME; |
| 293 | #include "llvm/Support/Dwarf.def" |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 294 | } |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 295 | } |
| 296 | |
Duncan P. N. Exon Smith | 3b631d2 | 2015-02-13 01:05:00 +0000 | [diff] [blame] | 297 | unsigned llvm::dwarf::getOperationEncoding(StringRef OperationEncodingString) { |
| 298 | return StringSwitch<unsigned>(OperationEncodingString) |
| 299 | #define HANDLE_DW_OP(ID, NAME) .Case("DW_OP_" #NAME, DW_OP_##NAME) |
| 300 | #include "llvm/Support/Dwarf.def" |
| 301 | .Default(0); |
| 302 | } |
| 303 | |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 304 | StringRef llvm::dwarf::AttributeEncodingString(unsigned Encoding) { |
Mike Stump | 889285d | 2009-05-13 23:23:20 +0000 | [diff] [blame] | 305 | switch (Encoding) { |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 306 | default: |
| 307 | return StringRef(); |
Duncan P. N. Exon Smith | dd563dd | 2015-02-06 23:45:37 +0000 | [diff] [blame] | 308 | #define HANDLE_DW_ATE(ID, NAME) \ |
| 309 | case DW_ATE_##NAME: \ |
| 310 | return "DW_ATE_" #NAME; |
| 311 | #include "llvm/Support/Dwarf.def" |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 312 | } |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 313 | } |
| 314 | |
Duncan P. N. Exon Smith | e07f13a | 2015-02-06 23:46:49 +0000 | [diff] [blame] | 315 | unsigned llvm::dwarf::getAttributeEncoding(StringRef EncodingString) { |
| 316 | return StringSwitch<unsigned>(EncodingString) |
| 317 | #define HANDLE_DW_ATE(ID, NAME) .Case("DW_ATE_" #NAME, DW_ATE_##NAME) |
| 318 | #include "llvm/Support/Dwarf.def" |
| 319 | .Default(0); |
| 320 | } |
| 321 | |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 322 | StringRef llvm::dwarf::DecimalSignString(unsigned Sign) { |
Mike Stump | 889285d | 2009-05-13 23:23:20 +0000 | [diff] [blame] | 323 | switch (Sign) { |
Jason Molenda | dd6a4ca | 2010-06-17 01:23:24 +0000 | [diff] [blame] | 324 | case DW_DS_unsigned: return "DW_DS_unsigned"; |
| 325 | case DW_DS_leading_overpunch: return "DW_DS_leading_overpunch"; |
| 326 | case DW_DS_trailing_overpunch: return "DW_DS_trailing_overpunch"; |
| 327 | case DW_DS_leading_separate: return "DW_DS_leading_separate"; |
| 328 | case DW_DS_trailing_separate: return "DW_DS_trailing_separate"; |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 329 | } |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 330 | return StringRef(); |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 331 | } |
| 332 | |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 333 | StringRef llvm::dwarf::EndianityString(unsigned Endian) { |
Mike Stump | 889285d | 2009-05-13 23:23:20 +0000 | [diff] [blame] | 334 | switch (Endian) { |
Jason Molenda | dd6a4ca | 2010-06-17 01:23:24 +0000 | [diff] [blame] | 335 | case DW_END_default: return "DW_END_default"; |
| 336 | case DW_END_big: return "DW_END_big"; |
| 337 | case DW_END_little: return "DW_END_little"; |
| 338 | case DW_END_lo_user: return "DW_END_lo_user"; |
| 339 | case DW_END_hi_user: return "DW_END_hi_user"; |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 340 | } |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 341 | return StringRef(); |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 342 | } |
| 343 | |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 344 | StringRef llvm::dwarf::AccessibilityString(unsigned Access) { |
Mike Stump | 889285d | 2009-05-13 23:23:20 +0000 | [diff] [blame] | 345 | switch (Access) { |
Chris Lattner | 0709a27 | 2009-12-29 21:09:57 +0000 | [diff] [blame] | 346 | // Accessibility codes |
Jason Molenda | dd6a4ca | 2010-06-17 01:23:24 +0000 | [diff] [blame] | 347 | case DW_ACCESS_public: return "DW_ACCESS_public"; |
| 348 | case DW_ACCESS_protected: return "DW_ACCESS_protected"; |
| 349 | case DW_ACCESS_private: return "DW_ACCESS_private"; |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 350 | } |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 351 | return StringRef(); |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 352 | } |
| 353 | |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 354 | StringRef llvm::dwarf::VisibilityString(unsigned Visibility) { |
Mike Stump | 889285d | 2009-05-13 23:23:20 +0000 | [diff] [blame] | 355 | switch (Visibility) { |
Jason Molenda | dd6a4ca | 2010-06-17 01:23:24 +0000 | [diff] [blame] | 356 | case DW_VIS_local: return "DW_VIS_local"; |
| 357 | case DW_VIS_exported: return "DW_VIS_exported"; |
| 358 | case DW_VIS_qualified: return "DW_VIS_qualified"; |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 359 | } |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 360 | return StringRef(); |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 361 | } |
| 362 | |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 363 | StringRef llvm::dwarf::VirtualityString(unsigned Virtuality) { |
Mike Stump | 889285d | 2009-05-13 23:23:20 +0000 | [diff] [blame] | 364 | switch (Virtuality) { |
Duncan P. N. Exon Smith | d6f3574 | 2015-02-07 00:36:23 +0000 | [diff] [blame] | 365 | default: |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 366 | return StringRef(); |
Duncan P. N. Exon Smith | d6f3574 | 2015-02-07 00:36:23 +0000 | [diff] [blame] | 367 | #define HANDLE_DW_VIRTUALITY(ID, NAME) \ |
| 368 | case DW_VIRTUALITY_##NAME: \ |
| 369 | return "DW_VIRTUALITY_" #NAME; |
| 370 | #include "llvm/Support/Dwarf.def" |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 371 | } |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 372 | } |
| 373 | |
Duncan P. N. Exon Smith | e7e2abe | 2015-02-07 00:37:15 +0000 | [diff] [blame] | 374 | unsigned llvm::dwarf::getVirtuality(StringRef VirtualityString) { |
| 375 | return StringSwitch<unsigned>(VirtualityString) |
| 376 | #define HANDLE_DW_VIRTUALITY(ID, NAME) \ |
| 377 | .Case("DW_VIRTUALITY_" #NAME, DW_VIRTUALITY_##NAME) |
| 378 | #include "llvm/Support/Dwarf.def" |
| 379 | .Default(DW_VIRTUALITY_invalid); |
| 380 | } |
| 381 | |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 382 | StringRef llvm::dwarf::LanguageString(unsigned Language) { |
Mike Stump | 889285d | 2009-05-13 23:23:20 +0000 | [diff] [blame] | 383 | switch (Language) { |
Duncan P. N. Exon Smith | 0317944 | 2015-02-06 22:53:19 +0000 | [diff] [blame] | 384 | default: |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 385 | return StringRef(); |
Duncan P. N. Exon Smith | 0317944 | 2015-02-06 22:53:19 +0000 | [diff] [blame] | 386 | #define HANDLE_DW_LANG(ID, NAME) \ |
| 387 | case DW_LANG_##NAME: \ |
| 388 | return "DW_LANG_" #NAME; |
| 389 | #include "llvm/Support/Dwarf.def" |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 390 | } |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 391 | } |
| 392 | |
Duncan P. N. Exon Smith | d40af00 | 2015-02-06 22:55:13 +0000 | [diff] [blame] | 393 | unsigned llvm::dwarf::getLanguage(StringRef LanguageString) { |
| 394 | return StringSwitch<unsigned>(LanguageString) |
| 395 | #define HANDLE_DW_LANG(ID, NAME) .Case("DW_LANG_" #NAME, DW_LANG_##NAME) |
| 396 | #include "llvm/Support/Dwarf.def" |
| 397 | .Default(0); |
| 398 | } |
| 399 | |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 400 | StringRef llvm::dwarf::CaseString(unsigned Case) { |
Chris Lattner | 0709a27 | 2009-12-29 21:09:57 +0000 | [diff] [blame] | 401 | switch (Case) { |
Jason Molenda | dd6a4ca | 2010-06-17 01:23:24 +0000 | [diff] [blame] | 402 | case DW_ID_case_sensitive: return "DW_ID_case_sensitive"; |
| 403 | case DW_ID_up_case: return "DW_ID_up_case"; |
| 404 | case DW_ID_down_case: return "DW_ID_down_case"; |
| 405 | case DW_ID_case_insensitive: return "DW_ID_case_insensitive"; |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 406 | } |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 407 | return StringRef(); |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 408 | } |
| 409 | |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 410 | StringRef llvm::dwarf::ConventionString(unsigned CC) { |
Reid Kleckner | de3d8b5 | 2016-06-08 20:34:29 +0000 | [diff] [blame] | 411 | switch (CC) { |
| 412 | default: |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 413 | return StringRef(); |
Reid Kleckner | de3d8b5 | 2016-06-08 20:34:29 +0000 | [diff] [blame] | 414 | #define HANDLE_DW_CC(ID, NAME) \ |
| 415 | case DW_CC_##NAME: \ |
| 416 | return "DW_CC_" #NAME; |
| 417 | #include "llvm/Support/Dwarf.def" |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 418 | } |
Reid Kleckner | de3d8b5 | 2016-06-08 20:34:29 +0000 | [diff] [blame] | 419 | } |
| 420 | |
| 421 | unsigned llvm::dwarf::getCallingConvention(StringRef CCString) { |
| 422 | return StringSwitch<unsigned>(CCString) |
| 423 | #define HANDLE_DW_CC(ID, NAME) .Case("DW_CC_" #NAME, DW_CC_##NAME) |
| 424 | #include "llvm/Support/Dwarf.def" |
| 425 | .Default(0); |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 426 | } |
| 427 | |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 428 | StringRef llvm::dwarf::InlineCodeString(unsigned Code) { |
Chris Lattner | 0709a27 | 2009-12-29 21:09:57 +0000 | [diff] [blame] | 429 | switch (Code) { |
Jason Molenda | dd6a4ca | 2010-06-17 01:23:24 +0000 | [diff] [blame] | 430 | case DW_INL_not_inlined: return "DW_INL_not_inlined"; |
| 431 | case DW_INL_inlined: return "DW_INL_inlined"; |
| 432 | case DW_INL_declared_not_inlined: return "DW_INL_declared_not_inlined"; |
| 433 | case DW_INL_declared_inlined: return "DW_INL_declared_inlined"; |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 434 | } |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 435 | return StringRef(); |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 436 | } |
| 437 | |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 438 | StringRef llvm::dwarf::ArrayOrderString(unsigned Order) { |
Chris Lattner | 0709a27 | 2009-12-29 21:09:57 +0000 | [diff] [blame] | 439 | switch (Order) { |
Jason Molenda | dd6a4ca | 2010-06-17 01:23:24 +0000 | [diff] [blame] | 440 | case DW_ORD_row_major: return "DW_ORD_row_major"; |
| 441 | case DW_ORD_col_major: return "DW_ORD_col_major"; |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 442 | } |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 443 | return StringRef(); |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 444 | } |
| 445 | |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 446 | StringRef llvm::dwarf::DiscriminantString(unsigned Discriminant) { |
Chris Lattner | 0709a27 | 2009-12-29 21:09:57 +0000 | [diff] [blame] | 447 | switch (Discriminant) { |
Jason Molenda | dd6a4ca | 2010-06-17 01:23:24 +0000 | [diff] [blame] | 448 | case DW_DSC_label: return "DW_DSC_label"; |
| 449 | case DW_DSC_range: return "DW_DSC_range"; |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 450 | } |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 451 | return StringRef(); |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 452 | } |
| 453 | |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 454 | StringRef llvm::dwarf::LNStandardString(unsigned Standard) { |
Chris Lattner | 0709a27 | 2009-12-29 21:09:57 +0000 | [diff] [blame] | 455 | switch (Standard) { |
Jason Molenda | dd6a4ca | 2010-06-17 01:23:24 +0000 | [diff] [blame] | 456 | case DW_LNS_copy: return "DW_LNS_copy"; |
| 457 | case DW_LNS_advance_pc: return "DW_LNS_advance_pc"; |
| 458 | case DW_LNS_advance_line: return "DW_LNS_advance_line"; |
| 459 | case DW_LNS_set_file: return "DW_LNS_set_file"; |
| 460 | case DW_LNS_set_column: return "DW_LNS_set_column"; |
| 461 | case DW_LNS_negate_stmt: return "DW_LNS_negate_stmt"; |
| 462 | case DW_LNS_set_basic_block: return "DW_LNS_set_basic_block"; |
| 463 | case DW_LNS_const_add_pc: return "DW_LNS_const_add_pc"; |
| 464 | case DW_LNS_fixed_advance_pc: return "DW_LNS_fixed_advance_pc"; |
| 465 | case DW_LNS_set_prologue_end: return "DW_LNS_set_prologue_end"; |
| 466 | case DW_LNS_set_epilogue_begin: return "DW_LNS_set_epilogue_begin"; |
| 467 | case DW_LNS_set_isa: return "DW_LNS_set_isa"; |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 468 | } |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 469 | return StringRef(); |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 470 | } |
| 471 | |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 472 | StringRef llvm::dwarf::LNExtendedString(unsigned Encoding) { |
Chris Lattner | 0709a27 | 2009-12-29 21:09:57 +0000 | [diff] [blame] | 473 | switch (Encoding) { |
| 474 | // Line Number Extended Opcode Encodings |
Jason Molenda | dd6a4ca | 2010-06-17 01:23:24 +0000 | [diff] [blame] | 475 | case DW_LNE_end_sequence: return "DW_LNE_end_sequence"; |
| 476 | case DW_LNE_set_address: return "DW_LNE_set_address"; |
| 477 | case DW_LNE_define_file: return "DW_LNE_define_file"; |
Nick Lewycky | 3436812 | 2011-09-15 04:23:44 +0000 | [diff] [blame] | 478 | case DW_LNE_set_discriminator: return "DW_LNE_set_discriminator"; |
Jason Molenda | dd6a4ca | 2010-06-17 01:23:24 +0000 | [diff] [blame] | 479 | case DW_LNE_lo_user: return "DW_LNE_lo_user"; |
| 480 | case DW_LNE_hi_user: return "DW_LNE_hi_user"; |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 481 | } |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 482 | return StringRef(); |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 483 | } |
| 484 | |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 485 | StringRef llvm::dwarf::MacinfoString(unsigned Encoding) { |
Chris Lattner | 0709a27 | 2009-12-29 21:09:57 +0000 | [diff] [blame] | 486 | switch (Encoding) { |
| 487 | // Macinfo Type Encodings |
Jason Molenda | dd6a4ca | 2010-06-17 01:23:24 +0000 | [diff] [blame] | 488 | case DW_MACINFO_define: return "DW_MACINFO_define"; |
| 489 | case DW_MACINFO_undef: return "DW_MACINFO_undef"; |
| 490 | case DW_MACINFO_start_file: return "DW_MACINFO_start_file"; |
| 491 | case DW_MACINFO_end_file: return "DW_MACINFO_end_file"; |
| 492 | case DW_MACINFO_vendor_ext: return "DW_MACINFO_vendor_ext"; |
Amjad Aboud | e59cc3e | 2015-11-12 09:38:54 +0000 | [diff] [blame] | 493 | case DW_MACINFO_invalid: return "DW_MACINFO_invalid"; |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 494 | } |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 495 | return StringRef(); |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 496 | } |
| 497 | |
Amjad Aboud | a9bcf16 | 2015-12-10 12:56:35 +0000 | [diff] [blame] | 498 | unsigned llvm::dwarf::getMacinfo(StringRef MacinfoString) { |
| 499 | return StringSwitch<unsigned>(MacinfoString) |
| 500 | .Case("DW_MACINFO_define", DW_MACINFO_define) |
| 501 | .Case("DW_MACINFO_undef", DW_MACINFO_undef) |
| 502 | .Case("DW_MACINFO_start_file", DW_MACINFO_start_file) |
| 503 | .Case("DW_MACINFO_end_file", DW_MACINFO_end_file) |
| 504 | .Case("DW_MACINFO_vendor_ext", DW_MACINFO_vendor_ext) |
| 505 | .Default(DW_MACINFO_invalid); |
| 506 | } |
| 507 | |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 508 | StringRef llvm::dwarf::CallFrameString(unsigned Encoding) { |
Chris Lattner | 0709a27 | 2009-12-29 21:09:57 +0000 | [diff] [blame] | 509 | switch (Encoding) { |
Eli Bendersky | 705085d | 2013-02-21 22:53:19 +0000 | [diff] [blame] | 510 | case DW_CFA_nop: return "DW_CFA_nop"; |
Jason Molenda | dd6a4ca | 2010-06-17 01:23:24 +0000 | [diff] [blame] | 511 | case DW_CFA_advance_loc: return "DW_CFA_advance_loc"; |
| 512 | case DW_CFA_offset: return "DW_CFA_offset"; |
| 513 | case DW_CFA_restore: return "DW_CFA_restore"; |
| 514 | case DW_CFA_set_loc: return "DW_CFA_set_loc"; |
| 515 | case DW_CFA_advance_loc1: return "DW_CFA_advance_loc1"; |
| 516 | case DW_CFA_advance_loc2: return "DW_CFA_advance_loc2"; |
| 517 | case DW_CFA_advance_loc4: return "DW_CFA_advance_loc4"; |
| 518 | case DW_CFA_offset_extended: return "DW_CFA_offset_extended"; |
| 519 | case DW_CFA_restore_extended: return "DW_CFA_restore_extended"; |
| 520 | case DW_CFA_undefined: return "DW_CFA_undefined"; |
| 521 | case DW_CFA_same_value: return "DW_CFA_same_value"; |
| 522 | case DW_CFA_register: return "DW_CFA_register"; |
| 523 | case DW_CFA_remember_state: return "DW_CFA_remember_state"; |
| 524 | case DW_CFA_restore_state: return "DW_CFA_restore_state"; |
| 525 | case DW_CFA_def_cfa: return "DW_CFA_def_cfa"; |
| 526 | case DW_CFA_def_cfa_register: return "DW_CFA_def_cfa_register"; |
| 527 | case DW_CFA_def_cfa_offset: return "DW_CFA_def_cfa_offset"; |
| 528 | case DW_CFA_def_cfa_expression: return "DW_CFA_def_cfa_expression"; |
| 529 | case DW_CFA_expression: return "DW_CFA_expression"; |
| 530 | case DW_CFA_offset_extended_sf: return "DW_CFA_offset_extended_sf"; |
| 531 | case DW_CFA_def_cfa_sf: return "DW_CFA_def_cfa_sf"; |
| 532 | case DW_CFA_def_cfa_offset_sf: return "DW_CFA_def_cfa_offset_sf"; |
| 533 | case DW_CFA_val_offset: return "DW_CFA_val_offset"; |
| 534 | case DW_CFA_val_offset_sf: return "DW_CFA_val_offset_sf"; |
| 535 | case DW_CFA_val_expression: return "DW_CFA_val_expression"; |
Nick Lewycky | ee674b3 | 2011-09-15 05:21:03 +0000 | [diff] [blame] | 536 | case DW_CFA_MIPS_advance_loc8: return "DW_CFA_MIPS_advance_loc8"; |
| 537 | case DW_CFA_GNU_window_save: return "DW_CFA_GNU_window_save"; |
| 538 | case DW_CFA_GNU_args_size: return "DW_CFA_GNU_args_size"; |
Jason Molenda | dd6a4ca | 2010-06-17 01:23:24 +0000 | [diff] [blame] | 539 | case DW_CFA_lo_user: return "DW_CFA_lo_user"; |
| 540 | case DW_CFA_hi_user: return "DW_CFA_hi_user"; |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 541 | } |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 542 | return StringRef(); |
Jim Laskey | 22e47b9 | 2006-02-27 12:43:29 +0000 | [diff] [blame] | 543 | } |
Eric Christopher | cf7289f | 2013-09-05 18:20:16 +0000 | [diff] [blame] | 544 | |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 545 | StringRef llvm::dwarf::ApplePropertyString(unsigned Prop) { |
Frederic Riss | b5e53ee | 2014-10-09 20:43:04 +0000 | [diff] [blame] | 546 | switch (Prop) { |
| 547 | case DW_APPLE_PROPERTY_readonly: |
| 548 | return "DW_APPLE_PROPERTY_readonly"; |
| 549 | case DW_APPLE_PROPERTY_getter: |
| 550 | return "DW_APPLE_PROPERTY_getter"; |
| 551 | case DW_APPLE_PROPERTY_assign: |
| 552 | return "DW_APPLE_PROPERTY_assign"; |
| 553 | case DW_APPLE_PROPERTY_readwrite: |
| 554 | return "DW_APPLE_PROPERTY_readwrite"; |
| 555 | case DW_APPLE_PROPERTY_retain: |
| 556 | return "DW_APPLE_PROPERTY_retain"; |
| 557 | case DW_APPLE_PROPERTY_copy: |
| 558 | return "DW_APPLE_PROPERTY_copy"; |
| 559 | case DW_APPLE_PROPERTY_nonatomic: |
| 560 | return "DW_APPLE_PROPERTY_nonatomic"; |
| 561 | case DW_APPLE_PROPERTY_setter: |
| 562 | return "DW_APPLE_PROPERTY_setter"; |
| 563 | case DW_APPLE_PROPERTY_atomic: |
| 564 | return "DW_APPLE_PROPERTY_atomic"; |
| 565 | case DW_APPLE_PROPERTY_weak: |
| 566 | return "DW_APPLE_PROPERTY_weak"; |
| 567 | case DW_APPLE_PROPERTY_strong: |
| 568 | return "DW_APPLE_PROPERTY_strong"; |
| 569 | case DW_APPLE_PROPERTY_unsafe_unretained: |
| 570 | return "DW_APPLE_PROPERTY_unsafe_unretained"; |
Adrian Prantl | 0418ef2 | 2016-07-14 00:41:18 +0000 | [diff] [blame] | 571 | case DW_APPLE_PROPERTY_nullability: |
| 572 | return "DW_APPLE_PROPERTY_nullability"; |
| 573 | case DW_APPLE_PROPERTY_null_resettable: |
| 574 | return "DW_APPLE_PROPERTY_null_resettable"; |
| 575 | case DW_APPLE_PROPERTY_class: |
| 576 | return "DW_APPLE_PROPERTY_class"; |
Frederic Riss | b5e53ee | 2014-10-09 20:43:04 +0000 | [diff] [blame] | 577 | } |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 578 | return StringRef(); |
Frederic Riss | b5e53ee | 2014-10-09 20:43:04 +0000 | [diff] [blame] | 579 | } |
| 580 | |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 581 | StringRef llvm::dwarf::AtomTypeString(unsigned AT) { |
Eric Christopher | cf7289f | 2013-09-05 18:20:16 +0000 | [diff] [blame] | 582 | switch (AT) { |
| 583 | case dwarf::DW_ATOM_null: |
| 584 | return "DW_ATOM_null"; |
| 585 | case dwarf::DW_ATOM_die_offset: |
| 586 | return "DW_ATOM_die_offset"; |
| 587 | case DW_ATOM_cu_offset: |
| 588 | return "DW_ATOM_cu_offset"; |
| 589 | case DW_ATOM_die_tag: |
| 590 | return "DW_ATOM_die_tag"; |
| 591 | case DW_ATOM_type_flags: |
| 592 | return "DW_ATOM_type_flags"; |
| 593 | } |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 594 | return StringRef(); |
Eric Christopher | cf7289f | 2013-09-05 18:20:16 +0000 | [diff] [blame] | 595 | } |
David Blaikie | d0a869d | 2013-09-19 22:19:37 +0000 | [diff] [blame] | 596 | |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 597 | StringRef llvm::dwarf::GDBIndexEntryKindString(GDBIndexEntryKind Kind) { |
David Blaikie | d0a869d | 2013-09-19 22:19:37 +0000 | [diff] [blame] | 598 | switch (Kind) { |
| 599 | case GIEK_NONE: |
| 600 | return "NONE"; |
| 601 | case GIEK_TYPE: |
| 602 | return "TYPE"; |
| 603 | case GIEK_VARIABLE: |
| 604 | return "VARIABLE"; |
| 605 | case GIEK_FUNCTION: |
| 606 | return "FUNCTION"; |
| 607 | case GIEK_OTHER: |
| 608 | return "OTHER"; |
| 609 | case GIEK_UNUSED5: |
| 610 | return "UNUSED5"; |
| 611 | case GIEK_UNUSED6: |
| 612 | return "UNUSED6"; |
| 613 | case GIEK_UNUSED7: |
| 614 | return "UNUSED7"; |
| 615 | } |
| 616 | llvm_unreachable("Unknown GDBIndexEntryKind value"); |
| 617 | } |
| 618 | |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 619 | StringRef |
| 620 | llvm::dwarf::GDBIndexEntryLinkageString(GDBIndexEntryLinkage Linkage) { |
David Blaikie | d0a869d | 2013-09-19 22:19:37 +0000 | [diff] [blame] | 621 | switch (Linkage) { |
| 622 | case GIEL_EXTERNAL: |
| 623 | return "EXTERNAL"; |
| 624 | case GIEL_STATIC: |
| 625 | return "STATIC"; |
| 626 | } |
| 627 | llvm_unreachable("Unknown GDBIndexEntryLinkage value"); |
| 628 | } |
Frederic Riss | 878065b | 2014-09-04 19:39:20 +0000 | [diff] [blame] | 629 | |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 630 | StringRef llvm::dwarf::AttributeValueString(uint16_t Attr, unsigned Val) { |
Frederic Riss | 878065b | 2014-09-04 19:39:20 +0000 | [diff] [blame] | 631 | switch (Attr) { |
| 632 | case DW_AT_accessibility: |
| 633 | return AccessibilityString(Val); |
| 634 | case DW_AT_virtuality: |
| 635 | return VirtualityString(Val); |
| 636 | case DW_AT_language: |
| 637 | return LanguageString(Val); |
| 638 | case DW_AT_encoding: |
| 639 | return AttributeEncodingString(Val); |
| 640 | case DW_AT_decimal_sign: |
| 641 | return DecimalSignString(Val); |
| 642 | case DW_AT_endianity: |
| 643 | return EndianityString(Val); |
| 644 | case DW_AT_visibility: |
| 645 | return VisibilityString(Val); |
| 646 | case DW_AT_identifier_case: |
| 647 | return CaseString(Val); |
| 648 | case DW_AT_calling_convention: |
| 649 | return ConventionString(Val); |
| 650 | case DW_AT_inline: |
| 651 | return InlineCodeString(Val); |
| 652 | case DW_AT_ordering: |
| 653 | return ArrayOrderString(Val); |
| 654 | case DW_AT_discr_value: |
| 655 | return DiscriminantString(Val); |
| 656 | } |
| 657 | |
Mehdi Amini | 149f6ea | 2016-10-05 05:59:29 +0000 | [diff] [blame] | 658 | return StringRef(); |
Frederic Riss | 878065b | 2014-09-04 19:39:20 +0000 | [diff] [blame] | 659 | } |