clang 20.0.0git
NSAPI.cpp
Go to the documentation of this file.
1//===--- NSAPI.cpp - NSFoundation APIs ------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "clang/AST/NSAPI.h"
11#include "clang/AST/DeclObjC.h"
12#include "clang/AST/Expr.h"
13#include "llvm/ADT/StringSwitch.h"
14#include <optional>
15
16using namespace clang;
17
19 : Ctx(ctx), ClassIds(), BOOLId(nullptr), NSIntegerId(nullptr),
20 NSUIntegerId(nullptr), NSASCIIStringEncodingId(nullptr),
21 NSUTF8StringEncodingId(nullptr) {}
22
24 static const char *ClassName[NumClassIds] = {
25 "NSObject",
26 "NSString",
27 "NSArray",
28 "NSMutableArray",
29 "NSDictionary",
30 "NSMutableDictionary",
31 "NSNumber",
32 "NSMutableSet",
33 "NSMutableOrderedSet",
34 "NSValue"
35 };
36
37 if (!ClassIds[K])
38 return (ClassIds[K] = &Ctx.Idents.get(ClassName[K]));
39
40 return ClassIds[K];
41}
42
44 if (NSStringSelectors[MK].isNull()) {
45 Selector Sel;
46 switch (MK) {
48 Sel = Ctx.Selectors.getUnarySelector(&Ctx.Idents.get("stringWithString"));
49 break;
52 &Ctx.Idents.get("stringWithUTF8String"));
53 break;
56 &Ctx.Idents.get("initWithUTF8String"));
57 break;
59 const IdentifierInfo *KeyIdents[] = {&Ctx.Idents.get("stringWithCString"),
60 &Ctx.Idents.get("encoding")};
61 Sel = Ctx.Selectors.getSelector(2, KeyIdents);
62 break;
63 }
65 Sel= Ctx.Selectors.getUnarySelector(&Ctx.Idents.get("stringWithCString"));
66 break;
68 Sel = Ctx.Selectors.getUnarySelector(&Ctx.Idents.get("initWithString"));
69 break;
70 }
71 return (NSStringSelectors[MK] = Sel);
72 }
73
74 return NSStringSelectors[MK];
75}
76
78 if (NSArraySelectors[MK].isNull()) {
79 Selector Sel;
80 switch (MK) {
81 case NSArr_array:
82 Sel = Ctx.Selectors.getNullarySelector(&Ctx.Idents.get("array"));
83 break;
85 Sel = Ctx.Selectors.getUnarySelector(&Ctx.Idents.get("arrayWithArray"));
86 break;
88 Sel = Ctx.Selectors.getUnarySelector(&Ctx.Idents.get("arrayWithObject"));
89 break;
91 Sel = Ctx.Selectors.getUnarySelector(&Ctx.Idents.get("arrayWithObjects"));
92 break;
94 const IdentifierInfo *KeyIdents[] = {&Ctx.Idents.get("arrayWithObjects"),
95 &Ctx.Idents.get("count")};
96 Sel = Ctx.Selectors.getSelector(2, KeyIdents);
97 break;
98 }
100 Sel = Ctx.Selectors.getUnarySelector(&Ctx.Idents.get("initWithArray"));
101 break;
103 Sel = Ctx.Selectors.getUnarySelector(&Ctx.Idents.get("initWithObjects"));
104 break;
106 Sel = Ctx.Selectors.getUnarySelector(&Ctx.Idents.get("objectAtIndex"));
107 break;
109 const IdentifierInfo *KeyIdents[] = {
110 &Ctx.Idents.get("replaceObjectAtIndex"),
111 &Ctx.Idents.get("withObject")};
112 Sel = Ctx.Selectors.getSelector(2, KeyIdents);
113 break;
114 }
116 Sel = Ctx.Selectors.getUnarySelector(&Ctx.Idents.get("addObject"));
117 break;
119 const IdentifierInfo *KeyIdents[] = {&Ctx.Idents.get("insertObject"),
120 &Ctx.Idents.get("atIndex")};
121 Sel = Ctx.Selectors.getSelector(2, KeyIdents);
122 break;
123 }
125 const IdentifierInfo *KeyIdents[] = {
126 &Ctx.Idents.get("setObject"), &Ctx.Idents.get("atIndexedSubscript")};
127 Sel = Ctx.Selectors.getSelector(2, KeyIdents);
128 break;
129 }
130 }
131 return (NSArraySelectors[MK] = Sel);
132 }
133
134 return NSArraySelectors[MK];
135}
136
137std::optional<NSAPI::NSArrayMethodKind>
139 for (unsigned i = 0; i != NumNSArrayMethods; ++i) {
141 if (Sel == getNSArraySelector(MK))
142 return MK;
143 }
144
145 return std::nullopt;
146}
147
149 NSDictionaryMethodKind MK) const {
150 if (NSDictionarySelectors[MK].isNull()) {
151 Selector Sel;
152 switch (MK) {
154 Sel = Ctx.Selectors.getNullarySelector(&Ctx.Idents.get("dictionary"));
155 break;
157 Sel = Ctx.Selectors.getUnarySelector(
158 &Ctx.Idents.get("dictionaryWithDictionary"));
159 break;
161 const IdentifierInfo *KeyIdents[] = {
162 &Ctx.Idents.get("dictionaryWithObject"), &Ctx.Idents.get("forKey")};
163 Sel = Ctx.Selectors.getSelector(2, KeyIdents);
164 break;
165 }
167 const IdentifierInfo *KeyIdents[] = {
168 &Ctx.Idents.get("dictionaryWithObjects"), &Ctx.Idents.get("forKeys")};
169 Sel = Ctx.Selectors.getSelector(2, KeyIdents);
170 break;
171 }
173 const IdentifierInfo *KeyIdents[] = {
174 &Ctx.Idents.get("dictionaryWithObjects"), &Ctx.Idents.get("forKeys"),
175 &Ctx.Idents.get("count")};
176 Sel = Ctx.Selectors.getSelector(3, KeyIdents);
177 break;
178 }
180 Sel = Ctx.Selectors.getUnarySelector(
181 &Ctx.Idents.get("dictionaryWithObjectsAndKeys"));
182 break;
184 Sel = Ctx.Selectors.getUnarySelector(
185 &Ctx.Idents.get("initWithDictionary"));
186 break;
188 Sel = Ctx.Selectors.getUnarySelector(
189 &Ctx.Idents.get("initWithObjectsAndKeys"));
190 break;
192 const IdentifierInfo *KeyIdents[] = {&Ctx.Idents.get("initWithObjects"),
193 &Ctx.Idents.get("forKeys")};
194 Sel = Ctx.Selectors.getSelector(2, KeyIdents);
195 break;
196 }
198 Sel = Ctx.Selectors.getUnarySelector(&Ctx.Idents.get("objectForKey"));
199 break;
201 const IdentifierInfo *KeyIdents[] = {&Ctx.Idents.get("setObject"),
202 &Ctx.Idents.get("forKey")};
203 Sel = Ctx.Selectors.getSelector(2, KeyIdents);
204 break;
205 }
207 const IdentifierInfo *KeyIdents[] = {
208 &Ctx.Idents.get("setObject"), &Ctx.Idents.get("forKeyedSubscript")};
209 Sel = Ctx.Selectors.getSelector(2, KeyIdents);
210 break;
211 }
213 const IdentifierInfo *KeyIdents[] = {&Ctx.Idents.get("setValue"),
214 &Ctx.Idents.get("forKey")};
215 Sel = Ctx.Selectors.getSelector(2, KeyIdents);
216 break;
217 }
218 }
219 return (NSDictionarySelectors[MK] = Sel);
220 }
221
222 return NSDictionarySelectors[MK];
223}
224
225std::optional<NSAPI::NSDictionaryMethodKind>
227 for (unsigned i = 0; i != NumNSDictionaryMethods; ++i) {
229 if (Sel == getNSDictionarySelector(MK))
230 return MK;
231 }
232
233 return std::nullopt;
234}
235
237 if (NSSetSelectors[MK].isNull()) {
238 Selector Sel;
239 switch (MK) {
241 Sel = Ctx.Selectors.getUnarySelector(&Ctx.Idents.get("addObject"));
242 break;
244 const IdentifierInfo *KeyIdents[] = {&Ctx.Idents.get("insertObject"),
245 &Ctx.Idents.get("atIndex")};
246 Sel = Ctx.Selectors.getSelector(2, KeyIdents);
247 break;
248 }
250 const IdentifierInfo *KeyIdents[] = {&Ctx.Idents.get("setObject"),
251 &Ctx.Idents.get("atIndex")};
252 Sel = Ctx.Selectors.getSelector(2, KeyIdents);
253 break;
254 }
256 const IdentifierInfo *KeyIdents[] = {
257 &Ctx.Idents.get("setObject"), &Ctx.Idents.get("atIndexedSubscript")};
258 Sel = Ctx.Selectors.getSelector(2, KeyIdents);
259 break;
260 }
262 const IdentifierInfo *KeyIdents[] = {
263 &Ctx.Idents.get("replaceObjectAtIndex"),
264 &Ctx.Idents.get("withObject")};
265 Sel = Ctx.Selectors.getSelector(2, KeyIdents);
266 break;
267 }
268 }
269 return (NSSetSelectors[MK] = Sel);
270 }
271
272 return NSSetSelectors[MK];
273}
274
275std::optional<NSAPI::NSSetMethodKind> NSAPI::getNSSetMethodKind(Selector Sel) {
276 for (unsigned i = 0; i != NumNSSetMethods; ++i) {
278 if (Sel == getNSSetSelector(MK))
279 return MK;
280 }
281
282 return std::nullopt;
283}
284
286 bool Instance) const {
287 static const char *ClassSelectorName[NumNSNumberLiteralMethods] = {
288 "numberWithChar",
289 "numberWithUnsignedChar",
290 "numberWithShort",
291 "numberWithUnsignedShort",
292 "numberWithInt",
293 "numberWithUnsignedInt",
294 "numberWithLong",
295 "numberWithUnsignedLong",
296 "numberWithLongLong",
297 "numberWithUnsignedLongLong",
298 "numberWithFloat",
299 "numberWithDouble",
300 "numberWithBool",
301 "numberWithInteger",
302 "numberWithUnsignedInteger"
303 };
304 static const char *InstanceSelectorName[NumNSNumberLiteralMethods] = {
305 "initWithChar",
306 "initWithUnsignedChar",
307 "initWithShort",
308 "initWithUnsignedShort",
309 "initWithInt",
310 "initWithUnsignedInt",
311 "initWithLong",
312 "initWithUnsignedLong",
313 "initWithLongLong",
314 "initWithUnsignedLongLong",
315 "initWithFloat",
316 "initWithDouble",
317 "initWithBool",
318 "initWithInteger",
319 "initWithUnsignedInteger"
320 };
321
322 Selector *Sels;
323 const char **Names;
324 if (Instance) {
325 Sels = NSNumberInstanceSelectors;
326 Names = InstanceSelectorName;
327 } else {
328 Sels = NSNumberClassSelectors;
329 Names = ClassSelectorName;
330 }
331
332 if (Sels[MK].isNull())
333 Sels[MK] = Ctx.Selectors.getUnarySelector(&Ctx.Idents.get(Names[MK]));
334 return Sels[MK];
335}
336
337std::optional<NSAPI::NSNumberLiteralMethodKind>
339 for (unsigned i = 0; i != NumNSNumberLiteralMethods; ++i) {
341 if (isNSNumberLiteralSelector(MK, Sel))
342 return MK;
343 }
344
345 return std::nullopt;
346}
347
348std::optional<NSAPI::NSNumberLiteralMethodKind>
350 const BuiltinType *BT = T->getAs<BuiltinType>();
351 if (!BT)
352 return std::nullopt;
353
354 const TypedefType *TDT = T->getAs<TypedefType>();
355 if (TDT) {
356 QualType TDTTy = QualType(TDT, 0);
357 if (isObjCBOOLType(TDTTy))
359 if (isObjCNSIntegerType(TDTTy))
361 if (isObjCNSUIntegerType(TDTTy))
363 }
364
365 switch (BT->getKind()) {
366 case BuiltinType::Char_S:
367 case BuiltinType::SChar:
369 case BuiltinType::Char_U:
370 case BuiltinType::UChar:
372 case BuiltinType::Short:
374 case BuiltinType::UShort:
376 case BuiltinType::Int:
378 case BuiltinType::UInt:
380 case BuiltinType::Long:
382 case BuiltinType::ULong:
384 case BuiltinType::LongLong:
386 case BuiltinType::ULongLong:
388 case BuiltinType::Float:
390 case BuiltinType::Double:
392 case BuiltinType::Bool:
394
395 case BuiltinType::Void:
396 case BuiltinType::WChar_U:
397 case BuiltinType::WChar_S:
398 case BuiltinType::Char8:
399 case BuiltinType::Char16:
400 case BuiltinType::Char32:
401 case BuiltinType::Int128:
402 case BuiltinType::LongDouble:
403 case BuiltinType::ShortAccum:
404 case BuiltinType::Accum:
405 case BuiltinType::LongAccum:
406 case BuiltinType::UShortAccum:
407 case BuiltinType::UAccum:
408 case BuiltinType::ULongAccum:
409 case BuiltinType::ShortFract:
410 case BuiltinType::Fract:
411 case BuiltinType::LongFract:
412 case BuiltinType::UShortFract:
413 case BuiltinType::UFract:
414 case BuiltinType::ULongFract:
415 case BuiltinType::SatShortAccum:
416 case BuiltinType::SatAccum:
417 case BuiltinType::SatLongAccum:
418 case BuiltinType::SatUShortAccum:
419 case BuiltinType::SatUAccum:
420 case BuiltinType::SatULongAccum:
421 case BuiltinType::SatShortFract:
422 case BuiltinType::SatFract:
423 case BuiltinType::SatLongFract:
424 case BuiltinType::SatUShortFract:
425 case BuiltinType::SatUFract:
426 case BuiltinType::SatULongFract:
427 case BuiltinType::UInt128:
428 case BuiltinType::Float16:
429 case BuiltinType::Float128:
430 case BuiltinType::Ibm128:
431 case BuiltinType::NullPtr:
432 case BuiltinType::ObjCClass:
433 case BuiltinType::ObjCId:
434 case BuiltinType::ObjCSel:
435#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
436 case BuiltinType::Id:
437#include "clang/Basic/OpenCLImageTypes.def"
438#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
439 case BuiltinType::Id:
440#include "clang/Basic/OpenCLExtensionTypes.def"
441 case BuiltinType::OCLSampler:
442 case BuiltinType::OCLEvent:
443 case BuiltinType::OCLClkEvent:
444 case BuiltinType::OCLQueue:
445 case BuiltinType::OCLReserveID:
446#define SVE_TYPE(Name, Id, SingletonId) \
447 case BuiltinType::Id:
448#include "clang/Basic/AArch64SVEACLETypes.def"
449#define PPC_VECTOR_TYPE(Name, Id, Size) \
450 case BuiltinType::Id:
451#include "clang/Basic/PPCTypes.def"
452#define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
453#include "clang/Basic/RISCVVTypes.def"
454#define WASM_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
455#include "clang/Basic/WebAssemblyReferenceTypes.def"
456#define AMDGPU_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
457#include "clang/Basic/AMDGPUTypes.def"
458#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
459#include "clang/Basic/HLSLIntangibleTypes.def"
460 case BuiltinType::BoundMember:
461 case BuiltinType::UnresolvedTemplate:
462 case BuiltinType::Dependent:
463 case BuiltinType::Overload:
464 case BuiltinType::UnknownAny:
465 case BuiltinType::ARCUnbridgedCast:
466 case BuiltinType::Half:
467 case BuiltinType::PseudoObject:
468 case BuiltinType::BuiltinFn:
469 case BuiltinType::IncompleteMatrixIdx:
470 case BuiltinType::ArraySection:
471 case BuiltinType::OMPArrayShaping:
472 case BuiltinType::OMPIterator:
473 case BuiltinType::BFloat16:
474 break;
475 }
476
477 return std::nullopt;
478}
479
480/// Returns true if \param T is a typedef of "BOOL" in objective-c.
482 return isObjCTypedef(T, "BOOL", BOOLId);
483}
484/// Returns true if \param T is a typedef of "NSInteger" in objective-c.
486 return isObjCTypedef(T, "NSInteger", NSIntegerId);
487}
488/// Returns true if \param T is a typedef of "NSUInteger" in objective-c.
490 return isObjCTypedef(T, "NSUInteger", NSUIntegerId);
491}
492
494 if (!Ctx.getLangOpts().ObjC || T.isNull())
495 return StringRef();
496
497 while (const TypedefType *TDT = T->getAs<TypedefType>()) {
498 StringRef NSIntegralResust =
499 llvm::StringSwitch<StringRef>(
500 TDT->getDecl()->getDeclName().getAsIdentifierInfo()->getName())
501 .Case("int8_t", "int8_t")
502 .Case("int16_t", "int16_t")
503 .Case("int32_t", "int32_t")
504 .Case("NSInteger", "NSInteger")
505 .Case("int64_t", "int64_t")
506 .Case("uint8_t", "uint8_t")
507 .Case("uint16_t", "uint16_t")
508 .Case("uint32_t", "uint32_t")
509 .Case("NSUInteger", "NSUInteger")
510 .Case("uint64_t", "uint64_t")
511 .Default(StringRef());
512 if (!NSIntegralResust.empty())
513 return NSIntegralResust;
514 T = TDT->desugar();
515 }
516 return StringRef();
517}
518
519bool NSAPI::isMacroDefined(StringRef Id) const {
520 // FIXME: Check whether the relevant module macros are visible.
521 return Ctx.Idents.get(Id).hasMacroDefinition();
522}
523
525 NSClassIdKindKind NSClassKind) const {
526 if (!InterfaceDecl) {
527 return false;
528 }
529
530 IdentifierInfo *NSClassID = getNSClassId(NSClassKind);
531
532 bool IsSubclass = false;
533 do {
534 IsSubclass = NSClassID == InterfaceDecl->getIdentifier();
535
536 if (IsSubclass) {
537 break;
538 }
539 } while ((InterfaceDecl = InterfaceDecl->getSuperClass()));
540
541 return IsSubclass;
542}
543
544bool NSAPI::isObjCTypedef(QualType T,
545 StringRef name, IdentifierInfo *&II) const {
546 if (!Ctx.getLangOpts().ObjC)
547 return false;
548 if (T.isNull())
549 return false;
550
551 if (!II)
552 II = &Ctx.Idents.get(name);
553
554 while (const TypedefType *TDT = T->getAs<TypedefType>()) {
555 if (TDT->getDecl()->getDeclName().getAsIdentifierInfo() == II)
556 return true;
557 T = TDT->desugar();
558 }
559
560 return false;
561}
562
563bool NSAPI::isObjCEnumerator(const Expr *E,
564 StringRef name, IdentifierInfo *&II) const {
565 if (!Ctx.getLangOpts().ObjC)
566 return false;
567 if (!E)
568 return false;
569
570 if (!II)
571 II = &Ctx.Idents.get(name);
572
573 if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E->IgnoreParenImpCasts()))
574 if (const EnumConstantDecl *
575 EnumD = dyn_cast_or_null<EnumConstantDecl>(DRE->getDecl()))
576 return EnumD->getIdentifier() == II;
577
578 return false;
579}
580
581Selector NSAPI::getOrInitSelector(ArrayRef<StringRef> Ids,
582 Selector &Sel) const {
583 if (Sel.isNull()) {
586 I = Ids.begin(), E = Ids.end(); I != E; ++I)
587 Idents.push_back(&Ctx.Idents.get(*I));
588 Sel = Ctx.Selectors.getSelector(Idents.size(), Idents.data());
589 }
590 return Sel;
591}
592
593Selector NSAPI::getOrInitNullarySelector(StringRef Id, Selector &Sel) const {
594 if (Sel.isNull()) {
595 const IdentifierInfo *Ident = &Ctx.Idents.get(Id);
596 Sel = Ctx.Selectors.getSelector(0, &Ident);
597 }
598 return Sel;
599}
Defines the clang::ASTContext interface.
Expr * E
uint32_t Id
Definition: SemaARM.cpp:1144
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:187
IdentifierTable & Idents
Definition: ASTContext.h:660
const LangOptions & getLangOpts() const
Definition: ASTContext.h:797
SelectorTable & Selectors
Definition: ASTContext.h:661
This class is used for builtin types like 'int'.
Definition: Type.h:3023
Kind getKind() const
Definition: Type.h:3071
A reference to a declared variable, function, enum, etc.
Definition: Expr.h:1265
An instance of this object exists for each enum constant that is defined.
Definition: Decl.h:3274
This represents one expression.
Definition: Expr.h:110
Expr * IgnoreParenImpCasts() LLVM_READONLY
Skip past any parentheses and implicit casts which might surround this expression until reaching a fi...
Definition: Expr.cpp:3070
QualType desugar() const
Definition: Type.h:5546
One of these records is kept for each identifier that is lexed.
bool hasMacroDefinition() const
Return true if this identifier is #defined to some other value.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
std::optional< NSNumberLiteralMethodKind > getNSNumberLiteralMethodKind(Selector Sel) const
Return NSNumberLiteralMethodKind if Sel is such a selector.
Definition: NSAPI.cpp:338
bool isObjCNSIntegerType(QualType T) const
Returns true if.
Definition: NSAPI.cpp:485
NSStringMethodKind
Definition: NSAPI.h:43
@ NSStr_initWithUTF8String
Definition: NSAPI.h:49
@ NSStr_initWithString
Definition: NSAPI.h:48
@ NSStr_stringWithCString
Definition: NSAPI.h:47
@ NSStr_stringWithString
Definition: NSAPI.h:44
@ NSStr_stringWithCStringEncoding
Definition: NSAPI.h:46
@ NSStr_stringWithUTF8String
Definition: NSAPI.h:45
Selector getNSDictionarySelector(NSDictionaryMethodKind MK) const
The Objective-C NSDictionary selectors.
Definition: NSAPI.cpp:148
static const unsigned NumNSArrayMethods
Definition: NSAPI.h:86
NSClassIdKindKind
Definition: NSAPI.h:29
Selector getNSNumberLiteralSelector(NSNumberLiteralMethodKind MK, bool Instance) const
The Objective-C NSNumber selectors used to create NSNumber literals.
Definition: NSAPI.cpp:285
bool isMacroDefined(StringRef Id) const
Returns true if Id is currently defined as a macro.
Definition: NSAPI.cpp:519
std::optional< NSNumberLiteralMethodKind > getNSNumberFactoryMethodKind(QualType T) const
Determine the appropriate NSNumber factory method kind for a literal of the given type.
Definition: NSAPI.cpp:349
std::optional< NSDictionaryMethodKind > getNSDictionaryMethodKind(Selector Sel)
Return NSDictionaryMethodKind if Sel is such a selector.
Definition: NSAPI.cpp:226
static const unsigned NumClassIds
Definition: NSAPI.h:41
NSAPI(ASTContext &Ctx)
Definition: NSAPI.cpp:18
NSSetMethodKind
Enumerates the NSMutableSet/NSOrderedSet methods used to apply some checks.
Definition: NSAPI.h:121
@ NSOrderedSet_setObjectAtIndex
Definition: NSAPI.h:124
@ NSMutableSet_addObject
Definition: NSAPI.h:122
@ NSOrderedSet_replaceObjectAtIndexWithObject
Definition: NSAPI.h:126
@ NSOrderedSet_setObjectAtIndexedSubscript
Definition: NSAPI.h:125
@ NSOrderedSet_insertObjectAtIndex
Definition: NSAPI.h:123
NSDictionaryMethodKind
Enumerates the NSDictionary/NSMutableDictionary methods used to generate literals and to apply some c...
Definition: NSAPI.h:96
@ NSDict_objectForKey
Definition: NSAPI.h:106
@ NSMutableDict_setValueForKey
Definition: NSAPI.h:109
@ NSDict_dictionaryWithObjectsForKeys
Definition: NSAPI.h:100
@ NSDict_dictionaryWithDictionary
Definition: NSAPI.h:98
@ NSMutableDict_setObjectForKey
Definition: NSAPI.h:107
@ NSDict_initWithObjectsForKeys
Definition: NSAPI.h:105
@ NSDict_dictionaryWithObjectForKey
Definition: NSAPI.h:99
@ NSDict_dictionary
Definition: NSAPI.h:97
@ NSDict_initWithDictionary
Definition: NSAPI.h:103
@ NSDict_dictionaryWithObjectsForKeysCount
Definition: NSAPI.h:101
@ NSDict_initWithObjectsAndKeys
Definition: NSAPI.h:104
@ NSMutableDict_setObjectForKeyedSubscript
Definition: NSAPI.h:108
@ NSDict_dictionaryWithObjectsAndKeys
Definition: NSAPI.h:102
Selector getNSArraySelector(NSArrayMethodKind MK) const
The Objective-C NSArray selectors.
Definition: NSAPI.cpp:77
std::optional< NSArrayMethodKind > getNSArrayMethodKind(Selector Sel)
Return NSArrayMethodKind if Sel is such a selector.
Definition: NSAPI.cpp:138
NSArrayMethodKind
Enumerates the NSArray/NSMutableArray methods used to generate literals and to apply some checks.
Definition: NSAPI.h:72
@ NSArr_arrayWithObjects
Definition: NSAPI.h:76
@ NSArr_objectAtIndex
Definition: NSAPI.h:80
@ NSMutableArr_setObjectAtIndexedSubscript
Definition: NSAPI.h:84
@ NSMutableArr_insertObjectAtIndex
Definition: NSAPI.h:83
@ NSArr_arrayWithArray
Definition: NSAPI.h:74
@ NSMutableArr_addObject
Definition: NSAPI.h:82
@ NSArr_arrayWithObjectsCount
Definition: NSAPI.h:77
@ NSArr_array
Definition: NSAPI.h:73
@ NSArr_initWithObjects
Definition: NSAPI.h:79
@ NSMutableArr_replaceObjectAtIndex
Definition: NSAPI.h:81
@ NSArr_initWithArray
Definition: NSAPI.h:78
@ NSArr_arrayWithObject
Definition: NSAPI.h:75
bool isSubclassOfNSClass(ObjCInterfaceDecl *InterfaceDecl, NSClassIdKindKind NSClassKind) const
Returns true if InterfaceDecl is subclass of NSClassKind.
Definition: NSAPI.cpp:524
std::optional< NSSetMethodKind > getNSSetMethodKind(Selector Sel)
Return NSSetMethodKind if Sel is such a selector.
Definition: NSAPI.cpp:275
bool isNSNumberLiteralSelector(NSNumberLiteralMethodKind MK, Selector Sel) const
Definition: NSAPI.h:199
static const unsigned NumNSNumberLiteralMethods
Definition: NSAPI.h:191
bool isObjCNSUIntegerType(QualType T) const
Returns true if.
Definition: NSAPI.cpp:489
NSNumberLiteralMethodKind
Enumerates the NSNumber methods used to generate literals.
Definition: NSAPI.h:174
@ NSNumberWithChar
Definition: NSAPI.h:175
@ NSNumberWithInteger
Definition: NSAPI.h:188
@ NSNumberWithDouble
Definition: NSAPI.h:186
@ NSNumberWithUnsignedChar
Definition: NSAPI.h:176
@ NSNumberWithUnsignedLongLong
Definition: NSAPI.h:184
@ NSNumberWithBool
Definition: NSAPI.h:187
@ NSNumberWithUnsignedInt
Definition: NSAPI.h:180
@ NSNumberWithLongLong
Definition: NSAPI.h:183
@ NSNumberWithLong
Definition: NSAPI.h:181
@ NSNumberWithFloat
Definition: NSAPI.h:185
@ NSNumberWithUnsignedLong
Definition: NSAPI.h:182
@ NSNumberWithShort
Definition: NSAPI.h:177
@ NSNumberWithUnsignedInteger
Definition: NSAPI.h:189
@ NSNumberWithInt
Definition: NSAPI.h:179
@ NSNumberWithUnsignedShort
Definition: NSAPI.h:178
Selector getNSStringSelector(NSStringMethodKind MK) const
The Objective-C NSString selectors.
Definition: NSAPI.cpp:43
static const unsigned NumNSDictionaryMethods
Definition: NSAPI.h:111
bool isObjCBOOLType(QualType T) const
Returns true if.
Definition: NSAPI.cpp:481
static const unsigned NumNSSetMethods
Definition: NSAPI.h:128
StringRef GetNSIntegralKind(QualType T) const
Returns one of NSIntegral typedef names if.
Definition: NSAPI.cpp:493
Selector getNSSetSelector(NSSetMethodKind MK) const
The Objective-C NSSet selectors.
Definition: NSAPI.cpp:236
IdentifierInfo * getNSClassId(NSClassIdKindKind K) const
Definition: NSAPI.cpp:23
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
Definition: Decl.h:270
Represents an ObjC class declaration.
Definition: DeclObjC.h:1153
ObjCInterfaceDecl * getSuperClass() const
Definition: DeclObjC.cpp:352
A (possibly-)qualified type.
Definition: Type.h:941
Selector getNullarySelector(const IdentifierInfo *ID)
Selector getSelector(unsigned NumArgs, const IdentifierInfo **IIV)
Can create any sort of selector.
Selector getUnarySelector(const IdentifierInfo *ID)
Smart pointer class that efficiently represents Objective-C method names.
bool isNull() const
Determine whether this is the empty selector.
const T * getAs() const
Member-template getAs<specific type>'.
Definition: Type.h:8540
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T