diff options
author | Yan Zhang <ynzhang@google.com> | 2017-11-30 19:05:08 +0000 |
---|---|---|
committer | Yan Zhang <ynzhang@google.com> | 2017-11-30 19:05:08 +0000 |
commit | 8c348b33385e5d1c39d2b8e0af956d889bac65a1 (patch) | |
tree | e7b6275529612c69038bb4b1a12e05249254df69 /clang-tools-extra/docs | |
parent | 59e3d198136da55656c67d67aa0d0d3695054373 (diff) | |
download | bcm5719-llvm-8c348b33385e5d1c39d2b8e0af956d889bac65a1.tar.gz bcm5719-llvm-8c348b33385e5d1c39d2b8e0af956d889bac65a1.zip |
add new check to find NSError init invocation
Summary:
This check will find out improper initialization of NSError objects.
According to Apple developer document, we should always use factory method errorWithDomain:code:userInfo: to create new NSError objects instead of [NSError alloc] init]. Otherwise it will lead to a warning message during runtime in Xcode.
The corresponding information about NSError creation: https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/ErrorHandlingCocoa/CreateCustomizeNSError/CreateCustomizeNSError.html
Reviewers: hokein, benhamilton
Reviewed By: benhamilton
Subscribers: klimek, mgorny, cfe-commits
Differential Revision: https://reviews.llvm.org/D40528
llvm-svn: 319459
Diffstat (limited to 'clang-tools-extra/docs')
-rw-r--r-- | clang-tools-extra/docs/ReleaseNotes.rst | 5 | ||||
-rw-r--r-- | clang-tools-extra/docs/clang-tidy/checks/list.rst | 1 | ||||
-rw-r--r-- | clang-tools-extra/docs/clang-tidy/checks/objc-avoid-nserror-init.rst | 13 |
3 files changed, 19 insertions, 0 deletions
diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst index acc6d9c4f45..f3078fc01a9 100644 --- a/clang-tools-extra/docs/ReleaseNotes.rst +++ b/clang-tools-extra/docs/ReleaseNotes.rst @@ -158,6 +158,11 @@ Improvements to clang-tidy Finds uses of bitwise operations on signed integer types, which may lead to undefined or implementation defined behaviour. +- New `objc-avoid-nserror-init + <http://clang.llvm.org/extra/clang-tidy/checks/objc-avoid-nserror-init.html>`_ check + + Add new check to detect the use of [NSError init]. + - New `objc-avoid-spinlock <http://clang.llvm.org/extra/clang-tidy/checks/objc-avoid-spinlock.html>`_ check diff --git a/clang-tools-extra/docs/clang-tidy/checks/list.rst b/clang-tools-extra/docs/clang-tidy/checks/list.rst index 1747ef23187..4feaa490507 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/list.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/list.rst @@ -173,6 +173,7 @@ Clang-Tidy Checks modernize-use-using mpi-buffer-deref mpi-type-mismatch + objc-avoid-nserror-init objc-avoid-spinlock objc-forbidden-subclassing objc-property-declaration diff --git a/clang-tools-extra/docs/clang-tidy/checks/objc-avoid-nserror-init.rst b/clang-tools-extra/docs/clang-tidy/checks/objc-avoid-nserror-init.rst new file mode 100644 index 00000000000..ce09d42413d --- /dev/null +++ b/clang-tools-extra/docs/clang-tidy/checks/objc-avoid-nserror-init.rst @@ -0,0 +1,13 @@ +.. title:: clang-tidy - objc-avoid-nserror-init + +objc-avoid-nserror-init +======================= + +This check will find out improper initialization of NSError objects. + +According to Apple developer document, we should always use factory method +``errorWithDomain:code:userInfo:`` to create new NSError objects instead +of ``[NSError alloc] init]``. Otherwise it will lead to a warning message +during runtime. + +The corresponding information about NSError creation: https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/ErrorHandlingCocoa/CreateCustomizeNSError/CreateCustomizeNSError.html |