| 2243 | namespace { |
| 2244 | |
| 2245 | void validateOption(Optional<StringRef> value, bool canBePresent, bool canBeAbsent, bool canBeEmpty = true) { |
| 2246 | ASSERT(canBePresent || canBeAbsent); |
| 2247 | |
| 2248 | if (!canBePresent && value.present() && (!canBeEmpty || value.get().size() > 0)) { |
| 2249 | throw invalid_option_value(); |
| 2250 | } |
| 2251 | if (!canBeAbsent && (!value.present() || (!canBeEmpty && value.get().size() == 0))) { |
| 2252 | throw invalid_option_value(); |
| 2253 | } |
| 2254 | } |
| 2255 | |
| 2256 | } // namespace |
| 2257 |
no test coverage detected