Make NamedMDNode not be a subclass of Value, and simplify the interface

for creating and populating NamedMDNodes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109061 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman
2010-07-21 23:38:33 +00:00
parent fcbd1a749f
commit 17aa92c92a
19 changed files with 97 additions and 273 deletions

View File

@@ -801,16 +801,13 @@ bool BitcodeReader::ParseMetadata() {
// Read named metadata elements.
unsigned Size = Record.size();
SmallVector<MDNode *, 8> Elts;
NamedMDNode *NMD = TheModule->getOrInsertNamedMetadata(Name);
for (unsigned i = 0; i != Size; ++i) {
MDNode *MD = dyn_cast<MDNode>(MDValueList.getValueFwdRef(Record[i]));
if (MD == 0)
return Error("Malformed metadata record");
Elts.push_back(MD);
NMD->addOperand(MD);
}
Value *V = NamedMDNode::Create(Context, Name.str(), Elts.data(),
Elts.size(), TheModule);
MDValueList.AssignValue(V, NextMDValueNo++);
break;
}
case bitc::METADATA_FN_NODE: