clang 20.0.0git
|
#include "clang/AST/NSAPI.h"
Public Member Functions | |
NSAPI (ASTContext &Ctx) | |
ASTContext & | getASTContext () const |
IdentifierInfo * | getNSClassId (NSClassIdKindKind K) const |
Selector | getNSStringSelector (NSStringMethodKind MK) const |
The Objective-C NSString selectors. | |
bool | isNSUTF8StringEncodingConstant (const Expr *E) const |
Returns true if the expression. | |
bool | isNSASCIIStringEncodingConstant (const Expr *E) const |
Returns true if the expression. | |
Selector | getNSArraySelector (NSArrayMethodKind MK) const |
The Objective-C NSArray selectors. | |
std::optional< NSArrayMethodKind > | getNSArrayMethodKind (Selector Sel) |
Return NSArrayMethodKind if Sel is such a selector. | |
Selector | getNSDictionarySelector (NSDictionaryMethodKind MK) const |
The Objective-C NSDictionary selectors. | |
std::optional< NSDictionaryMethodKind > | getNSDictionaryMethodKind (Selector Sel) |
Return NSDictionaryMethodKind if Sel is such a selector. | |
Selector | getNSSetSelector (NSSetMethodKind MK) const |
The Objective-C NSSet selectors. | |
std::optional< NSSetMethodKind > | getNSSetMethodKind (Selector Sel) |
Return NSSetMethodKind if Sel is such a selector. | |
Selector | getObjectForKeyedSubscriptSelector () const |
Returns selector for "objectForKeyedSubscript:". | |
Selector | getObjectAtIndexedSubscriptSelector () const |
Returns selector for "objectAtIndexedSubscript:". | |
Selector | getSetObjectForKeyedSubscriptSelector () const |
Returns selector for "setObject:forKeyedSubscript". | |
Selector | getSetObjectAtIndexedSubscriptSelector () const |
Returns selector for "setObject:atIndexedSubscript". | |
Selector | getIsEqualSelector () const |
Returns selector for "isEqual:". | |
Selector | getNewSelector () const |
Selector | getInitSelector () const |
Selector | getNSNumberLiteralSelector (NSNumberLiteralMethodKind MK, bool Instance) const |
The Objective-C NSNumber selectors used to create NSNumber literals. | |
bool | isNSNumberLiteralSelector (NSNumberLiteralMethodKind MK, Selector Sel) const |
std::optional< NSNumberLiteralMethodKind > | getNSNumberLiteralMethodKind (Selector Sel) const |
Return NSNumberLiteralMethodKind if Sel is such a selector. | |
std::optional< NSNumberLiteralMethodKind > | getNSNumberFactoryMethodKind (QualType T) const |
Determine the appropriate NSNumber factory method kind for a literal of the given type. | |
bool | isObjCBOOLType (QualType T) const |
Returns true if. | |
bool | isObjCNSIntegerType (QualType T) const |
Returns true if. | |
bool | isObjCNSUIntegerType (QualType T) const |
Returns true if. | |
StringRef | GetNSIntegralKind (QualType T) const |
Returns one of NSIntegral typedef names if. | |
bool | isMacroDefined (StringRef Id) const |
Returns true if Id is currently defined as a macro. | |
bool | isSubclassOfNSClass (ObjCInterfaceDecl *InterfaceDecl, NSClassIdKindKind NSClassKind) const |
Returns true if InterfaceDecl is subclass of NSClassKind . | |
Static Public Attributes | |
static const unsigned | NumClassIds = 10 |
static const unsigned | NumNSStringMethods = 6 |
static const unsigned | NumNSArrayMethods = 12 |
static const unsigned | NumNSDictionaryMethods = 13 |
static const unsigned | NumNSSetMethods = 5 |
static const unsigned | NumNSNumberLiteralMethods = 15 |
Enumerates the NSArray/NSMutableArray methods used to generate literals and to apply some checks.
Enumerates the NSDictionary/NSMutableDictionary methods used to generate literals and to apply some checks.
Enumerates the NSNumber methods used to generate literals.
|
explicit |
|
inline |
Definition at line 27 of file NSAPI.h.
Referenced by doRewriteToUTF8StringBoxedExpressionHelper(), getNSArrayObjects(), clang::edit::rewriteObjCRedundantCallWithLiteral(), rewriteToArrayLiteral(), rewriteToArraySubscriptGet(), rewriteToArraySubscriptSet(), rewriteToDictionaryLiteral(), rewriteToDictionarySubscriptGet(), rewriteToDictionarySubscriptSet(), rewriteToNSEnumDecl(), rewriteToNumberLiteral(), rewriteToNumericBoxedExpression(), clang::edit::rewriteToObjCLiteralSyntax(), rewriteToObjCProperty(), clang::edit::rewriteToObjCSubscriptSyntax(), and shouldNotRewriteImmediateMessageArgs().
|
inline |
std::optional< NSAPI::NSArrayMethodKind > NSAPI::getNSArrayMethodKind | ( | Selector | Sel | ) |
Return NSArrayMethodKind if Sel
is such a selector.
Definition at line 138 of file NSAPI.cpp.
References getNSArraySelector(), and NumNSArrayMethods.
Selector NSAPI::getNSArraySelector | ( | NSArrayMethodKind | MK | ) | const |
The Objective-C NSArray selectors.
Definition at line 77 of file NSAPI.cpp.
References clang::IdentifierTable::get(), clang::SelectorTable::getNullarySelector(), clang::SelectorTable::getSelector(), clang::SelectorTable::getUnarySelector(), clang::ASTContext::Idents, NSArr_array, NSArr_arrayWithArray, NSArr_arrayWithObject, NSArr_arrayWithObjects, NSArr_arrayWithObjectsCount, NSArr_initWithArray, NSArr_initWithObjects, NSArr_objectAtIndex, NSMutableArr_addObject, NSMutableArr_insertObjectAtIndex, NSMutableArr_replaceObjectAtIndex, NSMutableArr_setObjectAtIndexedSubscript, and clang::ASTContext::Selectors.
Referenced by getNSArrayMethodKind(), getNSArrayObjects(), clang::edit::rewriteObjCRedundantCallWithLiteral(), rewriteToArrayLiteral(), and clang::edit::rewriteToObjCSubscriptSyntax().
IdentifierInfo * NSAPI::getNSClassId | ( | NSClassIdKindKind | K | ) | const |
Definition at line 23 of file NSAPI.cpp.
References clang::IdentifierTable::get(), clang::ASTContext::Idents, and NumClassIds.
Referenced by getNSArrayObjects(), isSubclassOfNSClass(), clang::edit::rewriteObjCRedundantCallWithLiteral(), clang::edit::rewriteToObjCLiteralSyntax(), and shouldNotRewriteImmediateMessageArgs().
std::optional< NSAPI::NSDictionaryMethodKind > NSAPI::getNSDictionaryMethodKind | ( | Selector | Sel | ) |
Return NSDictionaryMethodKind if Sel
is such a selector.
Definition at line 226 of file NSAPI.cpp.
References getNSDictionarySelector(), and NumNSDictionaryMethods.
Selector NSAPI::getNSDictionarySelector | ( | NSDictionaryMethodKind | MK | ) | const |
The Objective-C NSDictionary selectors.
Definition at line 148 of file NSAPI.cpp.
References clang::IdentifierTable::get(), clang::SelectorTable::getNullarySelector(), clang::SelectorTable::getSelector(), clang::SelectorTable::getUnarySelector(), clang::ASTContext::Idents, NSDict_dictionary, NSDict_dictionaryWithDictionary, NSDict_dictionaryWithObjectForKey, NSDict_dictionaryWithObjectsAndKeys, NSDict_dictionaryWithObjectsForKeys, NSDict_dictionaryWithObjectsForKeysCount, NSDict_initWithDictionary, NSDict_initWithObjectsAndKeys, NSDict_initWithObjectsForKeys, NSDict_objectForKey, NSMutableDict_setObjectForKey, NSMutableDict_setObjectForKeyedSubscript, NSMutableDict_setValueForKey, and clang::ASTContext::Selectors.
Referenced by getNSDictionaryMethodKind(), clang::edit::rewriteObjCRedundantCallWithLiteral(), rewriteToDictionaryLiteral(), clang::edit::rewriteToObjCSubscriptSyntax(), and shouldNotRewriteImmediateMessageArgs().
StringRef NSAPI::GetNSIntegralKind | ( | QualType | T | ) | const |
Returns one of NSIntegral typedef names if.
T | is a typedef of that name in objective-c. |
Definition at line 493 of file NSAPI.cpp.
References clang::FunctionProtoType::desugar(), clang::Type::getAs(), clang::ASTContext::getLangOpts(), and clang::T.
std::optional< NSAPI::NSNumberLiteralMethodKind > NSAPI::getNSNumberFactoryMethodKind | ( | QualType | T | ) | const |
Determine the appropriate NSNumber factory method kind for a literal of the given type.
Definition at line 349 of file NSAPI.cpp.
References clang::Type::getAs(), clang::BuiltinType::getKind(), isObjCBOOLType(), isObjCNSIntegerType(), isObjCNSUIntegerType(), NSNumberWithBool, NSNumberWithChar, NSNumberWithDouble, NSNumberWithFloat, NSNumberWithInt, NSNumberWithInteger, NSNumberWithLong, NSNumberWithLongLong, NSNumberWithShort, NSNumberWithUnsignedChar, NSNumberWithUnsignedInt, NSNumberWithUnsignedInteger, NSNumberWithUnsignedLong, NSNumberWithUnsignedLongLong, NSNumberWithUnsignedShort, and clang::T.
std::optional< NSAPI::NSNumberLiteralMethodKind > NSAPI::getNSNumberLiteralMethodKind | ( | Selector | Sel | ) | const |
Return NSNumberLiteralMethodKind if Sel
is such a selector.
Definition at line 338 of file NSAPI.cpp.
References isNSNumberLiteralSelector(), and NumNSNumberLiteralMethods.
Referenced by rewriteToNumberLiteral(), and rewriteToNumericBoxedExpression().
Selector NSAPI::getNSNumberLiteralSelector | ( | NSNumberLiteralMethodKind | MK, |
bool | Instance | ||
) | const |
The Objective-C NSNumber selectors used to create NSNumber literals.
Instance | if true it will return the selector for the init* method otherwise it will return the selector for the number* method. |
Definition at line 285 of file NSAPI.cpp.
References clang::IdentifierTable::get(), clang::SelectorTable::getUnarySelector(), clang::ASTContext::Idents, NumNSNumberLiteralMethods, and clang::ASTContext::Selectors.
Referenced by isNSNumberLiteralSelector().
std::optional< NSAPI::NSSetMethodKind > NSAPI::getNSSetMethodKind | ( | Selector | Sel | ) |
Return NSSetMethodKind if Sel
is such a selector.
Definition at line 275 of file NSAPI.cpp.
References getNSSetSelector(), and NumNSSetMethods.
Selector NSAPI::getNSSetSelector | ( | NSSetMethodKind | MK | ) | const |
The Objective-C NSSet selectors.
Definition at line 236 of file NSAPI.cpp.
References clang::IdentifierTable::get(), clang::SelectorTable::getSelector(), clang::SelectorTable::getUnarySelector(), clang::ASTContext::Idents, NSMutableSet_addObject, NSOrderedSet_insertObjectAtIndex, NSOrderedSet_replaceObjectAtIndexWithObject, NSOrderedSet_setObjectAtIndex, NSOrderedSet_setObjectAtIndexedSubscript, and clang::ASTContext::Selectors.
Referenced by getNSSetMethodKind().
Selector NSAPI::getNSStringSelector | ( | NSStringMethodKind | MK | ) | const |
The Objective-C NSString selectors.
Definition at line 43 of file NSAPI.cpp.
References clang::IdentifierTable::get(), clang::SelectorTable::getSelector(), clang::SelectorTable::getUnarySelector(), clang::ASTContext::Idents, NSStr_initWithString, NSStr_initWithUTF8String, NSStr_stringWithCString, NSStr_stringWithCStringEncoding, NSStr_stringWithString, NSStr_stringWithUTF8String, and clang::ASTContext::Selectors.
Referenced by clang::edit::rewriteObjCRedundantCallWithLiteral(), and rewriteToStringBoxedExpression().
|
inline |
Returns selector for "objectAtIndexedSubscript:".
Definition at line 143 of file NSAPI.h.
Referenced by rewriteToArraySubscriptGet().
|
inline |
Returns selector for "objectForKeyedSubscript:".
Definition at line 137 of file NSAPI.h.
Referenced by rewriteToDictionarySubscriptGet().
|
inline |
Returns selector for "setObject:atIndexedSubscript".
Definition at line 155 of file NSAPI.h.
Referenced by rewriteToArraySubscriptSet().
|
inline |
Returns selector for "setObject:forKeyedSubscript".
Definition at line 149 of file NSAPI.h.
Referenced by rewriteToDictionarySubscriptSet().
bool NSAPI::isMacroDefined | ( | StringRef | Id | ) | const |
Returns true
if Id
is currently defined as a macro.
Definition at line 519 of file NSAPI.cpp.
References clang::IdentifierTable::get(), clang::IdentifierInfo::hasMacroDefinition(), Id, and clang::ASTContext::Idents.
Referenced by rewriteToObjCProperty().
Returns true if the expression.
E | is a reference of "NSASCIIStringEncoding" enum constant. |
Definition at line 66 of file NSAPI.h.
References E.
Referenced by rewriteToStringBoxedExpression().
|
inline |
Definition at line 199 of file NSAPI.h.
References getNSNumberLiteralSelector().
Referenced by getNSNumberLiteralMethodKind(), rewriteToBoolLiteral(), and rewriteToCharLiteral().
Returns true if the expression.
E | is a reference of "NSUTF8StringEncoding" enum constant. |
Definition at line 60 of file NSAPI.h.
References E.
Referenced by rewriteToStringBoxedExpression().
Returns true if.
T | is a typedef of "BOOL" in objective-c. |
Definition at line 481 of file NSAPI.cpp.
References clang::T.
Referenced by getNSNumberFactoryMethodKind().
Returns true if.
T | is a typedef of "NSInteger" in objective-c. |
Definition at line 485 of file NSAPI.cpp.
References clang::T.
Referenced by getNSNumberFactoryMethodKind().
Returns true if.
T | is a typedef of "NSUInteger" in objective-c. |
Definition at line 489 of file NSAPI.cpp.
References clang::T.
Referenced by getNSNumberFactoryMethodKind().
bool NSAPI::isSubclassOfNSClass | ( | ObjCInterfaceDecl * | InterfaceDecl, |
NSClassIdKindKind | NSClassKind | ||
) | const |
Returns true
if InterfaceDecl
is subclass of NSClassKind
.
Definition at line 524 of file NSAPI.cpp.
References clang::NamedDecl::getIdentifier(), getNSClassId(), and clang::ObjCInterfaceDecl::getSuperClass().
|
static |
Definition at line 41 of file NSAPI.h.
Referenced by getNSClassId().
|
static |
Definition at line 86 of file NSAPI.h.
Referenced by getNSArrayMethodKind().
|
static |
Definition at line 111 of file NSAPI.h.
Referenced by getNSDictionaryMethodKind().
|
static |
Definition at line 191 of file NSAPI.h.
Referenced by getNSNumberLiteralMethodKind(), getNSNumberLiteralSelector(), and clang::Sema::Sema().
|
static |
Definition at line 128 of file NSAPI.h.
Referenced by getNSSetMethodKind().