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

for creating and populating NamedMDNodes.

llvm-svn: 109061
This commit is contained in:
Dan Gohman
2010-07-21 23:38:33 +00:00
parent 350b1a449f
commit 2637cc1a38
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: