[PATCH] D61350: [clang-tidy] New check calling out uses of +new in Objective-C code

Eugene Zelenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 30 18:09:23 PDT 2019


Eugene.Zelenko added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/google/AvoidNSObjectNewCheck.cpp:29
+
+bool isMessageExpressionInsideMacro(const ObjCMessageExpr *Expr) {
+  SourceLocation ReceiverLocation = Expr->getReceiverRange().getBegin();
----------------
Please use static instead anonymous namespace for functions. See LLVM Coding Guidelines. Same for other functions.


================
Comment at: clang-tools-extra/docs/ReleaseNotes.rst:107
+
+  Checks for calls to +new or overrides of it, which are prohibited by the
+  Google Objective-C style guide.
----------------
Please highlight +new with double back-ticks.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/google-objc-avoid-nsobject-new.rst:4
+google-objc-avoid-nsobject-new
+=========================
+
----------------
Length should be same as title.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/google-objc-avoid-nsobject-new.rst:6
+
+Finds uses of +new to create objects in Objective-C files.
+
----------------
Please synchronize first statement with Release Notes.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/google-objc-avoid-nsobject-new.rst:9
+The Google Objective-C style guide forbids calling +new or overriding it in
+class implementations, preferring +alloc and -init methods to instantiate
+objects.
----------------
Please highlight  +alloc and -init with double back-ticks.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/google-objc-avoid-nsobject-new.rst:19
+
+Instead, code should use +alloc/-init or class factory methods.
+
----------------
Please highlight +alloc/-init with double back-ticks.


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61350/new/

https://reviews.llvm.org/D61350





More information about the cfe-commits mailing list