Convert NULL and 0 to nullptr in base using clang-tidy.
Steps to replicate:
1. Build clang-tidy and clang-apply-replacements as described here: https://chromium.googlesource.com/chromium/src/+/lkcr/docs/clang_tidy.md
2. Build targets necessary for the change in out/gn.
3. Generate the compilation database:
tools/clang/scripts/generate_compdb.py -p out/gn > compile_commands.json
4. Run clang-tidy and apply replacements:
cd out/gn && PATH_TO_RUN_CLANG_TIDY/run-clang-tidy.py -p ../../ -clang-tidy-binary PATH_TO_CLANG_TIDY_BINARY -clang-apply-replacements-binary PATH_TO_CLANG_APPLY_REPLACEMENTS_BINARY -checks=-*,modernize-use-nullptr -fix -j 8 DIR_TO_CONVERT
Bug: 403854, 776257
Change-Id: I920f43d09b9fab758a3b8663fcf0c405d8519ad4
Reviewed-on: https://chromium-review.googlesource.com/732105
Commit-Queue: Ivan Kotenkov <[email protected]>
Reviewed-by: danakj <[email protected]>
Cr-Commit-Position: refs/heads/master@{#514808}
diff --git a/base/at_exit_unittest.cc b/base/at_exit_unittest.cc
index cda7340..3de061f 100644
--- a/base/at_exit_unittest.cc
+++ b/base/at_exit_unittest.cc
@@ -30,7 +30,7 @@
}
void ExpectParamIsNull(void* param) {
- EXPECT_EQ(static_cast<void*>(NULL), param);
+ EXPECT_EQ(nullptr, param);
}
void ExpectParamIsCounter(void* param) {
@@ -48,9 +48,9 @@
TEST_F(AtExitTest, Basic) {
ZeroTestCounters();
- base::AtExitManager::RegisterCallback(&IncrementTestCounter1, NULL);
- base::AtExitManager::RegisterCallback(&IncrementTestCounter2, NULL);
- base::AtExitManager::RegisterCallback(&IncrementTestCounter1, NULL);
+ base::AtExitManager::RegisterCallback(&IncrementTestCounter1, nullptr);
+ base::AtExitManager::RegisterCallback(&IncrementTestCounter2, nullptr);
+ base::AtExitManager::RegisterCallback(&IncrementTestCounter1, nullptr);
EXPECT_EQ(0, g_test_counter_1);
EXPECT_EQ(0, g_test_counter_2);
@@ -61,9 +61,9 @@
TEST_F(AtExitTest, LIFOOrder) {
ZeroTestCounters();
- base::AtExitManager::RegisterCallback(&IncrementTestCounter1, NULL);
- base::AtExitManager::RegisterCallback(&ExpectCounter1IsZero, NULL);
- base::AtExitManager::RegisterCallback(&IncrementTestCounter2, NULL);
+ base::AtExitManager::RegisterCallback(&IncrementTestCounter1, nullptr);
+ base::AtExitManager::RegisterCallback(&ExpectCounter1IsZero, nullptr);
+ base::AtExitManager::RegisterCallback(&IncrementTestCounter2, nullptr);
EXPECT_EQ(0, g_test_counter_1);
EXPECT_EQ(0, g_test_counter_2);
@@ -73,7 +73,7 @@
}
TEST_F(AtExitTest, Param) {
- base::AtExitManager::RegisterCallback(&ExpectParamIsNull, NULL);
+ base::AtExitManager::RegisterCallback(&ExpectParamIsNull, nullptr);
base::AtExitManager::RegisterCallback(&ExpectParamIsCounter,
&g_test_counter_1);
base::AtExitManager::ProcessCallbacksNow();