diff options
author | Szabolcs Sipos <szabolcs.sipos@ericsson.com> | 2015-05-08 07:56:24 +0000 |
---|---|---|
committer | Szabolcs Sipos <szabolcs.sipos@ericsson.com> | 2015-05-08 07:56:24 +0000 |
commit | 60ce8bb0be2fb23aebd5e3a2240e89414640c64b (patch) | |
tree | 2b02e1179313e44a3848e4fe41863de561382d07 /clang-tools-extra/test/clang-tidy/misc-static-assert.cpp | |
parent | 69694b069193fdb446dffa84043b218f84e93957 (diff) | |
download | bcm5719-llvm-60ce8bb0be2fb23aebd5e3a2240e89414640c64b.tar.gz bcm5719-llvm-60ce8bb0be2fb23aebd5e3a2240e89414640c64b.zip |
[clang-tidy] Fix for llvm.org/PR23161
The misc-static-assert check will not warn on the followings:
assert(NULL == "shouldn't warn");
assert(__null == "shouldn't warn");
Where NULL is a macro defined as __null.
llvm-svn: 236812
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/misc-static-assert.cpp')
-rw-r--r-- | clang-tools-extra/test/clang-tidy/misc-static-assert.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-tidy/misc-static-assert.cpp b/clang-tools-extra/test/clang-tidy/misc-static-assert.cpp index ff304b96927..5a40c304173 100644 --- a/clang-tools-extra/test/clang-tidy/misc-static-assert.cpp +++ b/clang-tools-extra/test/clang-tidy/misc-static-assert.cpp @@ -95,6 +95,12 @@ int main() { assert(NULL && "Report me!"); // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: found assert() that could be // CHECK-FIXES: {{^ }}static_assert(NULL , "Report me!"); + +#define NULL __null + assert(__null == "Don't report me!"); + // CHECK-FIXES: {{^ }}assert(__null == "Don't report me!"); + assert(NULL == "Don't report me!"); + // CHECK-FIXES: {{^ }}assert(NULL == "Don't report me!"); #undef NULL assert(ZERO_MACRO && "Report me!"); |