X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FMDNode.h;h=e3944365ee465e8e568c756d120f4042c808a72c;hb=617dd7baa6dfd3a7b5ee72ace37f6b6aeaa6006b;hp=50b3104c8fa96e8f09a677fc2b6c10e70a8fa712;hpb=cb33799b9f4e152e3460faa83e59b53ff604c87d;p=oota-llvm.git diff --git a/include/llvm/MDNode.h b/include/llvm/MDNode.h index 50b3104c8fa..e3944365ee4 100644 --- a/include/llvm/MDNode.h +++ b/include/llvm/MDNode.h @@ -22,8 +22,10 @@ #define LLVM_MDNODE_H #include "llvm/Constant.h" +#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 { @@ -44,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; @@ -70,15 +74,12 @@ class MDNode : public Constant, public FoldingSetNode { SmallVector Node; typedef SmallVectorImpl::iterator elem_iterator; + protected: explicit MDNode(Value*const* Vals, unsigned NumVals); public: typedef SmallVectorImpl::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]; } @@ -87,6 +88,10 @@ public: return Node.size(); } + bool elem_empty() const { + return Node.empty(); + } + const_elem_iterator elem_begin() const { return Node.begin(); } @@ -95,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 @@ -114,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: