From f61b2371c8ec6e0ff2da8f2bd2a606ba755bb2fe Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Thu, 22 Oct 2009 18:55:16 +0000 Subject: Fix getMDs() interface such that it does not expose implementation details. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84885 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/VMCore/Metadata.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'lib/VMCore/Metadata.cpp') diff --git a/lib/VMCore/Metadata.cpp b/lib/VMCore/Metadata.cpp index f4d60714f9..fdac408abe 100644 --- a/lib/VMCore/Metadata.cpp +++ b/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 &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 -- cgit v1.2.3