Use a better name for the label relocations while emitting them for Jump Tables
[oota-llvm.git] / include / llvm / MDNode.h
index 03275edcd5a01159260ec98e4d918029c6bb5ed2..e3944365ee465e8e568c756d120f4042c808a72c 100644 (file)
@@ -25,6 +25,7 @@
 #include "llvm/Type.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/ValueHandle.h"
 
 namespace llvm {
@@ -45,6 +46,8 @@ namespace llvm {
 class MDNode : public Constant, public FoldingSetNode {
   MDNode(const MDNode &);      // DO NOT IMPLEMENT
 
+  friend class LLVMContextImpl;
+
   friend class ElementVH;
   struct ElementVH : public CallbackVH {
     MDNode *OwningNode;
@@ -71,15 +74,12 @@ class MDNode : public Constant, public FoldingSetNode {
 
   SmallVector<ElementVH, 4> Node;
   typedef SmallVectorImpl<ElementVH>::iterator elem_iterator;
+
 protected:
   explicit MDNode(Value*const* Vals, unsigned NumVals);
 public:
   typedef SmallVectorImpl<ElementVH>::const_iterator const_elem_iterator;
 
-  /// get() - Static factory methods - Return objects of the specified value.
-  ///
-  static MDNode *get(Value*const* Vals, unsigned NumVals);
-
   Value *getElement(unsigned i) const {
     return Node[i];
   }
@@ -88,6 +88,10 @@ public:
     return Node.size();
   }
 
+  bool elem_empty() const {
+    return Node.empty();
+  }
+
   const_elem_iterator elem_begin() const {
     return Node.begin();
   }
@@ -96,10 +100,10 @@ public:
     return Node.end();
   }
 
-  /// getType() specialization - Type is always an empty struct.
+  /// getType() specialization - Type is always MetadataTy.
   ///
   inline const Type *getType() const {
-    return Type::EmptyStructTy;
+    return Type::MetadataTy;
   }
 
   /// isNullValue - Return true if this is the value that would be returned by
@@ -115,8 +119,7 @@ public:
 
   virtual void destroyConstant();
   virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U) {
-    assert(0 && "This should never be called because MDNodes have no ops");
-    abort();
+    llvm_unreachable("This should never be called because MDNodes have no ops");
   }
 
   /// Methods for support type inquiry through isa, cast, and dyn_cast: