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

Method parse_flag_info

tools/util/flags.cpp:143–162  ·  view source on GitHub ↗

This is the function to expand if you want to support a new type.

Source from the content-addressed store, hash-verified

141
142// This is the function to expand if you want to support a new type.
143bool FlagList::parse_flag_info(FlagInfo& info, token_iterator_t* iterator) {
144 bool success = false;
145
146 std::visit(
147 [&](auto&& item) {
148 using T = std::decay_t<decltype(item.get())>;
149 if constexpr (std::is_same_v<T, Flag<bool>>) {
150 success = parse_bool_flag(item.get(), info.is_short, **iterator);
151 } else if constexpr (std::is_same_v<T, Flag<std::string>>) {
152 success = parse_flag(item.get(), info.is_short, iterator);
153 } else if constexpr (std::is_same_v<T, Flag<uint32_t>>) {
154 success = parse_flag(item.get(), info.is_short, iterator);
155 } else {
156 static_assert(always_false_v<T>, "Unsupported flag type.");
157 }
158 },
159 info.flag);
160
161 return success;
162}
163
164bool FlagList::parse(token_t* argv) {
165 flags::positional_arguments.clear();

Callers

nothing calls this directly

Calls 3

parse_bool_flagFunction · 0.85
parse_flagFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected