diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-09-04 04:08:36 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-09-04 04:08:36 +0000 |
| commit | 55f5e657ee216f56b0b9cb4bcf5ca001441c9ae0 (patch) | |
| tree | 1d4637731e30cd0457f29b6d523164acd3501d3f /llvm/unittests/ADT/APIntTest.cpp | |
| parent | a7ab1b4206645e13caca39ae97eb27a0fd39a4a1 (diff) | |
| download | llvm-55f5e657ee216f56b0b9cb4bcf5ca001441c9ae0.zip llvm-55f5e657ee216f56b0b9cb4bcf5ca001441c9ae0.tar.gz llvm-55f5e657ee216f56b0b9cb4bcf5ca001441c9ae0.tar.bz2 | |
Fix APInt value initialization to give a zero value as any sane integer type
should, rather than giving a broken value that doesn't even zero/sign-extend
properly.
llvm-svn: 246836
Diffstat (limited to 'llvm/unittests/ADT/APIntTest.cpp')
| -rw-r--r-- | llvm/unittests/ADT/APIntTest.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/unittests/ADT/APIntTest.cpp b/llvm/unittests/ADT/APIntTest.cpp index ffba7b1..0002dad 100644 --- a/llvm/unittests/ADT/APIntTest.cpp +++ b/llvm/unittests/ADT/APIntTest.cpp @@ -17,6 +17,13 @@ using namespace llvm; namespace { +TEST(APIntTest, ValueInit) { + APInt Zero = APInt(); + EXPECT_TRUE(!Zero); + EXPECT_TRUE(!Zero.zext(64)); + EXPECT_TRUE(!Zero.sext(64)); +} + // Test that APInt shift left works when bitwidth > 64 and shiftamt == 0 TEST(APIntTest, ShiftLeftByZero) { APInt One = APInt::getNullValue(65) + 1; |
