From 6da5dbf3c21a880ab05f7f60bece11d3c17a3bbd 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. llvm-svn: 84885 --- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp') diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index c8cb595..037854e2 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -561,14 +561,16 @@ static void WriteMetadataAttachment(const Function &F, // Write metadata attachments // METADATA_ATTACHMENT - [m x [value, [n x [id, mdnode]]] MetadataContext &TheMetadata = F.getContext().getMetadata(); + typedef SmallVector >, 2> MDMapTy; + MDMapTy MDs; for (Function::const_iterator BB = F.begin(), E = F.end(); BB != E; ++BB) for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I != E; ++I) { - const MetadataContext::MDMapTy *P = TheMetadata.getMDs(I); - if (!P) continue; + MDs.clear(); + TheMetadata.getMDs(I, MDs); bool RecordedInstruction = false; - for (MetadataContext::MDMapTy::const_iterator PI = P->begin(), - PE = P->end(); PI != PE; ++PI) { + for (MDMapTy::const_iterator PI = MDs.begin(), PE = MDs.end(); + PI != PE; ++PI) { if (RecordedInstruction == false) { Record.push_back(VE.getInstructionID(I)); RecordedInstruction = true; -- cgit v1.1