diff options
author | Mads Ravn <madsravn@gmail.com> | 2019-05-26 17:00:38 +0000 |
---|---|---|
committer | Mads Ravn <madsravn@gmail.com> | 2019-05-26 17:00:38 +0000 |
commit | bd324fa2273778430a4fdf8371fec5d64d2231bb (patch) | |
tree | 63889f0e6bc523087ba92179fff2f8e13f3c8edb /clang-tools-extra/test/clang-tidy/readability-delete-null-pointer.cpp | |
parent | a044410f37e9fbef56370bb4fab64b60e13b4ca2 (diff) | |
download | bcm5719-llvm-bd324fa2273778430a4fdf8371fec5d64d2231bb.tar.gz bcm5719-llvm-bd324fa2273778430a4fdf8371fec5d64d2231bb.zip |
DeleteNullPointerCheck now deletes until the end brace of the condition.
Patch by Jonathan Camilleri
Differential Revision https://reviews.llvm.org/D61861
llvm-svn: 361735
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/readability-delete-null-pointer.cpp')
-rw-r--r-- | clang-tools-extra/test/clang-tidy/readability-delete-null-pointer.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-tidy/readability-delete-null-pointer.cpp b/clang-tools-extra/test/clang-tidy/readability-delete-null-pointer.cpp index b46e52a754b..5a7ccae4d52 100644 --- a/clang-tools-extra/test/clang-tidy/readability-delete-null-pointer.cpp +++ b/clang-tools-extra/test/clang-tidy/readability-delete-null-pointer.cpp @@ -3,6 +3,15 @@ #define NULL 0 void f() { + int *ps = 0; + if (ps /**/) // #0 + delete ps; + // CHECK-MESSAGES: :[[@LINE-2]]:3: warning: 'if' statement is unnecessary; deleting null pointer has no effect [readability-delete-null-pointer] + + // CHECK-FIXES: int *ps = 0; + // CHECK-FIXES-NEXT: {{^ }}// #0 + // CHECK-FIXES-NEXT: delete ps; + int *p = 0; // #1 |