================ @@ -160,6 +163,65 @@ void dumpRootElements(raw_ostream &OS, ArrayRef<RootElement> Elements) { OS << "}"; } +MDNode *MetadataBuilder::BuildRootSignature() { + for (const RootElement &Element : Elements) { + MDNode *ElementMD = nullptr; + if (const auto &Clause = std::get_if<DescriptorTableClause>(&Element)) + ElementMD = BuildDescriptorTableClause(*Clause); + if (const auto &Table = std::get_if<DescriptorTable>(&Element)) + ElementMD = BuildDescriptorTable(*Table); + + // FIXME(#126586): remove once all RootElemnt variants are handled in a + // visit or otherwise + assert(ElementMD != nullptr && + "Constructed an unhandled root element type."); + + GeneratedMetadata.push_back(ElementMD); + } + + return MDNode::get(Ctx, GeneratedMetadata); +} + +MDNode *MetadataBuilder::BuildDescriptorTable(const DescriptorTable &Table) { + IRBuilder<> B(Ctx); ---------------- bogner wrote:
`B` is not a good name for an `IRBuilder` (despite that it does seem to be used a fair amount). `IRB` and `Builder` are both more common names for these, and I definitely lean towards the latter. https://github.com/llvm/llvm-project/pull/139633 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits