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

Function parse_flag

tools/util/flags.cpp:119–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117// The iterator is moved to the last parsed token.
118template <typename T>
119bool parse_flag(Flag<T>& flag, bool is_short_flag, const char*** iterator) {
120 const std::string raw_flag(**iterator);
121 std::string raw_value;
122 const size_t equal_index = raw_flag.find('=');
123
124 if (is_short_flag || equal_index == std::string::npos) {
125 if ((*iterator)[1] == nullptr) {
126 return false;
127 }
128
129 // This is a bi-token flag. Moving iterator to the last parsed token.
130 raw_value = (*iterator)[1];
131 *iterator += 1;
132 } else {
133 // This is a mono-token flag, no need to move the iterator.
134 raw_value = raw_flag.substr(equal_index + 1);
135 }
136
137 return parse_flag_value(flag, raw_value);
138}
139
140} // namespace
141

Callers 1

parse_flag_infoMethod · 0.85

Calls 1

parse_flag_valueFunction · 0.85

Tested by

no test coverage detected