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

Function get_flag_name

tools/util/flags.cpp:40–50  ·  view source on GitHub ↗

Extracts the flag name from a potential token. This function only looks for a '=', to split the flag name from the value for long-form flags. Returns the name of the flag, prefixed with the hyphen(s).

Source from the content-addressed store, hash-verified

38// This function only looks for a '=', to split the flag name from the value for
39// long-form flags. Returns the name of the flag, prefixed with the hyphen(s).
40inline std::string get_flag_name(const std::string& flag, bool is_short_flag) {
41 if (is_short_flag) {
42 return flag;
43 }
44
45 size_t equal_index = flag.find('=');
46 if (equal_index == std::string::npos) {
47 return flag;
48 }
49 return flag.substr(0, equal_index);
50}
51
52// Parse a boolean flag. Returns `true` if the parsing succeeded, `false`
53// otherwise.

Callers 1

parseMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected