[C++11] Add 'override' keyword to virtual methods that override their base class.
[oota-llvm.git] / lib / CodeGen / AsmPrinter / DIE.h
index fa23fa889e3f069c35ec6086d7f9191c4c714bfc..e90812558e5cac0d6bc1bcd379f8ca9823b7ef51 100644 (file)
@@ -56,31 +56,33 @@ public:
 /// DIEAbbrev - Dwarf abbreviation, describes the organization of a debug
 /// information object.
 class DIEAbbrev : public FoldingSetNode {
-  /// Tag - Dwarf tag code.
+  /// Unique number for node.
   ///
-  dwarf::Tag Tag;
+  unsigned Number;
 
-  /// ChildrenFlag - Dwarf children flag.
+  /// Tag - Dwarf tag code.
   ///
-  uint16_t ChildrenFlag;
+  dwarf::Tag Tag;
 
-  /// Unique number for node.
+  /// Children - Whether or not this node has children.
   ///
-  unsigned Number;
+  // This cheats a bit in all of the uses since the values in the standard
+  // are 0 and 1 for no children and children respectively.
+  bool Children;
 
   /// Data - Raw data bytes for abbreviation.
   ///
   SmallVector<DIEAbbrevData, 12> Data;
 
 public:
-  DIEAbbrev(dwarf::Tag T, uint16_t C) : Tag(T), ChildrenFlag(C), Data() {}
+  DIEAbbrev(dwarf::Tag T, bool C) : Tag(T), Children(C), Data() {}
 
   // Accessors.
   dwarf::Tag getTag() const { return Tag; }
   unsigned getNumber() const { return Number; }
-  uint16_t getChildrenFlag() const { return ChildrenFlag; }
+  bool hasChildren() const { return Children; }
   const SmallVectorImpl<DIEAbbrevData> &getData() const { return Data; }
-  void setChildrenFlag(uint16_t CF) { ChildrenFlag = CF; }
+  void setChildrenFlag(bool hasChild) { Children = hasChild; }
   void setNumber(unsigned N) { Number = N; }
 
   /// AddAttribute - Adds another set of attribute information to the
@@ -175,7 +177,7 @@ public:
 
   /// findAttribute - Find a value in the DIE with the attribute given,
   /// returns NULL if no such attribute exists.
-  DIEValue *findAttribute(uint16_t Attribute) const;
+  DIEValue *findAttribute(dwarf::Attribute Attribute) const;
 
 #ifndef NDEBUG
   void print(raw_ostream &O, unsigned IndentCount = 0) const;
@@ -191,7 +193,7 @@ class DIEValue {
   virtual void anchor();
 
 public:
-  enum {
+  enum Type {
     isInteger,
     isString,
     isExpr,
@@ -200,20 +202,21 @@ public:
     isEntry,
     isTypeSignature,
     isBlock,
-    isLoc
+    isLoc,
+    isLocList,
   };
 
 protected:
-  /// Type - Type of data stored in the value.
+  /// Ty - Type of data stored in the value.
   ///
-  unsigned Type;
+  Type Ty;
 
-public:
-  explicit DIEValue(unsigned T) : Type(T) {}
+  explicit DIEValue(Type T) : Ty(T) {}
   virtual ~DIEValue() {}
 
+public:
   // Accessors
-  unsigned getType() const { return Type; }
+  Type getType() const { return Ty; }
 
   /// EmitValue - Emit value via the Dwarf writer.
   ///
@@ -262,19 +265,19 @@ public:
 
   /// EmitValue - Emit integer of appropriate size.
   ///
-  virtual void EmitValue(AsmPrinter *AP, dwarf::Form Form) const;
+  void EmitValue(AsmPrinter *AP, dwarf::Form Form) const override;
 
   uint64_t getValue() const { return Integer; }
 
   /// SizeOf - Determine size of integer value in bytes.
   ///
-  virtual unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const;
+  unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const override;
 
   // Implement isa/cast/dyncast.
   static bool classof(const DIEValue *I) { return I->getType() == isInteger; }
 
 #ifndef NDEBUG
-  virtual void print(raw_ostream &O) const;
+  void print(raw_ostream &O) const override;
 #endif
 };
 
@@ -289,7 +292,7 @@ public:
 
   /// EmitValue - Emit expression value.
   ///
-  virtual void EmitValue(AsmPrinter *AP, dwarf::Form Form) const;
+  void EmitValue(AsmPrinter *AP, dwarf::Form Form) const override;
 
   /// getValue - Get MCExpr.
   ///
@@ -297,13 +300,13 @@ public:
 
   /// SizeOf - Determine size of expression value in bytes.
   ///
-  virtual unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const;
+  unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const override;
 
   // Implement isa/cast/dyncast.
   static bool classof(const DIEValue *E) { return E->getType() == isExpr; }
 
 #ifndef NDEBUG
-  virtual void print(raw_ostream &O) const;
+  void print(raw_ostream &O) const override;
 #endif
 };
 
@@ -318,7 +321,7 @@ public:
 
   /// EmitValue - Emit label value.
   ///
-  virtual void EmitValue(AsmPrinter *AP, dwarf::Form Form) const;
+  void EmitValue(AsmPrinter *AP, dwarf::Form Form) const override;
 
   /// getValue - Get MCSymbol.
   ///
@@ -326,13 +329,13 @@ public:
 
   /// SizeOf - Determine size of label value in bytes.
   ///
-  virtual unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const;
+  unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const override;
 
   // Implement isa/cast/dyncast.
   static bool classof(const DIEValue *L) { return L->getType() == isLabel; }
 
 #ifndef NDEBUG
-  virtual void print(raw_ostream &O) const;
+  void print(raw_ostream &O) const override;
 #endif
 };
 
