clang: lib/Edit/RewriteObjCFoundationAPI.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
21#include
22
23using namespace clang;
24using namespace edit;
25
30 return false;
31
33 if (!Receiver)
34 return false;
36
38 return true;
39
40
41
42 if (LangOpts.ObjCAutoRefCount) {
44 if (const ObjCMessageExpr *Rec = dyn_cast(
46 if (Rec->getMethodFamily() == OMF_alloc)
47 return true;
48 }
49 }
50 }
51
52 return false;
53}
54
55
56
57
58
63 return false;
65 return false;
66
69
70 if ((isa(Arg) &&
74
75 (isa(Arg) &&
79
80 (isa(Arg) &&
85
88 return true;
89 }
90
91 return false;
92}
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
110 const Expr *Receiver,
112 assert(IFace && Receiver);
113
114
116 return IFace;
117
119 InnerMsg = dyn_cast(Receiver->IgnoreParenCasts());
120 if (!InnerMsg)
121 return IFace;
122
127 return IFace;
128
131 break;
134 break;
135 }
136
137 if (ClassRec.isNull())
138 return IFace;
139
140
141
143 if (!ObjTy)
144 return IFace;
146
147
148
149 if (OID->getName() == "NSMapTable" ||
150 OID->getName() == "NSLocale")
151 return OID;
152
153 return IFace;
154}
155
161 if (!Rec)
162 return false;
164
166 if (!MD->isUnavailable())
167 return true;
168 }
169 return false;
170}
171
173
177 commit.insertWrap("(", RecRange, ")");
178 }
179}
180
184 return false;
186 if (!Rec)
187 return false;
188
192
197 ArgRange);
198 commit.insertWrap("[", ArgRange, "]");
200 return true;
201}
202
209 return false;
211}
212
219 return false;
221}
222
229 return false;
230
232 return false;
234 if (!Rec)
235 return false;
236
241
249 Arg1Range);
252 "] = ");
254 return true;
255}
256
263 return false;
264
266 return false;
268 if (!Rec)
269 return false;
270
275
278 commit.insertFromRange(LocBeforeVal, Arg1Range, false,
279 true);
285 Arg0Range);
287 return true;
288}
289
294 return false;
296 if (!Method)
297 return false;
298
301 if (!IFace)
302 return false;
304
307
310
312 return false;
313
316
319
320 return false;
321}
322
323
324
325
326
338
344 return false;
345
354
355 return false;
356}
357
358
359
360
361
362
363
364
365
366
367
369 const NSAPI &NS);
370
371
372
373
374
375
377
381 if (PMap) {
385 return false;
386 }
387
390
393 return false;
394 commit.replace(MsgRange, "@[]");
395 return true;
396 }
397
400 return false;
404 commit.insertWrap("@[", ArgRange, "]");
405 return true;
406 }
407
411 return false;
414 return false;
415
416 for (unsigned i = 0, e = Msg->getNumArgs() - 1; i != e; ++i)
418
420 commit.replace(MsgRange, "@[]");
421 return true;
422 }
426 commit.insertWrap("@[", ArgRange, "]");
427 return true;
428 }
429
430 return false;
431}
432
433
434
435
436
437
438
439
442 if ()
443 return false;
444
446 if ()
447 return false;
448
449 if (const ObjCMessageExpr *Msg = dyn_cast(E)) {
452 return false;
453
455 return false;
456
457 Selector Sel = Msg->getSelector();
459 return true;
460
462 if (Msg->getNumArgs() != 1)
463 return false;
464 Objs.push_back(Msg->getArg(0));
465 return true;
466 }
467
470 if (Msg->getNumArgs() == 0)
471 return false;
472 const Expr *SentinelExpr = Msg->getArg(Msg->getNumArgs() - 1);
474 return false;
475
476 for (unsigned i = 0, e = Msg->getNumArgs() - 1; i != e; ++i)
477 Objs.push_back(Msg->getArg(i));
478 return true;
479 }
480
481 } else if (const ObjCArrayLiteral *ArrLit = dyn_cast(E)) {
482 for (unsigned i = 0, e = ArrLit->getNumElements(); i != e; ++i)
483 Objs.push_back(ArrLit->getElement(i));
484 return true;
485 }
486
487 return false;
488}
489
494
497 return false;
498 commit.replace(MsgRange, "@{}");
499 return true;
500 }
501
505 return false;
506
509
512
516 false, true);
520 return true;
521 }
522
527 return false;
528 unsigned SentinelIdx = Msg->getNumArgs() - 1;
529 const Expr *SentinelExpr = Msg->getArg(SentinelIdx);
531 return false;
532
534 commit.replace(MsgRange, "@{}");
535 return true;
536 }
537
538 for (unsigned i = 0; i < SentinelIdx; i += 2) {
541
544
549 }
550
551
552
555 commit.insertWrap("@{", ArgRange, "}");
557 return true;
558 }
559
564 return false;
565
568 return false;
569
572 return false;
573
574 if (Vals.size() != Keys.size())
575 return false;
576
577 if (Vals.empty()) {
578 commit.replace(MsgRange, "@{}");
579 return true;
580 }
581
582 for (unsigned i = 0, n = Vals.size(); i < n; ++i) {
585
586 SourceRange ValRange = Vals[i]->getSourceRange();
587 SourceRange KeyRange = Keys[i]->getSourceRange();
588
591 }
592
593
594 SourceRange ArgRange(Keys.front()->getBeginLoc(), Keys.back()->getEndLoc());
595 commit.insertWrap("@{", ArgRange, "}");
597 return true;
598 }
599
600 return false;
601}
602
604 const NSAPI &NS) {
605 if (!Msg)
606 return false;
607
610 return false;
611
613 return false;
614
620 return false;
621
624 return false;
625
628 return false;
629
630 if (Vals.size() != Keys.size())
631 return false;
632
633 return true;
634 }
635
636 return false;
637}
638
639
640
641
642
646 if (Arg->getKind() != CharacterLiteralKind::Ascii)
647 return false;
653 return true;
654 }
655
657}
658
660 const Expr *Arg,
667 return true;
668 }
669
671}
672
673namespace {
674
675struct LiteralInfo {
676 bool Hex, Octal;
677 StringRef U, F, L, LL;
679};
680
681}
682
684 bool isFloat, bool isIntZero,
685 ASTContext &Ctx, LiteralInfo &Info) {
688 return false;
692 if (text.empty())
693 return false;
694
695 std::optional UpperU, UpperL;
696 bool UpperF = false;
697
698 struct Suff {
699 static bool has(StringRef suff, StringRef &text) {
700 return text.consume_back(suff);
701 }
702 };
703
704 while (true) {
705 if (Suff::has("u", text)) {
706 UpperU = false;
707 } else if (Suff::has("U", text)) {
708 UpperU = true;
709 } else if (Suff::has("ll", text)) {
710 UpperL = false;
711 } else if (Suff::has("LL", text)) {
712 UpperL = true;
713 } else if (Suff::has("l", text)) {
714 UpperL = false;
715 } else if (Suff::has("L", text)) {
716 UpperL = true;
717 } else if (isFloat && Suff::has("f", text)) {
718 UpperF = false;
719 } else if (isFloat && Suff::has("F", text)) {
720 UpperF = true;
721 } else
722 break;
723 }
724
725 if (!UpperU && !UpperL)
726 UpperU = UpperL = true;
727 else if (UpperU && !UpperL)
728 UpperL = UpperU;
729 else if (UpperL && !UpperU)
730 UpperU = UpperL;
731
732 Info.U = *UpperU ? "U" : "u";
733 Info.L = *UpperL ? "L" : "l";
734 Info.LL = *UpperL ? "LL" : "ll";
735 Info.F = UpperF ? "F" : "f";
736
737 Info.Hex = Info.Octal = false;
738 if (text.starts_with("0x"))
739 Info.Hex = true;
740 else if (!isFloat && !isIntZero && text.starts_with("0"))
741 Info.Octal = true;
742
744 Info.WithoutSuffRange =
746 return true;
747}
748
752 return false;
753
755 if (const CharacterLiteral *CharE = dyn_cast(Arg))
759 if (const CXXBoolLiteralExpr *BE = dyn_cast(Arg))
761
762 const Expr *literalE = Arg;
763 if (const UnaryOperator *UOE = dyn_cast(literalE)) {
764 if (UOE->getOpcode() == UO_Plus || UOE->getOpcode() == UO_Minus)
765 literalE = UOE->getSubExpr();
766 }
767
768
769
770 if (!isa(literalE) && !isa(literalE))
772
775 std::optionalNSAPI::NSNumberLiteralMethodKind MKOpt =
777 if (!MKOpt)
778 return false;
780
781 bool CallIsUnsigned = false, CallIsLong = false, CallIsLongLong = false;
782 bool CallIsFloating = false, CallIsDouble = false;
783
784 switch (MK) {
785
792
795 CallIsUnsigned = true;
796 [[fallthrough]];
799 break;
800
802 CallIsUnsigned = true;
803 [[fallthrough]];
805 CallIsLong = true;
806 break;
807
809 CallIsUnsigned = true;
810 [[fallthrough]];
812 CallIsLongLong = true;
813 break;
814
816 CallIsDouble = true;
817 [[fallthrough]];
819 CallIsFloating = true;
820 break;
821 }
822
826
827
831 return true;
832 }
833
834
835
838
840
841
842
843 if (LitIsFloat && !CallIsFloating)
845
846
847
848
849
850 LiteralInfo LitInfo;
851 bool isIntZero = false;
852 if (const IntegerLiteral *IntE = dyn_cast(literalE))
853 isIntZero = !IntE->getValue().getBoolValue();
854 if ((ArgRange, LitIsFloat, isIntZero, Ctx, LitInfo))
856
857
858 if (!LitIsFloat && CallIsFloating && (LitInfo.Hex || LitInfo.Octal))
860
861 SourceLocation LitB = LitInfo.WithoutSuffRange.getBegin();
862 SourceLocation LitE = LitInfo.WithoutSuffRange.getEnd();
863
865 LitInfo.WithoutSuffRange);
866 commit.insert(LitB, "@");
867
868 if (!LitIsFloat && CallIsFloating)
869 commit.insert(LitE, ".0");
870
871 if (CallIsFloating) {
872 if (!CallIsDouble)
873 commit.insert(LitE, LitInfo.F);
874 } else {
875 if (CallIsUnsigned)
876 commit.insert(LitE, LitInfo.U);
877
878 if (CallIsLong)
879 commit.insert(LitE, LitInfo.L);
880 else if (CallIsLongLong)
881 commit.insert(LitE, LitInfo.LL);
882 }
883 return true;
884}
885
886
887
890 if (isa(Expr) ||
891 isa(Expr) ||
892 isa(Expr) ||
893 isa(Expr) ||
894 isa(Expr) ||
895 isa(Expr) ||
896 isa(Expr) ||
897 isa(Expr) ||
898 isa(Expr) ||
899 isa(Expr) ||
900 isa(Expr) ||
901 isa(Expr) ||
902 isa(Expr) ||
904 isa(Expr) ||
905 isa(Expr))
906 return false;
907
908 return true;
909}
912 if (isa(Expr) ||
913 isa(Expr) ||
914 isa(Expr) ||
915 isa(Expr) ||
916 isa(Expr) ||
917 isa(Expr) ||
918 isa(Expr) ||
919 isa(Expr) ||
920 isa(Expr) ||
921 isa(Expr) ||
922 isa(Expr) ||
923 isa(Expr) ||
924 isa(Expr) ||
925 isa(Expr) ||
926 isa(Expr) ||
927 isa(Expr) ||
928 isa(Expr) ||
929 isa(Expr) ||
931 isa(Expr) ||
932 isa(Expr) ||
933 isa(Expr))
934 return false;
935
936 return true;
937}
938
940 if () return;
941
944 if (const ImplicitCastExpr *ICE = dyn_cast(E)) {
945 if (ICE->getCastKind() != CK_CPointerToObjCPointerCast)
946 return;
947 } else {
948 return;
949 }
951 return;
952 }
953
958}
959
960
961
962
963
966 if (const ValueDecl *VD = DRE->getDecl())
967 return isa(VD);
968
969 return false;
970}
971
975 return false;
976
979 return false;
980
983 std::optionalNSAPI::NSNumberLiteralMethodKind MKOpt =
985 if (!MKOpt)
986 return false;
988
992 uint64_t FinalTySize = Ctx.getTypeSize(FinalTy);
993 uint64_t OrigTySize = Ctx.getTypeSize(OrigTy);
994
995 bool isTruncated = FinalTySize < OrigTySize;
996 bool needsCast = false;
997
998 if (const ImplicitCastExpr *ICE = dyn_cast(Arg)) {
999 switch (ICE->getCastKind()) {
1000 case CK_LValueToRValue:
1001 case CK_NoOp:
1002 case CK_UserDefinedConversion:
1003 case CK_HLSLArrayRValue:
1004 break;
1005
1006 case CK_IntegralCast: {
1008 break;
1009
1010
1013 !isTruncated) {
1015 break;
1018 break;
1019 }
1020
1021 needsCast = true;
1022 break;
1023 }
1024
1025 case CK_PointerToBoolean:
1026 case CK_IntegralToBoolean:
1027 case CK_IntegralToFloating:
1028 case CK_FloatingToIntegral:
1029 case CK_FloatingToBoolean:
1030 case CK_FloatingCast:
1031 case CK_FloatingComplexToReal:
1032 case CK_FloatingComplexToBoolean:
1033 case CK_IntegralComplexToReal:
1034 case CK_IntegralComplexToBoolean:
1035 case CK_AtomicToNonAtomic:
1036 case CK_AddressSpaceConversion:
1037 needsCast = true;
1038 break;
1039
1040 case CK_Dependent:
1041 case CK_BitCast:
1042 case CK_LValueBitCast:
1043 case CK_LValueToRValueBitCast:
1044 case CK_BaseToDerived:
1045 case CK_DerivedToBase:
1046 case CK_UncheckedDerivedToBase:
1047 case CK_Dynamic:
1048 case CK_ToUnion:
1049 case CK_ArrayToPointerDecay:
1050 case CK_FunctionToPointerDecay:
1051 case CK_NullToPointer:
1052 case CK_NullToMemberPointer:
1053 case CK_BaseToDerivedMemberPointer:
1054 case CK_DerivedToBaseMemberPointer:
1055 case CK_MemberPointerToBoolean:
1056 case CK_ReinterpretMemberPointer:
1057 case CK_ConstructorConversion:
1058 case CK_IntegralToPointer:
1059 case CK_PointerToIntegral:
1060 case CK_ToVoid:
1061 case CK_VectorSplat:
1062 case CK_CPointerToObjCPointerCast:
1063 case CK_BlockPointerToObjCPointerCast:
1064 case CK_AnyPointerToBlockPointerCast:
1065 case CK_ObjCObjectLValueCast:
1066 case CK_FloatingRealToComplex:
1067 case CK_FloatingComplexCast:
1068 case CK_FloatingComplexToIntegralComplex:
1069 case CK_IntegralRealToComplex:
1070 case CK_IntegralComplexCast:
1071 case CK_IntegralComplexToFloatingComplex:
1072 case CK_ARCProduceObject:
1073 case CK_ARCConsumeObject:
1074 case CK_ARCReclaimReturnedObject:
1075 case CK_ARCExtendBlockObject:
1076 case CK_NonAtomicToAtomic:
1077 case CK_CopyAndAutoreleaseBlockObject:
1078 case CK_BuiltinFnToFnPtr:
1079 case CK_ZeroToOCLOpaqueType:
1080 case CK_IntToOCLSampler:
1081 case CK_MatrixCast:
1082 return false;
1083
1084 case CK_BooleanToSignedIntegral:
1085 llvm_unreachable("OpenCL-specific cast in Objective-C?");
1086
1087 case CK_HLSLVectorTruncation:
1088 llvm_unreachable("HLSL-specific cast in Objective-C?");
1089 break;
1090
1091 case CK_FloatingToFixedPoint:
1092 case CK_FixedPointToFloating:
1093 case CK_FixedPointCast:
1094 case CK_FixedPointToBoolean:
1095 case CK_FixedPointToIntegral:
1096 case CK_IntegralToFixedPoint:
1097 llvm_unreachable("Fixed point types are disabled for Objective-C");
1098 }
1099 }
1100
1101 if (needsCast) {
1103
1105 "converting to boxing syntax requires casting %0 to %1");
1106 Diags.Report(Msg->getExprLoc(), diagID) << OrigTy << FinalTy
1108 return false;
1109 }
1110
1113
1114 if (isa(OrigArg) || isa(OrigArg))
1116 else
1117 commit.insertWrap("@(", ArgRange, ")");
1118
1119 return true;
1120}
1121
1122
1123
1124
1125
1131 return false;
1132
1134
1139
1141 StrE = dyn_cast(OrigArg->IgnoreParens())) {
1143 commit.insert(StrE->getBeginLoc(), "@");
1144 return true;
1145 }
1146
1152
1153 if (isa(OrigArg) || isa(OrigArg))
1155 else
1156 commit.insertWrap("@(", ArgRange, ")");
1157
1158 return true;
1159 }
1160 }
1161
1162 return false;
1163}
1164
1168
1173 return false;
1175 }
1176
1179 return false;
1180
1181 const Expr *encodingArg = Msg->getArg(1);
1185 }
1186
1187 return false;
1188}
Defines the clang::ASTContext interface.
Defines the clang::Expr interface and subclasses for C++ expressions.
static bool isEnumConstant(const Expr *E)
static bool shouldNotRewriteImmediateMessageArgs(const ObjCMessageExpr *Msg, const NSAPI &NS)
Returns true if the immediate message arguments of Msg should not be rewritten because it will interf...
static bool rewriteToCharLiteral(const ObjCMessageExpr *Msg, const CharacterLiteral *Arg, const NSAPI &NS, Commit &commit)
static bool rewriteToDictionarySubscriptGet(const ObjCInterfaceDecl *IFace, const ObjCMessageExpr *Msg, const NSAPI &NS, Commit &commit)
static void maybePutParensOnReceiver(const Expr *Receiver, Commit &commit)
static bool rewriteToBoolLiteral(const ObjCMessageExpr *Msg, const Expr *Arg, const NSAPI &NS, Commit &commit)
static bool rewriteToArrayLiteral(const ObjCMessageExpr *Msg, const NSAPI &NS, Commit &commit, const ParentMap *PMap)
static bool subscriptOperatorNeedsParens(const Expr *FullExpr)
static const ObjCInterfaceDecl * maybeAdjustInterfaceForSubscriptingCheck(const ObjCInterfaceDecl *IFace, const Expr *Receiver, ASTContext &Ctx)
Check for classes that accept 'objectForKey:' (or the other selectors that the migrator handles) but ...
static bool rewriteToDictionaryLiteral(const ObjCMessageExpr *Msg, const NSAPI &NS, Commit &commit)
static bool castOperatorNeedsParens(const Expr *FullExpr)
static bool rewriteToNumericBoxedExpression(const ObjCMessageExpr *Msg, const NSAPI &NS, Commit &commit)
static bool rewriteToNumberLiteral(const ObjCMessageExpr *Msg, const NSAPI &NS, Commit &commit)
static bool rewriteToStringBoxedExpression(const ObjCMessageExpr *Msg, const NSAPI &NS, Commit &commit)
static bool rewriteToSubscriptGetCommon(const ObjCMessageExpr *Msg, Commit &commit)
static bool rewriteToDictionarySubscriptSet(const ObjCInterfaceDecl *IFace, const ObjCMessageExpr *Msg, const NSAPI &NS, Commit &commit)
static bool doRewriteToUTF8StringBoxedExpressionHelper(const ObjCMessageExpr *Msg, const NSAPI &NS, Commit &commit)
static bool getNSArrayObjects(const Expr *E, const NSAPI &NS, SmallVectorImpl< const Expr * > &Objs)
If Msg is an NSArray creation message or literal, this gets the objects that were used to create it.
static bool canRewriteToSubscriptSyntax(const ObjCInterfaceDecl *&IFace, const ObjCMessageExpr *Msg, ASTContext &Ctx, Selector subscriptSel)
static bool getLiteralInfo(SourceRange literalRange, bool isFloat, bool isIntZero, ASTContext &Ctx, LiteralInfo &Info)
static void objectifyExpr(const Expr *E, Commit &commit)
Adds an explicit cast to 'id' if the type is not objc object.
static bool rewriteToArraySubscriptGet(const ObjCInterfaceDecl *IFace, const ObjCMessageExpr *Msg, const NSAPI &NS, Commit &commit)
static bool checkForLiteralCreation(const ObjCMessageExpr *Msg, IdentifierInfo *&ClassId, const LangOptions &LangOpts)
static bool rewriteToArraySubscriptSet(const ObjCInterfaceDecl *IFace, const ObjCMessageExpr *Msg, const NSAPI &NS, Commit &commit)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
SourceManager & getSourceManager()
bool isObjCIdType(QualType T) const
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
const LangOptions & getLangOpts() const
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
QualType getArrayDecayedType(QualType T) const
Return the properly qualified result of decaying the specified array type to a pointer.
const ObjCInterfaceDecl * getObjContainingInterface(const NamedDecl *ND) const
Returns the Objective-C interface that ND belongs to if it is an Objective-C method/property/ivar etc...
DiagnosticsEngine & getDiagnostics() const
bool isSentinelNullExpr(const Expr *E)
A boolean literal, per ([C++ lex.bool] Boolean literals).
Represents a character-granular source range.
static CharSourceRange getCharRange(SourceRange R)
static CharSourceRange getTokenRange(SourceRange R)
CharacterLiteralKind getKind() const
A reference to a declared variable, function, enum, etc.
Concrete class used by the front-end to report problems and issues.
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
unsigned getCustomDiagID(Level L, const char(&FormatString)[N])
Return an ID for a diagnostic with the specified format string and level.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums.
This represents one expression.
Expr * IgnoreParenCasts() LLVM_READONLY
Skip past any parentheses and casts which might surround this expression until reaching a fixed point...
bool isTypeDependent() const
Determines whether the type of this expression depends on.
Expr * IgnoreParenImpCasts() LLVM_READONLY
Skip past any parentheses and implicit casts which might surround this expression until reaching a fi...
Expr * IgnoreParens() LLVM_READONLY
Skip past any parentheses which might surround this expression until reaching a fixed point.
Expr * IgnoreImpCasts() LLVM_READONLY
Skip past any implicit casts which might surround this expression until reaching a fixed point.
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
FullExpr - Represents a "full-expression" node.
One of these records is kept for each identifier that is lexed.
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
static StringRef getSourceText(CharSourceRange Range, const SourceManager &SM, const LangOptions &LangOpts, bool *Invalid=nullptr)
Returns a string for the source that the range encompasses.
std::optional< NSNumberLiteralMethodKind > getNSNumberLiteralMethodKind(Selector Sel) const
Return NSNumberLiteralMethodKind if Sel is such a selector.
Selector getObjectAtIndexedSubscriptSelector() const
Returns selector for "objectAtIndexedSubscript:".
@ NSStr_initWithUTF8String
@ NSStr_stringWithCString
@ NSStr_stringWithCStringEncoding
@ NSStr_stringWithUTF8String
Selector getSetObjectAtIndexedSubscriptSelector() const
Returns selector for "setObject:atIndexedSubscript".
Selector getNSDictionarySelector(NSDictionaryMethodKind MK) const
The Objective-C NSDictionary selectors.
Selector getObjectForKeyedSubscriptSelector() const
Returns selector for "objectForKeyedSubscript:".
@ NSDict_dictionaryWithObjectsForKeys
@ NSDict_dictionaryWithDictionary
@ NSMutableDict_setObjectForKey
@ NSDict_initWithObjectsForKeys
@ NSDict_dictionaryWithObjectForKey
@ NSDict_initWithDictionary
@ NSDict_initWithObjectsAndKeys
@ NSDict_dictionaryWithObjectsAndKeys
Selector getNSArraySelector(NSArrayMethodKind MK) const
The Objective-C NSArray selectors.
@ NSMutableArr_replaceObjectAtIndex
bool isNSUTF8StringEncodingConstant(const Expr *E) const
Returns true if the expression.
bool isNSNumberLiteralSelector(NSNumberLiteralMethodKind MK, Selector Sel) const
Selector getSetObjectForKeyedSubscriptSelector() const
Returns selector for "setObject:forKeyedSubscript".
ASTContext & getASTContext() const
NSNumberLiteralMethodKind
Enumerates the NSNumber methods used to generate literals.
@ NSNumberWithUnsignedChar
@ NSNumberWithUnsignedLongLong
@ NSNumberWithUnsignedInt
@ NSNumberWithUnsignedLong
@ NSNumberWithUnsignedInteger
@ NSNumberWithUnsignedShort
Selector getNSStringSelector(NSStringMethodKind MK) const
The Objective-C NSString selectors.
bool isNSASCIIStringEncodingConstant(const Expr *E) const
Returns true if the expression.
IdentifierInfo * getNSClassId(NSClassIdKindKind K) const
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp,...
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
Represents an ObjC class declaration.
ObjCMethodDecl * lookupInstanceMethod(Selector Sel) const
Lookup an instance method for a given selector.
An expression that sends a message to the given Objective-C object or class.
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
bool isImplicit() const
Indicates whether the message send was implicitly generated by the implementation.
Expr * getInstanceReceiver()
Returns the object expression (receiver) for an instance message, or null for a message that is not a...
Selector getSelector() const
@ SuperInstance
The receiver is the instance of the superclass object.
@ Instance
The receiver is an object instance.
@ SuperClass
The receiver is a superclass.
@ Class
The receiver is a class.
QualType getClassReceiver() const
Returns the type of a class message send, or NULL if the message is not a class message.
ObjCInterfaceDecl * getReceiverInterface() const
Retrieve the Objective-C interface to which this message is being directed, if known.
QualType getSuperType() const
Retrieve the type referred to by 'super'.
const ObjCMethodDecl * getMethodDecl() const
ReceiverKind getReceiverKind() const
Determine the kind of receiver that this message is being sent to.
unsigned getNumArgs() const
Return the number of actual arguments in this message, not counting the receiver.
ObjCMethodDecl - Represents an instance or class method declaration.
Represents a class type in Objective C.
ObjCInterfaceDecl * getInterface() const
Gets the interface declaration for this object type, if the base type really is an interface.
Stmt * getParentIgnoreParenCasts(Stmt *) const
PointerType - C99 6.7.5.1 - Pointer Declarators.
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
Smart pointer class that efficiently represents Objective-C method names.
Encodes a location in the source.
SourceLocation getLocWithOffset(IntTy Offset) const
Return a source location with the specified offset from this SourceLocation.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
SourceLocation getEndLoc() const LLVM_READONLY
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
SourceLocation getBeginLoc() const LLVM_READONLY
StringLiteral - This represents a string literal expression, e.g.
bool isBooleanType() const
bool isSignedIntegerType() const
Return true if this is an integer type that is signed, according to C99 6.2.5p4 [char,...
bool isPointerType() const
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isObjCObjectPointerType() const
bool isFloatingType() const
const T * getAs() const
Member-template getAs'.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
bool replaceWithInner(CharSourceRange range, CharSourceRange innerRange)
bool insertWrap(StringRef before, CharSourceRange range, StringRef after)
bool insertFromRange(SourceLocation loc, CharSourceRange range, bool afterToken=false, bool beforePreviousInsertions=false)
bool insert(SourceLocation loc, StringRef text, bool afterToken=false, bool beforePreviousInsertions=false)
bool insertAfterToken(SourceLocation loc, StringRef text, bool beforePreviousInsertions=false)
bool remove(CharSourceRange range)
bool insertBefore(SourceLocation loc, StringRef text)
bool replace(CharSourceRange range, StringRef text)
const internal::ArgumentAdaptingMatcherFunc< internal::HasMatcher > has
Matches AST nodes that have child AST nodes that match the provided matcher.
bool rewriteObjCRedundantCallWithLiteral(const ObjCMessageExpr *Msg, const NSAPI &NS, Commit &commit)
bool rewriteToObjCLiteralSyntax(const ObjCMessageExpr *Msg, const NSAPI &NS, Commit &commit, const ParentMap *PMap)
bool rewriteToObjCSubscriptSyntax(const ObjCMessageExpr *Msg, const NSAPI &NS, Commit &commit)
EditGenerator edit(ASTEdit E)
Generates a single (specified) edit.
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T