summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Metadata.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2014-11-01 00:10:31 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2014-11-01 00:10:31 +0000
commit3872d0084c4f479020ce01b4db5d1bd414c57fb8 (patch)
treefd1a9e83666fa84a3916b46a94cca32978b34794 /llvm/lib/IR/Metadata.cpp
parent7c4fc4e5ae4c8145974397da295587e77c770f62 (diff)
downloadbcm5719-llvm-3872d0084c4f479020ce01b4db5d1bd414c57fb8.tar.gz
bcm5719-llvm-3872d0084c4f479020ce01b4db5d1bd414c57fb8.zip
IR: MDNode => Value: Instruction::getMetadata()
Change `Instruction::getMetadata()` to return `Value` as part of PR21433. Update most callers to use `Instruction::getMDNode()`, which wraps the result in a `cast_or_null<MDNode>`. llvm-svn: 221024
Diffstat (limited to 'llvm/lib/IR/Metadata.cpp')
-rw-r--r--llvm/lib/IR/Metadata.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp
index 60cd2fc9061..6c335c78729 100644
--- a/llvm/lib/IR/Metadata.cpp
+++ b/llvm/lib/IR/Metadata.cpp
@@ -605,16 +605,16 @@ void Instruction::setMetadata(StringRef Kind, Value *MD) {
setMetadata(getContext().getMDKindID(Kind), MD);
}
-MDNode *Instruction::getMetadataImpl(StringRef Kind) const {
+Value *Instruction::getMetadataImpl(StringRef Kind) const {
return getMetadataImpl(getContext().getMDKindID(Kind));
}
MDNode *Instruction::getMDNodeImpl(unsigned KindID) const {
- return getMetadataImpl(KindID);
+ return cast_or_null<MDNode>(getMetadataImpl(KindID));
}
MDNode *Instruction::getMDNodeImpl(StringRef Kind) const {
- return getMetadataImpl(Kind);
+ return cast_or_null<MDNode>(getMetadataImpl(Kind));
}
void Instruction::dropUnknownMetadata(ArrayRef<unsigned> KnownIDs) {
@@ -729,7 +729,7 @@ void Instruction::setAAMetadata(const AAMDNodes &N) {
setMetadata(LLVMContext::MD_noalias, N.NoAlias);
}
-MDNode *Instruction::getMetadataImpl(unsigned KindID) const {
+Value *Instruction::getMetadataImpl(unsigned KindID) const {
// Handle 'dbg' as a special case since it is not stored in the hash table.
if (KindID == LLVMContext::MD_dbg)
return DbgLoc.getAsMDNode(getContext());
OpenPOWER on IntegriCloud