on darwin<10, fallback to .weak_definition (PPC,X86)
[oota-llvm.git] / lib / CodeGen / AsmPrinter / DIE.h
index 51773ad9fe030db89fe9b66dd52c00cb3ca05062..e28ddd38bc415ec21b3a1814e29fdbcbc63be6e8 100644 (file)
@@ -134,10 +134,11 @@ namespace llvm {
     explicit DIE(unsigned Tag)
         : Offset(0), Size(0), Abbrev((dwarf::Tag)Tag, dwarf::DW_CHILDREN_no),
           Parent(0) {}
-    virtual ~DIE();
+    ~DIE();
 
     // Accessors.
     DIEAbbrev &getAbbrev() { return Abbrev; }
+    const DIEAbbrev &getAbbrev() const { return Abbrev; }
     unsigned getAbbrevNumber() const { return Abbrev.getNumber(); }
     dwarf::Tag getTag() const { return Abbrev.getTag(); }
     unsigned getOffset() const { return Offset; }
@@ -145,6 +146,12 @@ namespace llvm {
     const std::vector<DIE *> &getChildren() const { return Children; }
     const SmallVectorImpl<DIEValue*> &getValues() const { return Values; }
     DIE *getParent() const { return Parent; }
+    /// Climb up the parent chain to get the compile or type unit DIE this DIE
+    /// belongs to.
+    const DIE *getUnit() const;
+    /// Similar to getUnit, returns null when DIE is not added to an
+    /// owner yet.
+    const DIE *getUnitOrNull() const;
     void setOffset(unsigned O) { Offset = O; }
     void setSize(unsigned S) { Size = S; }
 
@@ -165,9 +172,9 @@ namespace llvm {
       Child->Parent = this;
     }
 
-    /// findAttribute - Find a value in the DIE with the attribute given, returns NULL
-    /// if no such attribute exists.
-    DIEValue *findAttribute(uint16_t Attribute);
+    /// findAttribute - Find a value in the DIE with the attribute given,
+    /// returns NULL if no such attribute exists.
+    DIEValue *findAttribute(uint16_t Attribute) const;
 
 #ifndef NDEBUG
     void print(raw_ostream &O, unsigned IndentCount = 0) const;