Explicitly request unsigned enum types when desired
[oota-llvm.git] / include / llvm / Support / Dwarf.h
index 20c2200a7145c2e94655a498de96b13cc2e770b8..0f3354143849b33c01d9df4555d031727dceb118 100644 (file)
@@ -16,6 +16,7 @@
 #ifndef LLVM_SUPPORT_DWARF_H
 #define LLVM_SUPPORT_DWARF_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/DataTypes.h"
 
 namespace llvm {
@@ -23,7 +24,7 @@ namespace llvm {
 //===----------------------------------------------------------------------===//
 // Debug info constants.
 
-enum {
+enum LLVM_ENUM_INT_TYPE(uint32_t) {
   LLVMDebugVersion = (12 << 16),    // Current version of debug information.
   LLVMDebugVersion11 = (11 << 16),  // Constant for version 11.
   LLVMDebugVersion10 = (10 << 16),  // Constant for version 10.
@@ -46,7 +47,7 @@ namespace dwarf {
 // Do not mix the following two enumerations sets.  DW_TAG_invalid changes the
 // enumeration base type.
 
-enum LLVMConstants {
+enum LLVMConstants LLVM_ENUM_INT_TYPE(uint32_t) {
   // llvm mock tags
   DW_TAG_invalid = ~0U, // Tag for invalid results.
 
@@ -58,7 +59,8 @@ enum LLVMConstants {
   DWARF_VERSION = 4,       // Default dwarf version we output.
   DW_CIE_VERSION = 1,      // Common frame information version.
   DW_PUBTYPES_VERSION = 2, // Section version number for .debug_pubtypes.
-  DW_PUBNAMES_VERSION = 2  // Section version number for .debug_pubnames.
+  DW_PUBNAMES_VERSION = 2, // Section version number for .debug_pubnames.
+  DW_ARANGES_VERSION = 2   // Section version number for .debug_aranges.
 };
 
 // Special ID values that distinguish a CIE from a FDE in DWARF CFI.
@@ -798,14 +800,18 @@ enum GDBIndexEntryKind {
   GIEK_OTHER,
   GIEK_UNUSED5,
   GIEK_UNUSED6,
-  GIEK_UNUSED7,
+  GIEK_UNUSED7
 };
 
+const char *GDBIndexEntryKindString(GDBIndexEntryKind Kind);
+
 enum GDBIndexEntryLinkage {
   GIEL_EXTERNAL,
   GIEL_STATIC
 };
 
+const char *GDBIndexEntryLinkageString(GDBIndexEntryLinkage Linkage);
+
 /// The gnu_pub* kind looks like:
 ///
 /// 0-3  reserved
@@ -816,24 +822,24 @@ enum GDBIndexEntryLinkage {
 /// offset of the cu within the debug_info section stored in those 24 bits.
 struct PubIndexEntryDescriptor {
   GDBIndexEntryKind Kind;
-  bool Static;
-  PubIndexEntryDescriptor(GDBIndexEntryKind Kind, bool Static)
-      : Kind(Kind), Static(Static) {}
+  GDBIndexEntryLinkage Linkage;
+  PubIndexEntryDescriptor(GDBIndexEntryKind Kind, GDBIndexEntryLinkage Linkage)
+      : Kind(Kind), Linkage(Linkage) {}
   /* implicit */ PubIndexEntryDescriptor(GDBIndexEntryKind Kind)
-      : Kind(Kind), Static(false) {}
+      : Kind(Kind), Linkage(GIEL_EXTERNAL) {}
   explicit PubIndexEntryDescriptor(uint8_t Value)
       : Kind(static_cast<GDBIndexEntryKind>((Value & KIND_MASK) >>
                                             KIND_OFFSET)),
-        Static(Value & STATIC_MASK) {}
-  uint8_t toBits() {
-    return Kind << KIND_OFFSET | Static << STATIC_OFFSET;
-  }
+        Linkage(static_cast<GDBIndexEntryLinkage>((Value & LINKAGE_MASK) >>
+                                                  LINKAGE_OFFSET)) {}
+  uint8_t toBits() { return Kind << KIND_OFFSET | Linkage << LINKAGE_OFFSET; }
+
 private:
   enum {
     KIND_OFFSET = 4,
     KIND_MASK = 7 << KIND_OFFSET,
-    STATIC_OFFSET = 7,
-    STATIC_MASK = 1 << STATIC_OFFSET
+    LINKAGE_OFFSET = 7,
+    LINKAGE_MASK = 1 << LINKAGE_OFFSET
   };
 };