Apply clang-tidy modernize-use-nullptr to googletest.

Now that googletest has moved to C++11, it should no longer
use NULL or 0 for the null pointer. This patch converts all
such usages to nullptr using clang-tidy.

This prevents LLVM from issuing -Wzero-as-null-pointer-constant
warnings.

PiperOrigin-RevId: 215814400
This commit is contained in:
Abseil Team
2018-10-04 18:28:05 -04:00
committed by Gennadiy Civil
parent f13bbe2992
commit 4bb49ed640
58 changed files with 705 additions and 1107 deletions

View File

@@ -697,7 +697,7 @@ TEST(ElementsAreArrayTest, CanBeCreatedWithIteratorRange) {
// Pointers are iterators, too.
EXPECT_THAT(test_vector, ElementsAreArray(a, a + GTEST_ARRAY_SIZE_(a)));
// The empty range of NULL pointers should also be okay.
int* const null_int = NULL;
int* const null_int = nullptr;
EXPECT_THAT(test_vector, Not(ElementsAreArray(null_int, null_int)));
EXPECT_THAT((vector<int>()), ElementsAreArray(null_int, null_int));
}
@@ -770,7 +770,7 @@ MATCHER_P2(EqSumOf, x, y, std::string(negation ? "doesn't equal" : "equals") +
} else {
// Verifies that we can stream to the underlying stream of
// result_listener.
if (result_listener->stream() != NULL) {
if (result_listener->stream() != nullptr) {
*result_listener->stream() << "diff == " << (x + y - arg);
}
return false;