X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=unittests%2FSupport%2FCasting.cpp;h=88c7d19aa464bfe1af80f0d6fc1e4a1a9d407757;hb=d52e9a143f254be7ac1f2e648f3c3dbe278f4711;hp=362abeecd07ad54beae9941cb23e31c169a6d861;hpb=60f18ad8a5fa7d5b008a1fecf9a79b68883ca192;p=oota-llvm.git diff --git a/unittests/Support/Casting.cpp b/unittests/Support/Casting.cpp index 362abeecd07..88c7d19aa46 100644 --- a/unittests/Support/Casting.cpp +++ b/unittests/Support/Casting.cpp @@ -8,9 +8,9 @@ //===----------------------------------------------------------------------===// #include "llvm/Support/Casting.h" +#include "llvm/IR/User.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" -#include "llvm/IR/User.h" #include "gtest/gtest.h" #include @@ -18,7 +18,7 @@ namespace llvm { // Used to test illegal cast. If a cast doesn't match any of the "real" ones, // it will match this one. struct IllegalCast; -template IllegalCast *cast(...) { return 0; } +template IllegalCast *cast(...) { return nullptr; } // set up two example classes // with conversion facility @@ -77,16 +77,20 @@ using namespace llvm; // Test the peculiar behavior of Use in simplify_type. -int Check1[is_same::SimpleType, Value *>::value ? 1 : -1]; -int Check2[is_same::SimpleType, Value *>::value ? 1 : -1]; +static_assert(std::is_same::SimpleType, Value *>::value, + "Use doesn't simplify correctly!"); +static_assert(std::is_same::SimpleType, Value *>::value, + "Use doesn't simplify correctly!"); // Test that a regular class behaves as expected. -int Check3[is_same::SimpleType, int>::value ? 1 : -1]; -int Check4[is_same::SimpleType, foo *>::value ? 1 : -1]; +static_assert(std::is_same::SimpleType, int>::value, + "Unexpected simplify_type result!"); +static_assert(std::is_same::SimpleType, foo *>::value, + "Unexpected simplify_type result!"); namespace { -const foo *null_foo = NULL; +const foo *null_foo = nullptr; bar B; extern bar &B1; @@ -171,7 +175,7 @@ TEST(CastingTest, dyn_cast_or_null) { const bar *B2 = &B; } // anonymous namespace -bar *llvm::fub() { return 0; } +bar *llvm::fub() { return nullptr; } namespace { namespace inferred_upcasting { @@ -199,7 +203,7 @@ TEST(CastingTest, UpcastIsInferred) { Derived D; EXPECT_TRUE(isa(D)); Base *BP = dyn_cast(&D); - EXPECT_TRUE(BP != NULL); + EXPECT_TRUE(BP != nullptr); }