// Add an operand to an existing MDNode. The new operand will be added at the // back of the operand list. static void AddOperand(DICompileUnit CU, DIArray SPs, Metadata *NewSP) { SmallVector<Metadata *, 16> NewSPs; NewSPs.reserve(SPs->getNumOperands() + 1); for (unsigned I = 0, E = SPs->getNumOperands(); I != E; ++I) NewSPs.push_back(SPs->getOperand(I)); NewSPs.push_back(NewSP); CU.replaceSubprograms(DIArray(MDNode::get(CU->getContext(), NewSPs))); }