- /// getNumElements - Return number of NamedMDNode elements.
- unsigned getNumElements() const;
-
- /// addElement - Add metadata element.
- void addElement(MetadataBase *M);
-
- /// 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;
- }
-};
-
-//===----------------------------------------------------------------------===//
-/// MetadataContext - MetadataContext handles uniquing and assignment of IDs for
-/// custom metadata types.
-///
-class MetadataContext {
- MetadataContext(MetadataContext&); // DO NOT IMPLEMENT
- void operator=(MetadataContext&); // DO NOT IMPLEMENT
-
- MetadataContextImpl *const pImpl;
- friend class Instruction;
-public:
- MetadataContext();
- ~MetadataContext();
-
- /// getMDKindID - Return a unique non-zero ID for the specified metadata kind.
- unsigned getMDKindID(StringRef Name) const;
-
- /// isValidName - Return true if Name is a valid custom metadata handler name.
- static bool isValidName(StringRef Name);
-
- /// copyMD - If metadata is attached with Instruction In1 then attach
- /// the same metadata to In2.
- void copyMD(Instruction *In1, Instruction *In2);