From b026bf1fcc484b421d5ea735e88320f9c5ff6cfe Mon Sep 17 00:00:00 2001 From: Eugene Zelenko Date: Thu, 30 Nov 2017 21:42:27 +0000 Subject: [PATCH] [Documentation] Style fixes for Objective-C checks documentation to follow C/C++ example. Release Notes should just repeat first sentence from documentation. Remove duplicated entry from Release Notes. llvm-svn: 319479 --- clang-tools-extra/docs/ReleaseNotes.rst | 23 +++++++++------------- .../google-objc-avoid-throwing-exception.rst | 3 ++- .../google-objc-global-variable-declaration.rst | 12 +++++------ .../clang-tidy/checks/objc-avoid-nserror-init.rst | 4 ++-- .../checks/objc-forbidden-subclassing.rst | 17 ++++++++-------- .../checks/objc-property-declaration.rst | 2 +- 6 files changed, 29 insertions(+), 32 deletions(-) diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst index 8a7d0d1..f60e812 100644 --- a/clang-tools-extra/docs/ReleaseNotes.rst +++ b/clang-tools-extra/docs/ReleaseNotes.rst @@ -57,11 +57,6 @@ The improvements are... Improvements to clang-tidy -------------------------- -- New `objc-avoid-nserror-init - `_ check - - Add new check to detect the use of [NSError init]. - - New module `fuchsia` for Fuchsia style checks. - New module `objc` for Objective-C style checks. @@ -143,13 +138,13 @@ Improvements to clang-tidy - New `google-objc-avoid-throwing-exception `_ check - Add new check to detect throwing exceptions in Objective-C code, which should be avoided. + Finds uses of throwing exceptions usages in Objective-C files. - New `google-objc-global-variable-declaration `_ check - Add new check for Objective-C code to ensure global variables follow the - naming convention of 'k[A-Z].*' (for constants) or 'g[A-Z].*' (for variables). + Finds global variable declarations in Objective-C files that do not follow the + pattern of variable names in Google's Objective-C Style Guide. - New `hicpp-exception-baseclass `_ check @@ -166,7 +161,7 @@ Improvements to clang-tidy - New `objc-avoid-nserror-init `_ check - Add new check to detect the use of [NSError init]. + Finds improper initialization of ``NSError`` objects. - New `objc-avoid-spinlock `_ check @@ -177,15 +172,14 @@ Improvements to clang-tidy - New `objc-forbidden-subclassing `_ check - Ensures Objective-C classes do not subclass any classes which are - not intended to be subclassed. Includes a list of classes from Foundation - and UIKit which are documented as not supporting subclassing. + Finds Objective-C classes which are subclasses of classes which are not + designed to be subclassed. - New `objc-property-declaration `_ check - Add new check for Objective-C code to ensure property names follow the naming - convention of Apple's programming guide. + Finds property declarations in Objective-C files that do not follow the + pattern of property names in Apple's programming guide. - New `readability-static-accessed-through-instance `_ check @@ -245,6 +239,7 @@ Improvements to clang-tidy `_ The check's options were renamed as follows: + - `AllowConditionalIntegerCasts` -> `AllowIntegerConditions`, - `AllowConditionalPointerCasts` -> `AllowPointerConditions`. diff --git a/clang-tools-extra/docs/clang-tidy/checks/google-objc-avoid-throwing-exception.rst b/clang-tools-extra/docs/clang-tidy/checks/google-objc-avoid-throwing-exception.rst index 5710154..39b0217 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/google-objc-avoid-throwing-exception.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/google-objc-avoid-throwing-exception.rst @@ -3,7 +3,8 @@ google-objc-avoid-throwing-exception ==================================== -This check finds finds uses of throwing exceptions usages in Objective-C files. +Finds uses of throwing exceptions usages in Objective-C files. + For the same reason as the Google C++ style guide, we prefer not throwing exceptions from Objective-C code. diff --git a/clang-tools-extra/docs/clang-tidy/checks/google-objc-global-variable-declaration.rst b/clang-tools-extra/docs/clang-tidy/checks/google-objc-global-variable-declaration.rst index e850cc4..d470370 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/google-objc-global-variable-declaration.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/google-objc-global-variable-declaration.rst @@ -3,15 +3,15 @@ google-objc-global-variable-declaration ======================================= -Finds global variable declarations in Objective-C files that do not follow the pattern -of variable names in Google's Objective-C Style Guide. +Finds global variable declarations in Objective-C files that do not follow the +pattern of variable names in Google's Objective-C Style Guide. The corresponding style guide rule: http://google.github.io/styleguide/objcguide.html#variable-names All the global variables should follow the pattern of `g[A-Z].*` (variables) or -`k[A-Z].*` (constants). The check will suggest a variable name that follows the pattern -if it can be inferred from the original name. +`k[A-Z].*` (constants). The check will suggest a variable name that follows the +pattern if it can be inferred from the original name. For code: @@ -43,5 +43,5 @@ However for code that prefixed with non-alphabetical characters like: static NSString* __anotherString = @"world"; -The check will give a warning message but will not be able to suggest a fix. The user -need to fix it on his own. +The check will give a warning message but will not be able to suggest a fix. The +user need to fix it on his own. 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 index ce09d42..265794c 100644 --- 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 @@ -3,11 +3,11 @@ objc-avoid-nserror-init ======================= -This check will find out improper initialization of NSError objects. +Finds 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 +The corresponding information about ``NSError`` creation: https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/ErrorHandlingCocoa/CreateCustomizeNSError/CreateCustomizeNSError.html diff --git a/clang-tools-extra/docs/clang-tidy/checks/objc-forbidden-subclassing.rst b/clang-tools-extra/docs/clang-tidy/checks/objc-forbidden-subclassing.rst index 629f8b6..4bb023c 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/objc-forbidden-subclassing.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/objc-forbidden-subclassing.rst @@ -1,19 +1,20 @@ .. title:: clang-tidy - objc-forbidden-subclassing objc-forbidden-subclassing -================================== +========================== -Finds Objective-C classes which are subclasses of classes which are -not designed to be subclassed. +Finds Objective-C classes which are subclasses of classes which are not designed +to be subclassed. -By default, includes a list of Objective-C classes which -are publicly documented as not supporting subclassing. +By default, includes a list of Objective-C classes which are publicly documented +as not supporting subclassing. .. note:: Instead of using this check, for code under your control, you should add - ``__attribute__((objc_subclassing_restricted))`` before your ``@interface`` declarations - to ensure the compiler prevents others from subclassing your Objective-C classes. + ``__attribute__((objc_subclassing_restricted))`` before your ``@interface`` + declarations to ensure the compiler prevents others from subclassing your + Objective-C classes. See https://clang.llvm.org/docs/AttributeReference.html#objc-subclassing-restricted Options @@ -24,4 +25,4 @@ Options Semicolon-separated list of names of Objective-C classes which do not support subclassing. - Defaults to ``ABNewPersonViewController;ABPeoplePickerNavigationController;ABPersonViewController;ABUnknownPersonViewController;NSHashTable;NSMapTable;NSPointerArray;NSPointerFunctions;NSTimer;UIActionSheet;UIAlertView;UIImagePickerController;UITextInputMode;UIWebView``. + Defaults to `ABNewPersonViewController;ABPeoplePickerNavigationController;ABPersonViewController;ABUnknownPersonViewController;NSHashTable;NSMapTable;NSPointerArray;NSPointerFunctions;NSTimer;UIActionSheet;UIAlertView;UIImagePickerController;UITextInputMode;UIWebView`. diff --git a/clang-tools-extra/docs/clang-tidy/checks/objc-property-declaration.rst b/clang-tools-extra/docs/clang-tidy/checks/objc-property-declaration.rst index c372124..7732831 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/objc-property-declaration.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/objc-property-declaration.rst @@ -40,4 +40,4 @@ Options Semicolon-separated list of acronyms that can be used as prefix of property names. - Defaults to ``ASCII;PDF;XML;HTML;URL;RTF;HTTP;TIFF;JPG;PNG;GIF;LZW;ROM;RGB;CMYK;MIDI;FTP``. + Defaults to `ASCII;PDF;XML;HTML;URL;RTF;HTTP;TIFF;JPG;PNG;GIF;LZW;ROM;RGB;CMYK;MIDI;FTP`. -- 2.7.4