| 387 | } |
| 388 | |
| 389 | static unsigned GetAutoSenseRadix(StringRef &Str) { |
| 390 | if (Str.empty()) |
| 391 | return 10; |
| 392 | |
| 393 | if (Str.startswith("0x") || Str.startswith("0X")) { |
| 394 | Str = Str.substr(2); |
| 395 | return 16; |
| 396 | } |
| 397 | |
| 398 | if (Str.startswith("0b") || Str.startswith("0B")) { |
| 399 | Str = Str.substr(2); |
| 400 | return 2; |
| 401 | } |
| 402 | |
| 403 | if (Str.startswith("0o")) { |
| 404 | Str = Str.substr(2); |
| 405 | return 8; |
| 406 | } |
| 407 | |
| 408 | if (Str[0] == '0' && Str.size() > 1 && isDigit(Str[1])) { |
| 409 | Str = Str.substr(1); |
| 410 | return 8; |
| 411 | } |
| 412 | |
| 413 | return 10; |
| 414 | } |
| 415 | |
| 416 | bool llvm::consumeUnsignedInteger(StringRef &Str, unsigned Radix, |
| 417 | unsigned long long &Result) { |
no test coverage detected