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

Function SplitFlagArgs

source/util/string_utils.cpp:40–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40std::pair<std::string, std::string> SplitFlagArgs(const std::string& flag) {
41 if (flag.size() < 2) return make_pair(flag, std::string());
42
43 // Detect the last dash before the pass name. Since we have to
44 // handle single dash options (-O and -Os), count up to two dashes.
45 size_t dash_ix = 0;
46 if (flag[0] == '-' && flag[1] == '-')
47 dash_ix = 2;
48 else if (flag[0] == '-')
49 dash_ix = 1;
50
51 size_t ix = flag.find('=');
52 return (ix != std::string::npos)
53 ? make_pair(flag.substr(dash_ix, ix - 2), flag.substr(ix + 1))
54 : make_pair(flag.substr(dash_ix), std::string());
55}
56
57} // namespace utils
58} // namespace spvtools

Callers 4

ParseFlagsFunction · 0.85
ParseFlagsFunction · 0.85
ParseFlagsFunction · 0.85
RegisterPassFromFlagMethod · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected