aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Support
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2008-03-16 20:05:52 +0000
committerBill Wendling <isanbard@gmail.com>2008-03-16 20:05:52 +0000
commitf7a91e68a8566c265ed6f4ab827d53a5c0c690ee (patch)
tree58fd9780f71662d892db0593eed97bbc8964e84c /lib/Support
parent1e75542cc45cfa42eea26b0189e69758c1b9394d (diff)
downloadexternal_llvm-f7a91e68a8566c265ed6f4ab827d53a5c0c690ee.zip
external_llvm-f7a91e68a8566c265ed6f4ab827d53a5c0c690ee.tar.gz
external_llvm-f7a91e68a8566c265ed6f4ab827d53a5c0c690ee.tar.bz2
Add assert for non-hexadecimal radixes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48421 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support')
-rw-r--r--lib/Support/APInt.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Support/APInt.cpp b/lib/Support/APInt.cpp
index 622d0f3..a853b92 100644
--- a/lib/Support/APInt.cpp
+++ b/lib/Support/APInt.cpp
@@ -1940,6 +1940,10 @@ void APInt::fromString(uint32_t numbits, const char *str, uint32_t slen,
assert(0 && "huh? we shouldn't get here");
} else if (isdigit(cdigit)) {
digit = cdigit - '0';
+ assert((radix == 10 ||
+ (radix == 8 && digit != 8 && digit != 9) ||
+ (radix == 2 && (digit == 0 || digit == 1))) &&
+ "Invalid digit in string for given radix");
} else {
assert(0 && "Invalid character in digit string");
}