@@ -349,17 +352,17 @@ public:
 
   /// EmitValue - Emit delta value.
   ///
-  virtual void EmitValue(AsmPrinter *AP, dwarf::Form Form) const;
+  void EmitValue(AsmPrinter *AP, dwarf::Form Form) const override;
 
   /// SizeOf - Determine size of delta value in bytes.
   ///
-  virtual unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const;
+  unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const override;
 
   // Implement isa/cast/dyncast.
   static bool classof(const DIEValue *D) { return D->getType() == isDelta; }
 
 #ifndef NDEBUG
-  virtual void print(raw_ostream &O) const;
+  void print(raw_ostream &O) const override;
 #endif
 };
 
@@ -379,17 +382,17 @@ public:
 
   /// EmitValue - Emit delta value.
   ///
-  virtual void EmitValue(AsmPrinter *AP, dwarf::Form Form) const;
+  void EmitValue(AsmPrinter *AP, dwarf::Form Form) const override;
 
   /// SizeOf - Determine size of delta value in bytes.
   ///
-  virtual unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const;
+  unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const override;
 
   // Implement isa/cast/dyncast.
   static bool classof(const DIEValue *D) { return D->getType() == isString; }
 
 #ifndef NDEBUG
-  virtual void print(raw_ostream &O) const;
+  void print(raw_ostream &O) const override;
 #endif
 };
 
@@ -409,11 +412,11 @@ public:
 
   /// EmitValue - Emit debug information entry offset.
   ///
-  virtual void EmitValue(AsmPrinter *AP, dwarf::Form Form) const;
+  void EmitValue(AsmPrinter *AP, dwarf::Form Form) const override;
 
   /// SizeOf - Determine size of debug information entry in bytes.
   ///
-  virtual unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const {
+   unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const override {
     return Form == dwarf::DW_FORM_ref_addr ? getRefAddrSize(AP)
                                            : sizeof(int32_t);
   }
@@ -425,7 +428,7 @@ public:
   static bool classof(const DIEValue *E) { return E->getType() == isEntry; }
 
 #ifndef NDEBUG
-  virtual void print(raw_ostream &O) const;
+  void print(raw_ostream &O) const override;
 #endif
 };
 
@@ -439,10 +442,10 @@ public:
       : DIEValue(isTypeSignature), Unit(Unit) {}
 
   /// \brief Emit type unit signature.
-  virtual void EmitValue(AsmPrinter *Asm, dwarf::Form Form) const;
+  void EmitValue(AsmPrinter *Asm, dwarf::Form Form) const override;
 
   /// Returns size of a ref_sig8 entry.
-  virtual unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const {
+  unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const override {
     assert(Form == dwarf::DW_FORM_ref_sig8);
     return 8;
   }
@@ -452,7 +455,7 @@ public:
     return E->getType() == isTypeSignature;
   }
 #ifndef NDEBUG
-  virtual void print(raw_ostream &O) const;
+  void print(raw_ostream &O) const override;
   void dump() const;
 #endif
 };
@@ -486,17 +489,17 @@ public:
 
   /// EmitValue - Emit location data.
   ///
-  virtual void EmitValue(AsmPrinter *AP, dwarf::Form Form) const;
+  void EmitValue(AsmPrinter *AP, dwarf::Form Form) const override;
 
   /// SizeOf - Determine size of location data in bytes.
   ///
-  virtual unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const;
+  unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const override;
 
   // Implement isa/cast/dyncast.
   static bool classof(const DIEValue *E) { return E->getType() == isLoc; }
 
 #ifndef NDEBUG
-  virtual void print(raw_ostream &O) const;
+  void print(raw_ostream &O) const override;
 #endif
 };
 
@@ -526,19 +529,50 @@ public:
 
   /// EmitValue - Emit location data.
   ///
-  virtual void EmitValue(AsmPrinter *AP, dwarf::Form Form) const;
+  void EmitValue(AsmPrinter *AP, dwarf::Form Form) const override;
 
   /// SizeOf - Determine size of location data in bytes.
   ///
-  virtual unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const;
+  unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const override;
 
   // Implement isa/cast/dyncast.
   static bool classof(const DIEValue *E) { return E->getType() == isBlock; }
 
 #ifndef NDEBUG
-  virtual void print(raw_ostream &O) const;
+  void print(raw_ostream &O) const override;
 #endif
 };
+
+//===--------------------------------------------------------------------===//
+/// DIELocList - Represents a pointer to a location list in the debug_loc
+/// section.
+//
+class DIELocList : public DIEValue {
+  // Index into the .debug_loc vector.
+  size_t Index;
+
+public:
+  DIELocList(size_t I) : DIEValue(isLocList), Index(I) {}
+
+  /// getValue - Grab the current index out.
+  size_t getValue() const { return Index; }
+
+  /// EmitValue - Emit location data.
+  ///
+  void EmitValue(AsmPrinter *AP, dwarf::Form Form) const override;
+
+  /// SizeOf - Determine size of location data in bytes.
+  ///
+  unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const override;
+
+  // Implement isa/cast/dyncast.
+  static bool classof(const DIEValue *E) { return E->getType() == isLocList; }
+
+#ifndef NDEBUG
+  void print(raw_ostream &O) const override;
+#endif
+};
+
 } // end llvm namespace
 
 #endif