summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/clang-tidy/modernize-use-nullptr.cpp
diff options
context:
space:
mode:
authorHaojian Wu <hokein@google.com>2016-02-26 15:34:35 +0000
committerHaojian Wu <hokein@google.com>2016-02-26 15:34:35 +0000
commit0d5e9d3135f3f7784ca8c708699b324a644b97c7 (patch)
tree72742a920c426983cfd92fc1d8ef162b2a27a1e5 /clang-tools-extra/test/clang-tidy/modernize-use-nullptr.cpp
parent0ed9c497cad8da231d8316fb7502ad26855fa927 (diff)
downloadbcm5719-llvm-0d5e9d3135f3f7784ca8c708699b324a644b97c7.tar.gz
bcm5719-llvm-0d5e9d3135f3f7784ca8c708699b324a644b97c7.zip
[clang-tidy] Fix an assertion failure in `modernize-use-nullptr` check.
Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D17640 llvm-svn: 262024
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/modernize-use-nullptr.cpp')
-rw-r--r--clang-tools-extra/test/clang-tidy/modernize-use-nullptr.cpp12
1 files changed, 12 insertions, 0 deletions
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 6b41cfbe4ab..a21a43ad85c 100644
--- a/clang-tools-extra/test/clang-tidy/modernize-use-nullptr.cpp
+++ b/clang-tools-extra/test/clang-tidy/modernize-use-nullptr.cpp
@@ -183,6 +183,18 @@ void test_macro_args() {
// CHECK-MESSAGES: :[[@LINE-2]]:24: warning: use nullptr
// CHECK-FIXES: a[2] = {ENTRY(nullptr), {nullptr}};
#undef ENTRY
+
+#define assert1(expr) (expr) ? 0 : 1
+#define assert2 assert1
+ int *p;
+ assert2(p == 0);
+ // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: use nullptr
+ // CHECK-FIXES: assert2(p == nullptr);
+ assert2(p == NULL);
+ // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: use nullptr
+ // CHECK-FIXES: assert2(p == nullptr);
+#undef assert2
+#undef assert1
}
// One of the ancestor of the cast is a NestedNameSpecifierLoc.
OpenPOWER on IntegriCloud