change the strange MetadataContext::getMDs function to expose less

irrelevant internal implementation details to clients.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92210 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2009-12-28 08:14:54 +00:00
parent 5710969728
commit bcb18538c2
5 changed files with 10 additions and 8 deletions

View File

@ -236,7 +236,7 @@ public:
/// getMDs - Get the metadata attached to an Instruction. /// getMDs - Get the metadata attached to an Instruction.
void getMDs(const Instruction *Inst, void getMDs(const Instruction *Inst,
SmallVectorImpl<std::pair<unsigned, TrackingVH<MDNode> > > &MDs) const; SmallVectorImpl<std::pair<unsigned, MDNode*> > &MDs) const;
/// addMD - Attach the metadata of given kind to an Instruction. /// addMD - Attach the metadata of given kind to an Instruction.
void addMD(unsigned Kind, MDNode *Node, Instruction *Inst); void addMD(unsigned Kind, MDNode *Node, Instruction *Inst);

View File

@ -562,7 +562,7 @@ static void WriteMetadataAttachment(const Function &F,
// Write metadata attachments // Write metadata attachments
// METADATA_ATTACHMENT - [m x [value, [n x [id, mdnode]]] // METADATA_ATTACHMENT - [m x [value, [n x [id, mdnode]]]
MetadataContext &TheMetadata = F.getContext().getMetadata(); MetadataContext &TheMetadata = F.getContext().getMetadata();
typedef SmallVector<std::pair<unsigned, TrackingVH<MDNode> >, 2> MDMapTy; typedef SmallVector<std::pair<unsigned, MDNode*>, 2> MDMapTy;
MDMapTy MDs; MDMapTy MDs;
for (Function::const_iterator BB = F.begin(), E = F.end(); BB != E; ++BB) for (Function::const_iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); for (BasicBlock::const_iterator I = BB->begin(), E = BB->end();

View File

@ -88,7 +88,7 @@ ValueEnumerator::ValueEnumerator(const Module *M) {
EnumerateType(I->getType()); EnumerateType(I->getType());
MetadataContext &TheMetadata = F->getContext().getMetadata(); MetadataContext &TheMetadata = F->getContext().getMetadata();
typedef SmallVector<std::pair<unsigned, TrackingVH<MDNode> >, 2> MDMapTy; typedef SmallVector<std::pair<unsigned, MDNode*>, 2> MDMapTy;
MDMapTy MDs; MDMapTy MDs;
for (Function::const_iterator BB = F->begin(), E = F->end(); BB != E; ++BB) 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){ for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I!=E;++I){

View File

@ -681,7 +681,7 @@ void SlotTracker::processFunction() {
ST_DEBUG("Inserting Instructions:\n"); ST_DEBUG("Inserting Instructions:\n");
MetadataContext &TheMetadata = TheFunction->getContext().getMetadata(); MetadataContext &TheMetadata = TheFunction->getContext().getMetadata();
typedef SmallVector<std::pair<unsigned, TrackingVH<MDNode> >, 2> MDMapTy; typedef SmallVector<std::pair<unsigned, MDNode*>, 2> MDMapTy;
MDMapTy MDs; MDMapTy MDs;
// Add all of the basic blocks and instructions with no names. // Add all of the basic blocks and instructions with no names.
@ -2085,7 +2085,7 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
// Print Metadata info // Print Metadata info
if (!MDNames.empty()) { if (!MDNames.empty()) {
MetadataContext &TheMetadata = I.getContext().getMetadata(); MetadataContext &TheMetadata = I.getContext().getMetadata();
typedef SmallVector<std::pair<unsigned, TrackingVH<MDNode> >, 2> MDMapTy; typedef SmallVector<std::pair<unsigned, MDNode*>, 2> MDMapTy;
MDMapTy MDs; MDMapTy MDs;
TheMetadata.getMDs(&I, MDs); TheMetadata.getMDs(&I, MDs);
for (MDMapTy::const_iterator MI = MDs.begin(), ME = MDs.end(); MI != ME; for (MDMapTy::const_iterator MI = MDs.begin(), ME = MDs.end(); MI != ME;

View File

@ -322,7 +322,8 @@ public:
MDNode *getMD(unsigned Kind, const Instruction *Inst); MDNode *getMD(unsigned Kind, const Instruction *Inst);
/// getMDs - Get the metadata attached to an Instruction. /// getMDs - Get the metadata attached to an Instruction.
void getMDs(const Instruction *Inst, SmallVectorImpl<MDPairTy> &MDs) const; void getMDs(const Instruction *Inst,
SmallVectorImpl<std::pair<unsigned, MDNode*> > &MDs) const;
/// addMD - Attach the metadata of given kind to an Instruction. /// addMD - Attach the metadata of given kind to an Instruction.
void addMD(unsigned Kind, MDNode *Node, Instruction *Inst); void addMD(unsigned Kind, MDNode *Node, Instruction *Inst);
@ -447,7 +448,8 @@ MDNode *MetadataContextImpl::getMD(unsigned MDKind, const Instruction *Inst) {
/// getMDs - Get the metadata attached to an Instruction. /// getMDs - Get the metadata attached to an Instruction.
void MetadataContextImpl:: void MetadataContextImpl::
getMDs(const Instruction *Inst, SmallVectorImpl<MDPairTy> &MDs) const { getMDs(const Instruction *Inst,
SmallVectorImpl<std::pair<unsigned, MDNode*> > &MDs) const {
MDStoreTy::const_iterator I = MetadataStore.find(Inst); MDStoreTy::const_iterator I = MetadataStore.find(Inst);
if (I == MetadataStore.end()) if (I == MetadataStore.end())
return; return;
@ -542,7 +544,7 @@ MDNode *MetadataContext::getMD(unsigned Kind, const Instruction *Inst) {
/// getMDs - Get the metadata attached to an Instruction. /// getMDs - Get the metadata attached to an Instruction.
void MetadataContext:: void MetadataContext::
getMDs(const Instruction *Inst, getMDs(const Instruction *Inst,
SmallVectorImpl<std::pair<unsigned, TrackingVH<MDNode> > > &MDs) const { SmallVectorImpl<std::pair<unsigned, MDNode*> > &MDs) const {
return pImpl->getMDs(Inst, MDs); return pImpl->getMDs(Inst, MDs);
} }