[PATCH] D40528: add new check to find NSError init invocation
Yan Zhang via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 29 14:23:25 PST 2017
Wizard added inline comments.
================
Comment at: docs/clang-tidy/checks/objc-avoid-nserror-init.rst:10
+``errorWithDomain:code:userInfo:`` to create new NSError objects instead
+of ``[NSError alloc] init]``. Otherwise it will lead to a warning message
+during compilation in Xcode.
----------------
hokein wrote:
> Wizard wrote:
> > hokein wrote:
> > > What's the warning message in Xcode? I suspect whether there is a diagnostic flag in clang already.
> > It was discussed originally here https://buganizer.corp.google.com/issues/62445078 I think
> Thanks. Please don't include any internal links next time.
>
> Looks like the error message (https://stackoverflow.com/questions/33720042/why-does-nserror-alloc-init-in-xcode-throw-an-error) is shown during runtime, instead of compilation. Could you please confirm it, and update the document here?
>
> > [NSError init] called; this results in an invalid NSError instance. It will raise an exception in a future release. Please call errorWithDomain:code:userInfo: or initWithDomain:code:userInfo:. This message shown only once.
Oh yes it is shown during runtime. Will update the doc
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D40528
More information about the cfe-commits
mailing list