summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2012-09-25 22:32:51 +0000
committerJordan Rose <jordan_rose@apple.com>2012-09-25 22:32:51 +0000
commitde584de370ddfb0f320d143ee521b794f4da2c93 (patch)
tree75a8d3cbb858d5fe754a36dcd9feca64b10d0890
parentc30eb1c2828f494997b9289c0d1c0e22ef237d56 (diff)
downloadbcm5719-llvm-de584de370ddfb0f320d143ee521b794f4da2c93.tar.gz
bcm5719-llvm-de584de370ddfb0f320d143ee521b794f4da2c93.zip
Rename CanFitInto64Bits to alwaysFitsInto64Bits per discussion on IRC.
This makes the behavior clearer concerning literals with the maximum number of digits. For a 32-bit example, 4,000,000,000 is a valid uint32_t, but 5,000,000,000 is not, so we'd have to count 10-digit decimal numbers as "unsafe" (meaning we have to check for overflow when parsing them, just as we would for numbers with 11 digits or higher). This is the same, only with 64 bits to play with. No functionality change. llvm-svn: 164639
-rw-r--r--clang/lib/Lex/LiteralSupport.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Lex/LiteralSupport.cpp b/clang/lib/Lex/LiteralSupport.cpp
index d669c19a0c7..9171449968c 100644
--- a/clang/lib/Lex/LiteralSupport.cpp
+++ b/clang/lib/Lex/LiteralSupport.cpp
@@ -752,7 +752,7 @@ void NumericLiteralParser::ParseNumberStartingWithZero(SourceLocation TokLoc) {
}
}
-static bool CanFitInto64Bits(unsigned Radix, unsigned NumDigits) {
+static bool alwaysFitsInto64Bits(unsigned Radix, unsigned NumDigits) {
switch (Radix) {
case 2:
return NumDigits <= 64;
@@ -778,7 +778,7 @@ bool NumericLiteralParser::GetIntegerValue(llvm::APInt &Val) {
// handles the common cases that matter (small decimal integers and
// hex/octal values which don't overflow).
const unsigned NumDigits = SuffixBegin - DigitsBegin;
- if (CanFitInto64Bits(radix, NumDigits)) {
+ if (alwaysFitsInto64Bits(radix, NumDigits)) {
uint64_t N = 0;
for (const char *Ptr = DigitsBegin; Ptr != SuffixBegin; ++Ptr)
N = N * radix + HexDigitValue(*Ptr);
OpenPOWER on IntegriCloud