xref: /NextBSD/contrib/llvm/tools/lldb/source/Utility/ConvertEnum.cpp (revision 84d351007654069f9643c8e4b4802a7f5f08ee42)
1 //===-- ConvertEnum.cpp -----------------------------------------*- 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 #include "lldb/Utility/ConvertEnum.h"
10 
11 using namespace lldb;
12 using namespace lldb_private;
13 
14 const char *
GetVoteAsCString(Vote vote)15 lldb_private::GetVoteAsCString(Vote vote)
16 {
17     switch (vote)
18     {
19         case eVoteNo:
20             return "no";
21         case eVoteNoOpinion:
22             return "no opinion";
23         case eVoteYes:
24             return "yes";
25     }
26     return "invalid";
27 }
28 
29 const char *
GetSectionTypeAsCString(lldb::SectionType sect_type)30 lldb_private::GetSectionTypeAsCString(lldb::SectionType sect_type)
31 {
32     switch (sect_type)
33     {
34         case eSectionTypeInvalid:
35             return "invalid";
36         case eSectionTypeCode:
37             return "code";
38         case eSectionTypeContainer:
39             return "container";
40         case eSectionTypeData:
41             return "data";
42         case eSectionTypeDataCString:
43             return "data-cstr";
44         case eSectionTypeDataCStringPointers:
45             return "data-cstr-ptr";
46         case eSectionTypeDataSymbolAddress:
47             return "data-symbol-addr";
48         case eSectionTypeData4:
49             return "data-4-byte";
50         case eSectionTypeData8:
51             return "data-8-byte";
52         case eSectionTypeData16:
53             return "data-16-byte";
54         case eSectionTypeDataPointers:
55             return "data-ptrs";
56         case eSectionTypeDebug:
57             return "debug";
58         case eSectionTypeZeroFill:
59             return "zero-fill";
60         case eSectionTypeDataObjCMessageRefs:
61             return "objc-message-refs";
62         case eSectionTypeDataObjCCFStrings:
63             return "objc-cfstrings";
64         case eSectionTypeDWARFDebugAbbrev:
65             return "dwarf-abbrev";
66         case eSectionTypeDWARFDebugAranges:
67             return "dwarf-aranges";
68         case eSectionTypeDWARFDebugFrame:
69             return "dwarf-frame";
70         case eSectionTypeDWARFDebugInfo:
71             return "dwarf-info";
72         case eSectionTypeDWARFDebugLine:
73             return "dwarf-line";
74         case eSectionTypeDWARFDebugLoc:
75             return "dwarf-loc";
76         case eSectionTypeDWARFDebugMacInfo:
77             return "dwarf-macinfo";
78         case eSectionTypeDWARFDebugPubNames:
79             return "dwarf-pubnames";
80         case eSectionTypeDWARFDebugPubTypes:
81             return "dwarf-pubtypes";
82         case eSectionTypeDWARFDebugRanges:
83             return "dwarf-ranges";
84         case eSectionTypeDWARFDebugStr:
85             return "dwarf-str";
86         case eSectionTypeELFSymbolTable:
87             return "elf-symbol-table";
88         case eSectionTypeELFDynamicSymbols:
89             return "elf-dynamic-symbols";
90         case eSectionTypeELFRelocationEntries:
91             return "elf-relocation-entries";
92         case eSectionTypeELFDynamicLinkInfo:
93             return "elf-dynamic-link-info";
94         case eSectionTypeDWARFAppleNames:
95             return "apple-names";
96         case eSectionTypeDWARFAppleTypes:
97             return "apple-types";
98         case eSectionTypeDWARFAppleNamespaces:
99             return "apple-namespaces";
100         case eSectionTypeDWARFAppleObjC:
101             return "apple-objc";
102         case eSectionTypeEHFrame:
103             return "eh-frame";
104         case eSectionTypeCompactUnwind:
105             return "compact-unwind";
106         case eSectionTypeOther:
107             return "regular";
108     }
109     return "unknown";
110 }
111