MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / ExtractSource

Function ExtractSource

test/tools/objdump/extract_source_test.cpp:30–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28constexpr auto kDefaultEnvironment = SPV_ENV_UNIVERSAL_1_6;
29
30std::pair<bool, std::unordered_map<std::string, std::string>> ExtractSource(
31 const std::string& spv_source) {
32 std::unique_ptr<spvtools::opt::IRContext> ctx = spvtools::BuildModule(
33 kDefaultEnvironment, spvtools::utils::CLIMessageConsumer, spv_source,
34 spvtools::SpirvTools::kDefaultAssembleOption |
35 SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS);
36 std::vector<uint32_t> binary;
37 ctx->module()->ToBinary(&binary, /* skip_nop = */ false);
38 std::unordered_map<std::string, std::string> output;
39 bool result = ExtractSourceFromModule(binary, &output);
40 return std::make_pair(result, std::move(output));
41}
42
43} // namespace
44

Callers 1

TESTFunction · 0.85

Calls 4

ExtractSourceFromModuleFunction · 0.85
BuildModuleFunction · 0.50
ToBinaryMethod · 0.45
moduleMethod · 0.45

Tested by

no test coverage detected