summaryrefslogtreecommitdiffstats
path: root/llvm/lib
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
commit9a11a0174f33aa95bffb39d3eef4ac74b7e46e97 (patch)
tree4ef9211c99363b147255b31bee7c1f93cb027a2e /llvm/lib
parentd0cc8dbd4d074ce51ad465a6ad10169ab2c1d653 (diff)
downloadbcm5719-llvm-9a11a0174f33aa95bffb39d3eef4ac74b7e46e97.tar.gz
bcm5719-llvm-9a11a0174f33aa95bffb39d3eef4ac74b7e46e97.zip
Add assert for non-hexadecimal radixes.
llvm-svn: 48421
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Support/APInt.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp
index 622d0f34362..a853b92ae41 100644
--- a/llvm/lib/Support/APInt.cpp
+++ b/llvm/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");
}
OpenPOWER on IntegriCloud