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

Function GenerateCode

test/val/val_layout_test.cpp:161–172  ·  view source on GitHub ↗

Creates a new vector which removes the string if the substr is found in the instructions vector and reinserts it in the location specified by order. NOTE: This will not work correctly if there are two instances of substr in instructions

Source from the content-addressed store, hash-verified

159// NOTE: This will not work correctly if there are two instances of substr in
160// instructions
161std::vector<std::string> GenerateCode(std::string substr, int order) {
162 std::vector<std::string> code(getInstructions().size());
163 std::vector<std::string> inst(1);
164 partition_copy(std::begin(getInstructions()), std::end(getInstructions()),
165 std::begin(code), std::begin(inst),
166 [=](const std::string& str) {
167 return std::string::npos == str.find(substr);
168 });
169
170 code.insert(std::begin(code) + order, inst.front());
171 return code;
172}
173
174// This test will check the logical layout of a binary by removing each
175// instruction in the pair of the INSTANTIATE_TEST_SUITE_P call and moving it in

Callers 1

TEST_PFunction · 0.70

Calls 3

frontMethod · 0.80
sizeMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected