diff options
| author | Devang Patel <dpatel@apple.com> | 2009-10-22 18:55:16 +0000 |
|---|---|---|
| committer | Devang Patel <dpatel@apple.com> | 2009-10-22 18:55:16 +0000 |
| commit | f61b2371c8ec6e0ff2da8f2bd2a606ba755bb2fe (patch) | |
| tree | 4e70cd3cb36311326f54ad5a9d293bfc33590a89 /lib/VMCore/AsmWriter.cpp | |
| parent | b5681b22937440dcb8007f4b125f3325d6341fe0 (diff) | |
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
Diffstat (limited to 'lib/VMCore/AsmWriter.cpp')
| -rw-r--r-- | lib/VMCore/AsmWriter.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index fb1b1ac41c..d8a708dbbc 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -680,6 +680,8 @@ void SlotTracker::processFunction() { ST_DEBUG("Inserting Instructions:\n"); MetadataContext &TheMetadata = TheFunction->getContext().getMetadata(); + typedef SmallVector<std::pair<unsigned, TrackingVH<MDNode> >, 2> MDMapTy; + MDMapTy MDs; // Add all of the basic blocks and instructions with no names. for (Function::const_iterator BB = TheFunction->begin(), @@ -696,11 +698,11 @@ void SlotTracker::processFunction() { CreateMetadataSlot(N); // Process metadata attached with this instruction. - const MetadataContext::MDMapTy *MDs = TheMetadata.getMDs(I); - if (MDs) - for (MetadataContext::MDMapTy::const_iterator MI = MDs->begin(), - ME = MDs->end(); MI != ME; ++MI) - CreateMetadataSlot(MI->second); + MDs.clear(); + TheMetadata.getMDs(I, MDs); + for (MDMapTy::const_iterator MI = MDs.begin(), ME = MDs.end(); MI != ME; + ++MI) + CreateMetadataSlot(MI->second); } } @@ -2034,12 +2036,13 @@ void AssemblyWriter::printInstruction(const Instruction &I) { // Print Metadata info if (!MDNames.empty()) { MetadataContext &TheMetadata = I.getContext().getMetadata(); - const MetadataContext::MDMapTy *MDMap = TheMetadata.getMDs(&I); - if (MDMap) - for (MetadataContext::MDMapTy::const_iterator MI = MDMap->begin(), - ME = MDMap->end(); MI != ME; ++MI) - Out << ", !" << MDNames[MI->first] - << " !" << Machine.getMetadataSlot(MI->second); + typedef SmallVector<std::pair<unsigned, TrackingVH<MDNode> >, 2> MDMapTy; + MDMapTy MDs; + TheMetadata.getMDs(&I, MDs); + for (MDMapTy::const_iterator MI = MDs.begin(), ME = MDs.end(); MI != ME; + ++MI) + Out << ", !" << MDNames[MI->first] + << " !" << Machine.getMetadataSlot(MI->second); } printInfoComment(I); } |
