clang-tools 22.0.0git
clang::tidy::objc Namespace Reference

Classes

class  AssertEquals
 Warn if XCTAssertEqual() or XCTAssertNotEqual() is used with at least one operands of type NSString*. More...
class  AvoidNSErrorInitCheck
 Finds usages of -[NSError init]. More...
class  DeallocInCategoryCheck
 Finds implementations of -dealloc in Objective-C categories. More...
class  ForbiddenSubclassingCheck
 Finds Objective-C classes which have a superclass which is documented to not support subclassing. More...
class  MissingHashCheck
 Finds Objective-C implementations that implement -isEqual: without also appropriately implementing -hash. More...
class  NSDateFormatterCheck
 Checks the string pattern used as a date format specifier and reports warnings if it contains any incorrect sub-pattern. More...
class  NSInvocationArgumentLifetimeCheck
 Finds calls to NSInvocation methods under ARC that don't have proper argument object lifetimes. More...
class  ObjCModule
class  PropertyDeclarationCheck
class  SuperSelfCheck
 Finds invocations of -self on super instances in initializers of subclasses of NSObject and recommends calling a superclass initializer instead. More...

Functions

static const std::map< std::string, std::string > & nameMap ()
static bool isValidDatePattern (StringRef Pattern)
static std::optional< FixItHint > fixItHintReplacementForOwnershipString (StringRef Text, CharSourceRange Range, StringRef Ownership)
static std::optional< FixItHint > fixItHintForVarDecl (const VarDecl *VD, const SourceManager &SM, const LangOptions &LangOpts)
static ClangTidyModuleRegistry::Add< ObjCModuleX ("objc-module", "Adds Objective-C lint checks.")
static FixItHint generateFixItHint (const ObjCPropertyDecl *Decl, NamingStyle Style)
 For now we will only fix 'CamelCase' or 'abc_CamelCase' property to 'camelCase' or 'abc_camelCase'.
static std::string validPropertyNameRegex (bool UsedInMatcher)
static bool hasCategoryPropertyPrefix (llvm::StringRef PropertyName)
static bool prefixedPropertyNameValid (llvm::StringRef PropertyName)

Variables

static char ValidDatePatternChars []
static constexpr StringRef WeakText = "__weak"
static constexpr StringRef StrongText = "__strong"
static constexpr StringRef UnsafeUnretainedText = "__unsafe_unretained"

Function Documentation

◆ fixItHintForVarDecl()

std::optional< FixItHint > clang::tidy::objc::fixItHintForVarDecl ( const VarDecl * VD,
const SourceManager & SM,
const LangOptions & LangOpts )
static

◆ fixItHintReplacementForOwnershipString()

std::optional< FixItHint > clang::tidy::objc::fixItHintReplacementForOwnershipString ( StringRef Text,
CharSourceRange Range,
StringRef Ownership )
static

Definition at line 56 of file NSInvocationArgumentLifetimeCheck.cpp.

References UnsafeUnretainedText.

Referenced by fixItHintForVarDecl().

◆ generateFixItHint()

FixItHint clang::tidy::objc::generateFixItHint ( const ObjCPropertyDecl * Decl,
NamingStyle Style )
static

For now we will only fix 'CamelCase' or 'abc_CamelCase' property to 'camelCase' or 'abc_camelCase'.

For other cases the users need to come up with a proper name by their own. FIXME: provide fix for snake_case to snakeCase

Definition at line 36 of file PropertyDeclarationCheck.cpp.

Referenced by clang::tidy::objc::PropertyDeclarationCheck::check().

◆ hasCategoryPropertyPrefix()

bool clang::tidy::objc::hasCategoryPropertyPrefix ( llvm::StringRef PropertyName)
static

◆ isValidDatePattern()

bool clang::tidy::objc::isValidDatePattern ( StringRef Pattern)
static

◆ nameMap()

const std::map< std::string, std::string > & clang::tidy::objc::nameMap ( )
static

◆ prefixedPropertyNameValid()

bool clang::tidy::objc::prefixedPropertyNameValid ( llvm::StringRef PropertyName)
static

◆ validPropertyNameRegex()

std::string clang::tidy::objc::validPropertyNameRegex ( bool UsedInMatcher)
static

◆ X()

ClangTidyModuleRegistry::Add< ObjCModule > clang::tidy::objc::X ( "objc-module" ,
"Adds Objective-C lint checks."  )
static

Variable Documentation

◆ StrongText

StringRef clang::tidy::objc::StrongText = "__strong"
staticconstexpr

Definition at line 34 of file NSInvocationArgumentLifetimeCheck.cpp.

Referenced by fixItHintForVarDecl().

◆ UnsafeUnretainedText

StringRef clang::tidy::objc::UnsafeUnretainedText = "__unsafe_unretained"
staticconstexpr

◆ ValidDatePatternChars

char clang::tidy::objc::ValidDatePatternChars[]
static
Initial value:
= {
'G', 'y', 'Y', 'u', 'U', 'r', 'Q', 'q', 'M', 'L', 'I', 'w', 'W', 'd',
'D', 'F', 'g', 'E', 'e', 'c', 'a', 'b', 'B', 'h', 'H', 'K', 'k', 'j',
'J', 'C', 'm', 's', 'S', 'A', 'z', 'Z', 'O', 'v', 'V', 'X', 'x'}

Definition at line 28 of file NSDateFormatterCheck.cpp.

Referenced by isValidDatePattern().

◆ WeakText

StringRef clang::tidy::objc::WeakText = "__weak"
staticconstexpr

Definition at line 33 of file NSInvocationArgumentLifetimeCheck.cpp.

Referenced by fixItHintForVarDecl().