Index: clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp @@ -235,7 +235,7 @@ allArgUsesValid(C)) { replaceWithNullptr(Check, SM, FileLocStart, FileLocEnd); } - return skipSubTree(); + return true; } if (SM.isMacroBodyExpansion(StartLoc) && SM.isMacroBodyExpansion(EndLoc)) { Index: clang-tools-extra/trunk/test/clang-tidy/modernize-use-nullptr.cpp =================================================================== --- clang-tools-extra/trunk/test/clang-tidy/modernize-use-nullptr.cpp +++ clang-tools-extra/trunk/test/clang-tidy/modernize-use-nullptr.cpp @@ -275,3 +275,31 @@ G(g(static_cast(nullptr))); G(g(static_cast(nullptr))); } + +// Test on recognizing multiple NULLs. +class H { +public: + H(bool); +}; + +#define T(expression) H(expression); +bool h(int *, int *, int * = nullptr); +void test_multiple_nulls() { + T(h(NULL, NULL)); +// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use nullptr +// CHECK-MESSAGES: :[[@LINE-2]]:13: warning: use nullptr +// CHECK-FIXES: T(h(nullptr, nullptr)); + T(h(NULL, nullptr)); +// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use nullptr +// CHECK-FIXES: T(h(nullptr, nullptr)); + T(h(nullptr, NULL)); +// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: use nullptr +// CHECK-FIXES: T(h(nullptr, nullptr)); + T(h(nullptr, nullptr)); + T(h(NULL, NULL, NULL)); +// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use nullptr +// CHECK-MESSAGES: :[[@LINE-2]]:13: warning: use nullptr +// CHECK-MESSAGES: :[[@LINE-3]]:19: warning: use nullptr +// CHECK-FIXES: T(h(nullptr, nullptr, nullptr)); +} +#undef T