summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2015-08-20 01:44:14 +0000
committerAlexander Kornienko <alexfh@google.com>2015-08-20 01:44:14 +0000
commit20ce95f2940778da4b877865141e6cbecc73d43a (patch)
treeb109faf00f6276d40e66b98212ba1c8978d3b5ab
parent99f25befee1c9698fa4c8e2b68a3bf2257eacd33 (diff)
downloadbcm5719-llvm-20ce95f2940778da4b877865141e6cbecc73d43a.tar.gz
bcm5719-llvm-20ce95f2940778da4b877865141e6cbecc73d43a.zip
[clang-tidy] Add back a test with a custom NULL macro. Remove redundant default.
llvm-svn: 245533
-rw-r--r--clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp2
-rw-r--r--clang-tools-extra/test/clang-tidy/modernize-use-nullptr.cpp8
2 files changed, 9 insertions, 1 deletions
diff --git a/clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp
index 3f3ff99f2d3..8a0a37101c6 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp
@@ -441,7 +441,7 @@ private:
UseNullptrCheck::UseNullptrCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
- NullMacrosStr(Options.get("NullMacros", "NULL")) {
+ NullMacrosStr(Options.get("NullMacros", "")) {
StringRef(NullMacrosStr).split(NullMacros, ",");
}
diff --git a/clang-tools-extra/test/clang-tidy/modernize-use-nullptr.cpp b/clang-tools-extra/test/clang-tidy/modernize-use-nullptr.cpp
index 8370bfa22e3..f176fca71cb 100644
--- a/clang-tools-extra/test/clang-tidy/modernize-use-nullptr.cpp
+++ b/clang-tools-extra/test/clang-tidy/modernize-use-nullptr.cpp
@@ -78,6 +78,14 @@ void test_macro_expansion3() {
#undef MACRO_EXPANSION_HAS_NULL
}
+void test_macro_expansion4() {
+#define MY_NULL NULL
+ int *p = MY_NULL;
+ // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: use nullptr [modernize-use-nullptr]
+ // CHECK-FIXES: int *p = nullptr;
+#undef MY_NULL
+}
+
#define IS_EQ(x, y) if (x != y) return;
void test_macro_args() {
int i = 0;
OpenPOWER on IntegriCloud