- void setParent(Module *M) { Parent = M; }
-
- /// getElement - Return specified element.
- MetadataBase *getElement(unsigned i) const {
- assert (getNumElements() > i && "Invalid element number!");
- return Node[i];
- }
-
- /// getNumElements - Return number of NamedMDNode elements.
- unsigned getNumElements() const {
- return Node.size();
- }
-
- /// addElement - Add metadata element.
- void addElement(MetadataBase *M) {
- resizeOperands(0);
- OperandList[NumOperands++] = M;
- Node.push_back(WeakMetadataVH(M));
- }
-
- typedef SmallVectorImpl<WeakMetadataVH>::const_iterator const_elem_iterator;
- bool elem_empty() const { return Node.empty(); }
- const_elem_iterator elem_begin() const { return Node.begin(); }
- const_elem_iterator elem_end() const { return Node.end(); }
- elem_iterator elem_begin() { return Node.begin(); }
- elem_iterator elem_end() { return Node.end(); }
-
- /// isNullValue - Return true if this is the value that would be returned by
- /// getNullValue. This always returns false because getNullValue will never
- /// produce metadata.
- virtual bool isNullValue() const {
- return false;
- }
-
- virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U) {
- llvm_unreachable(
- "This should never be called because NamedMDNodes have no ops");
- }
-
- /// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const NamedMDNode *) { return true; }
- static bool classof(const Value *V) {
- return V->getValueID() == NamedMDNodeVal;
- }
-};