diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-01-20 02:56:57 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-01-20 02:56:57 +0000 |
commit | 03e0583a2d02519a21d23cb0fb0da457c325f09d (patch) | |
tree | 440a170ca87f4df75c4152b464147b815ba8f273 /llvm/lib/IR/Metadata.cpp | |
parent | 8a07e7f657588791d308ebd712c1241edf499dd3 (diff) | |
download | bcm5719-llvm-03e0583a2d02519a21d23cb0fb0da457c325f09d.tar.gz bcm5719-llvm-03e0583a2d02519a21d23cb0fb0da457c325f09d.zip |
IR: Move MDNode clone() methods from ValueMapper to MDNode, NFC
Now that the clone methods used by `MapMetadata()` don't do any
remapping (and return a temporary), they make more sense as member
functions on `MDNode` (and subclasses).
llvm-svn: 226541
Diffstat (limited to 'llvm/lib/IR/Metadata.cpp')
-rw-r--r-- | llvm/lib/IR/Metadata.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp index fc1f3e7a3cf..6c8f71ffa99 100644 --- a/llvm/lib/IR/Metadata.cpp +++ b/llvm/lib/IR/Metadata.cpp @@ -418,6 +418,17 @@ MDNode::MDNode(LLVMContext &Context, unsigned ID, StorageType Storage, this->Context.makeReplaceable(make_unique<ReplaceableMetadataImpl>(Context)); } +TempMDNode MDNode::clone() const { + switch (getMetadataID()) { + default: + llvm_unreachable("Invalid MDNode subclass"); +#define HANDLE_MDNODE_LEAF(CLASS) \ + case CLASS##Kind: \ + return cast<CLASS>(this)->cloneImpl(); +#include "llvm/IR/Metadata.def" + } +} + static bool isOperandUnresolved(Metadata *Op) { if (auto *N = dyn_cast_or_null<MDNode>(Op)) return !N->isResolved(); |