1 //===- MetadataImpl.h - Helpers for implementing metadata -----------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file has private helpers for implementing metadata types.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_IR_METADATAIMPL_H
15 #define LLVM_IR_METADATAIMPL_H
17 #include "llvm/ADT/DenseSet.h"
18 #include "llvm/IR/Metadata.h"
22 template <class T, class InfoT>
23 static T *getUniqued(DenseSet<T *, InfoT> &Store,
24 const typename InfoT::KeyTy &Key) {
25 auto I = Store.find_as(Key);
26 return I == Store.end() ? nullptr : *I;
29 template <class T, class StoreT>
30 T *MDNode::storeImpl(T *N, StorageType Storage, StoreT &Store) {
36 N->storeDistinctInContext();
44 } // end namespace llvm