File tree Expand file tree Collapse file tree 2 files changed +18
-13
lines changed Expand file tree Collapse file tree 2 files changed +18
-13
lines changed Original file line number Diff line number Diff line change @@ -409,6 +409,9 @@ static unsigned GetAutoSenseRadix(StringRef &Str) {
409409
410410bool llvm::consumeUnsignedInteger (StringRef &Str, unsigned Radix,
411411 unsigned long long &Result) {
412+ // Consume the + value
413+ Str.consume_front (" +" );
414+
412415 // Autosense radix if not specified.
413416 if (Radix == 0 )
414417 Radix = GetAutoSenseRadix (Str);
Original file line number Diff line number Diff line change @@ -622,19 +622,21 @@ TEST(StringRefTest, Hashing) {
622622struct UnsignedPair {
623623 const char *Str;
624624 uint64_t Expected;
625- } Unsigned[] =
626- { {" 0" , 0 }
627- , {" 255" , 255 }
628- , {" 256" , 256 }
629- , {" 65535" , 65535 }
630- , {" 65536" , 65536 }
631- , {" 4294967295" , 4294967295ULL }
632- , {" 4294967296" , 4294967296ULL }
633- , {" 18446744073709551615" , 18446744073709551615ULL }
634- , {" 042" , 34 }
635- , {" 0x42" , 66 }
636- , {" 0b101010" , 42 }
637- };
625+ } Unsigned[] = {{" 0" , 0 },
626+ {" 255" , 255 },
627+ {" 256" , 256 },
628+ {" 65535" , 65535 },
629+ {" 65536" , 65536 },
630+ {" 4294967295" , 4294967295ULL },
631+ {" 4294967296" , 4294967296ULL },
632+ {" 18446744073709551615" , 18446744073709551615ULL },
633+ {" 042" , 34 },
634+ {" 0x42" , 66 },
635+ {" 0b101010" , 42 },
636+ {" +42" , 42 },
637+ {" +042" , 34 },
638+ {" +0x42" , 66 },
639+ {" +0b101010" , 42 }};
638640
639641struct SignedPair {
640642 const char *Str;
You can’t perform that action at this time.
0 commit comments