| 38 | } |
| 39 | |
| 40 | std::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 |
no test coverage detected