llvm-vtabledump: Handle Itanium VTables
[oota-llvm.git] / lib / IR / Metadata.cpp
index 3d869e87c4d34d60adf7bfaa22b596c2074ad48e..ba86e9e60855c7c3bbcd327079c948c66e39875f 100644 (file)
@@ -605,10 +605,18 @@ 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 cast_or_null<MDNode>(getMetadataImpl(KindID));
+}
+
+MDNode *Instruction::getMDNodeImpl(StringRef Kind) const {
+  return cast_or_null<MDNode>(getMetadataImpl(Kind));
+}
+
 void Instruction::dropUnknownMetadata(ArrayRef<unsigned> KnownIDs) {
   SmallSet<unsigned, 5> KnownSet;
   KnownSet.insert(KnownIDs.begin(), KnownIDs.end());
@@ -721,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());
@@ -737,8 +745,8 @@ MDNode *Instruction::getMetadataImpl(unsigned KindID) const {
   return nullptr;
 }
 
-void Instruction::getAllMetadataImpl(SmallVectorImpl<std::pair<unsigned,
-                                       MDNode*> > &Result) const {
+void Instruction::getAllMetadataImpl(
+    SmallVectorImpl<std::pair<unsigned, Value *>> &Result) const {
   Result.clear();
   
   // Handle 'dbg' as a special case since it is not stored in the hash table.