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