summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/Metadata.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/VMCore/Metadata.cpp')
-rw-r--r--llvm/lib/VMCore/Metadata.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/lib/VMCore/Metadata.cpp b/llvm/lib/VMCore/Metadata.cpp
index f4d60714f99..fdac408abec 100644
--- a/llvm/lib/VMCore/Metadata.cpp
+++ b/llvm/lib/VMCore/Metadata.cpp
@@ -294,13 +294,15 @@ MDNode *MetadataContext::getMD(unsigned MDKind, const Instruction *Inst) {
}
/// getMDs - Get the metadata attached to an Instruction.
-const MetadataContext::MDMapTy *
-MetadataContext::getMDs(const Instruction *Inst) {
+void MetadataContext::
+getMDs(const Instruction *Inst, SmallVectorImpl<MDPairTy> &MDs) const {
MDStoreTy::iterator I = MetadataStore.find(Inst);
if (I == MetadataStore.end())
- return NULL;
-
- return &I->second;
+ return;
+ for (MDMapTy::iterator MI = I->second.begin(), ME = I->second.end();
+ MI != ME; ++MI)
+ MDs.push_back(std::make_pair(MI->first, MI->second));
+ std::sort(MDs.begin(), MDs.end());
}
/// getHandlerNames - Populate client supplied smallvector using custome
OpenPOWER on IntegriCloud