From e5d641ebcafc3586f4981bc3a04f01b7f6b6acb8 Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Fri, 31 Oct 2014 20:13:11 +0000 Subject: IR: MDNode => Value: Instruction::setMetadata() Change `Instruction::setMetadata()` API to accept `Value` instead of `MDNode`. Part of PR21433. llvm-svn: 220994 --- llvm/lib/IR/Metadata.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'llvm/lib/IR/Metadata.cpp') diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp index cc118496033..24c78fea646 100644 --- a/llvm/lib/IR/Metadata.cpp +++ b/llvm/lib/IR/Metadata.cpp @@ -600,9 +600,9 @@ StringRef NamedMDNode::getName() const { // Instruction Metadata method implementations. // -void Instruction::setMetadata(StringRef Kind, MDNode *Node) { - if (!Node && !hasMetadata()) return; - setMetadata(getContext().getMDKindID(Kind), Node); +void Instruction::setMetadata(StringRef Kind, Value *MD) { + if (!MD && !hasMetadata()) return; + setMetadata(getContext().getMDKindID(Kind), MD); } MDNode *Instruction::getMetadataImpl(StringRef Kind) const { @@ -655,9 +655,12 @@ void Instruction::dropUnknownMetadata(ArrayRef KnownIDs) { /// setMetadata - Set the metadata of of the specified kind to the specified /// node. This updates/replaces metadata if already present, or removes it if -/// Node is null. -void Instruction::setMetadata(unsigned KindID, MDNode *Node) { - if (!Node && !hasMetadata()) return; +/// MD is null. +void Instruction::setMetadata(unsigned KindID, Value *MD) { + if (!MD && !hasMetadata()) return; + + // For now, we only expect MDNodes here. + MDNode *Node = cast(MD); // Handle 'dbg' as a special case since it is not stored in the hash table. if (KindID == LLVMContext::MD_dbg) { -- cgit v1.2.3