clang  8.0.0svn
ExprObjC.h
Go to the documentation of this file.
1 //===- ExprObjC.h - Classes for representing ObjC expressions ---*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines the ExprObjC interface and subclasses.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_AST_EXPROBJC_H
15 #define LLVM_CLANG_AST_EXPROBJC_H
16 
17 #include "clang/AST/Decl.h"
18 #include "clang/AST/DeclObjC.h"
19 #include "clang/AST/Expr.h"
22 #include "clang/AST/Stmt.h"
23 #include "clang/AST/Type.h"
25 #include "clang/Basic/LLVM.h"
27 #include "clang/Basic/Specifiers.h"
28 #include "llvm/ADT/ArrayRef.h"
29 #include "llvm/ADT/None.h"
30 #include "llvm/ADT/Optional.h"
31 #include "llvm/ADT/PointerIntPair.h"
32 #include "llvm/ADT/PointerUnion.h"
33 #include "llvm/ADT/StringRef.h"
34 #include "llvm/ADT/iterator_range.h"
35 #include "llvm/Support/Casting.h"
36 #include "llvm/Support/Compiler.h"
37 #include "llvm/Support/TrailingObjects.h"
38 #include "llvm/Support/VersionTuple.h"
39 #include "llvm/Support/type_traits.h"
40 #include <cassert>
41 #include <cstddef>
42 #include <cstdint>
43 
44 namespace clang {
45 
46 class ASTContext;
47 class CXXBaseSpecifier;
48 
49 /// ObjCStringLiteral, used for Objective-C string literals
50 /// i.e. @"foo".
51 class ObjCStringLiteral : public Expr {
52  Stmt *String;
53  SourceLocation AtLoc;
54 
55 public:
57  : Expr(ObjCStringLiteralClass, T, VK_RValue, OK_Ordinary, false, false,
58  false, false),
59  String(SL), AtLoc(L) {}
60  explicit ObjCStringLiteral(EmptyShell Empty)
61  : Expr(ObjCStringLiteralClass, Empty) {}
62 
63  StringLiteral *getString() { return cast<StringLiteral>(String); }
64  const StringLiteral *getString() const { return cast<StringLiteral>(String); }
65  void setString(StringLiteral *S) { String = S; }
66 
67  SourceLocation getAtLoc() const { return AtLoc; }
68  void setAtLoc(SourceLocation L) { AtLoc = L; }
69 
70  LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocStart() const LLVM_READONLY,
71  "Use getBeginLoc instead") {
72  return getBeginLoc();
73  }
74  SourceLocation getBeginLoc() const LLVM_READONLY { return AtLoc; }
75  LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocEnd() const LLVM_READONLY,
76  "Use getEndLoc instead") {
77  return getEndLoc();
78  }
79  SourceLocation getEndLoc() const LLVM_READONLY { return String->getEndLoc(); }
80 
81  // Iterators
82  child_range children() { return child_range(&String, &String+1); }
83 
84  static bool classof(const Stmt *T) {
85  return T->getStmtClass() == ObjCStringLiteralClass;
86  }
87 };
88 
89 /// ObjCBoolLiteralExpr - Objective-C Boolean Literal.
90 class ObjCBoolLiteralExpr : public Expr {
91  bool Value;
92  SourceLocation Loc;
93 
94 public:
96  : Expr(ObjCBoolLiteralExprClass, Ty, VK_RValue, OK_Ordinary, false, false,
97  false, false),
98  Value(val), Loc(l) {}
100  : Expr(ObjCBoolLiteralExprClass, Empty) {}
101 
102  bool getValue() const { return Value; }
103  void setValue(bool V) { Value = V; }
104 
105  LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocStart() const LLVM_READONLY,
106  "Use getBeginLoc instead") {
107  return getBeginLoc();
108  }
109  SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; }
110  LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocEnd() const LLVM_READONLY,
111  "Use getEndLoc instead") {
112  return getEndLoc();
113  }
114  SourceLocation getEndLoc() const LLVM_READONLY { return Loc; }
115 
116  SourceLocation getLocation() const { return Loc; }
117  void setLocation(SourceLocation L) { Loc = L; }
118 
119  // Iterators
122  }
123 
124  static bool classof(const Stmt *T) {
125  return T->getStmtClass() == ObjCBoolLiteralExprClass;
126  }
127 };
128 
129 /// ObjCBoxedExpr - used for generalized expression boxing.
130 /// as in: @(strdup("hello world")), @(random()) or @(view.frame)
131 /// Also used for boxing non-parenthesized numeric literals;
132 /// as in: @42 or \@true (c++/objc++) or \@__objc_yes (c/objc).
133 class ObjCBoxedExpr : public Expr {
134  Stmt *SubExpr;
135  ObjCMethodDecl *BoxingMethod;
136  SourceRange Range;
137 
138 public:
139  friend class ASTStmtReader;
140 
142  SourceRange R)
143  : Expr(ObjCBoxedExprClass, T, VK_RValue, OK_Ordinary,
147  SubExpr(E), BoxingMethod(method), Range(R) {}
148  explicit ObjCBoxedExpr(EmptyShell Empty)
149  : Expr(ObjCBoxedExprClass, Empty) {}
150 
151  Expr *getSubExpr() { return cast<Expr>(SubExpr); }
152  const Expr *getSubExpr() const { return cast<Expr>(SubExpr); }
153 
155  return BoxingMethod;
156  }
157 
158  SourceLocation getAtLoc() const { return Range.getBegin(); }
159 
160  LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocStart() const LLVM_READONLY,
161  "Use getBeginLoc instead") {
162  return getBeginLoc();
163  }
164  SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); }
165  LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocEnd() const LLVM_READONLY,
166  "Use getEndLoc instead") {
167  return getEndLoc();
168  }
169  SourceLocation getEndLoc() const LLVM_READONLY { return Range.getEnd(); }
170 
171  SourceRange getSourceRange() const LLVM_READONLY {
172  return Range;
173  }
174 
175  // Iterators
176  child_range children() { return child_range(&SubExpr, &SubExpr+1); }
177 
179 
181  return reinterpret_cast<Stmt const * const*>(&SubExpr);
182  }
183 
185  return reinterpret_cast<Stmt const * const*>(&SubExpr + 1);
186  }
187 
188  static bool classof(const Stmt *T) {
189  return T->getStmtClass() == ObjCBoxedExprClass;
190  }
191 };
192 
193 /// ObjCArrayLiteral - used for objective-c array containers; as in:
194 /// @[@"Hello", NSApp, [NSNumber numberWithInt:42]];
195 class ObjCArrayLiteral final
196  : public Expr,
197  private llvm::TrailingObjects<ObjCArrayLiteral, Expr *> {
198  unsigned NumElements;
199  SourceRange Range;
200  ObjCMethodDecl *ArrayWithObjectsMethod;
201 
203  QualType T, ObjCMethodDecl * Method,
204  SourceRange SR);
205 
206  explicit ObjCArrayLiteral(EmptyShell Empty, unsigned NumElements)
207  : Expr(ObjCArrayLiteralClass, Empty), NumElements(NumElements) {}
208 
209 public:
210  friend class ASTStmtReader;
212 
213  static ObjCArrayLiteral *Create(const ASTContext &C,
214  ArrayRef<Expr *> Elements,
215  QualType T, ObjCMethodDecl * Method,
216  SourceRange SR);
217 
218  static ObjCArrayLiteral *CreateEmpty(const ASTContext &C,
219  unsigned NumElements);
220 
221  LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocStart() const LLVM_READONLY,
222  "Use getBeginLoc instead") {
223  return getBeginLoc();
224  }
225  SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); }
226  LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocEnd() const LLVM_READONLY,
227  "Use getEndLoc instead") {
228  return getEndLoc();
229  }
230  SourceLocation getEndLoc() const LLVM_READONLY { return Range.getEnd(); }
231  SourceRange getSourceRange() const LLVM_READONLY { return Range; }
232 
233  /// Retrieve elements of array of literals.
234  Expr **getElements() { return getTrailingObjects<Expr *>(); }
235 
236  /// Retrieve elements of array of literals.
237  const Expr * const *getElements() const {
238  return getTrailingObjects<Expr *>();
239  }
240 
241  /// getNumElements - Return number of elements of objective-c array literal.
242  unsigned getNumElements() const { return NumElements; }
243 
244  /// getElement - Return the Element at the specified index.
245  Expr *getElement(unsigned Index) {
246  assert((Index < NumElements) && "Arg access out of range!");
247  return getElements()[Index];
248  }
249  const Expr *getElement(unsigned Index) const {
250  assert((Index < NumElements) && "Arg access out of range!");
251  return getElements()[Index];
252  }
253 
255  return ArrayWithObjectsMethod;
256  }
257 
258  // Iterators
260  return child_range(reinterpret_cast<Stmt **>(getElements()),
261  reinterpret_cast<Stmt **>(getElements()) + NumElements);
262  }
263 
264  static bool classof(const Stmt *T) {
265  return T->getStmtClass() == ObjCArrayLiteralClass;
266  }
267 };
268 
269 /// An element in an Objective-C dictionary literal.
270 ///
272  /// The key for the dictionary element.
274 
275  /// The value of the dictionary element.
277 
278  /// The location of the ellipsis, if this is a pack expansion.
280 
281  /// The number of elements this pack expansion will expand to, if
282  /// this is a pack expansion and is known.
284 
285  /// Determines whether this dictionary element is a pack expansion.
286  bool isPackExpansion() const { return EllipsisLoc.isValid(); }
287 };
288 
289 } // namespace clang
290 
291 namespace llvm {
292 
293 template <> struct isPodLike<clang::ObjCDictionaryElement> : std::true_type {};
294 
295 } // namespace llvm
296 
297 namespace clang {
298 
299 /// Internal struct for storing Key/value pair.
303 };
304 
305 /// Internal struct to describes an element that is a pack
306 /// expansion, used if any of the elements in the dictionary literal
307 /// are pack expansions.
309  /// The location of the ellipsis, if this element is a pack
310  /// expansion.
312 
313  /// If non-zero, the number of elements that this pack
314  /// expansion will expand to (+1).
316 };
317 
318 /// ObjCDictionaryLiteral - AST node to represent objective-c dictionary
319 /// literals; as in: @{@"name" : NSUserName(), @"date" : [NSDate date] };
321  : public Expr,
322  private llvm::TrailingObjects<ObjCDictionaryLiteral,
323  ObjCDictionaryLiteral_KeyValuePair,
324  ObjCDictionaryLiteral_ExpansionData> {
325  /// The number of elements in this dictionary literal.
326  unsigned NumElements : 31;
327 
328  /// Determine whether this dictionary literal has any pack expansions.
329  ///
330  /// If the dictionary literal has pack expansions, then there will
331  /// be an array of pack expansion data following the array of
332  /// key/value pairs, which provide the locations of the ellipses (if
333  /// any) and number of elements in the expansion (if known). If
334  /// there are no pack expansions, we optimize away this storage.
335  unsigned HasPackExpansions : 1;
336 
337  SourceRange Range;
338  ObjCMethodDecl *DictWithObjectsMethod;
339 
342 
344  bool HasPackExpansions,
345  QualType T, ObjCMethodDecl *method,
346  SourceRange SR);
347 
348  explicit ObjCDictionaryLiteral(EmptyShell Empty, unsigned NumElements,
349  bool HasPackExpansions)
350  : Expr(ObjCDictionaryLiteralClass, Empty), NumElements(NumElements),
351  HasPackExpansions(HasPackExpansions) {}
352 
353  size_t numTrailingObjects(OverloadToken<KeyValuePair>) const {
354  return NumElements;
355  }
356 
357 public:
358  friend class ASTStmtReader;
359  friend class ASTStmtWriter;
361 
362  static ObjCDictionaryLiteral *Create(const ASTContext &C,
364  bool HasPackExpansions,
365  QualType T, ObjCMethodDecl *method,
366  SourceRange SR);
367 
369  unsigned NumElements,
370  bool HasPackExpansions);
371 
372  /// getNumElements - Return number of elements of objective-c dictionary
373  /// literal.
374  unsigned getNumElements() const { return NumElements; }
375 
377  assert((Index < NumElements) && "Arg access out of range!");
378  const KeyValuePair &KV = getTrailingObjects<KeyValuePair>()[Index];
380  if (HasPackExpansions) {
381  const ExpansionData &Expansion =
382  getTrailingObjects<ExpansionData>()[Index];
383  Result.EllipsisLoc = Expansion.EllipsisLoc;
384  if (Expansion.NumExpansionsPlusOne > 0)
385  Result.NumExpansions = Expansion.NumExpansionsPlusOne - 1;
386  }
387  return Result;
388  }
389 
391  return DictWithObjectsMethod;
392  }
393 
394  LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocStart() const LLVM_READONLY,
395  "Use getBeginLoc instead") {
396  return getBeginLoc();
397  }
398  SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); }
399  LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocEnd() const LLVM_READONLY,
400  "Use getEndLoc instead") {
401  return getEndLoc();
402  }
403  SourceLocation getEndLoc() const LLVM_READONLY { return Range.getEnd(); }
404  SourceRange getSourceRange() const LLVM_READONLY { return Range; }
405 
406  // Iterators
408  // Note: we're taking advantage of the layout of the KeyValuePair struct
409  // here. If that struct changes, this code will need to change as well.
410  static_assert(sizeof(KeyValuePair) == sizeof(Stmt *) * 2,
411  "KeyValuePair is expected size");
412  return child_range(
413  reinterpret_cast<Stmt **>(getTrailingObjects<KeyValuePair>()),
414  reinterpret_cast<Stmt **>(getTrailingObjects<KeyValuePair>()) +
415  NumElements * 2);
416  }
417 
418  static bool classof(const Stmt *T) {
419  return T->getStmtClass() == ObjCDictionaryLiteralClass;
420  }
421 };
422 
423 /// ObjCEncodeExpr, used for \@encode in Objective-C. \@encode has the same
424 /// type and behavior as StringLiteral except that the string initializer is
425 /// obtained from ASTContext with the encoding type as an argument.
426 class ObjCEncodeExpr : public Expr {
427  TypeSourceInfo *EncodedType;
428  SourceLocation AtLoc, RParenLoc;
429 
430 public:
433  : Expr(ObjCEncodeExprClass, T, VK_LValue, OK_Ordinary,
434  EncodedType->getType()->isDependentType(),
435  EncodedType->getType()->isDependentType(),
436  EncodedType->getType()->isInstantiationDependentType(),
437  EncodedType->getType()->containsUnexpandedParameterPack()),
438  EncodedType(EncodedType), AtLoc(at), RParenLoc(rp) {}
439 
440  explicit ObjCEncodeExpr(EmptyShell Empty) : Expr(ObjCEncodeExprClass, Empty){}
441 
442  SourceLocation getAtLoc() const { return AtLoc; }
443  void setAtLoc(SourceLocation L) { AtLoc = L; }
444  SourceLocation getRParenLoc() const { return RParenLoc; }
445  void setRParenLoc(SourceLocation L) { RParenLoc = L; }
446 
447  QualType getEncodedType() const { return EncodedType->getType(); }
448 
449  TypeSourceInfo *getEncodedTypeSourceInfo() const { return EncodedType; }
450 
452  EncodedType = EncType;
453  }
454 
455  LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocStart() const LLVM_READONLY,
456  "Use getBeginLoc instead") {
457  return getBeginLoc();
458  }
459  SourceLocation getBeginLoc() const LLVM_READONLY { return AtLoc; }
460  LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocEnd() const LLVM_READONLY,
461  "Use getEndLoc instead") {
462  return getEndLoc();
463  }
464  SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
465 
466  // Iterators
469  }
470 
471  static bool classof(const Stmt *T) {
472  return T->getStmtClass() == ObjCEncodeExprClass;
473  }
474 };
475 
476 /// ObjCSelectorExpr used for \@selector in Objective-C.
477 class ObjCSelectorExpr : public Expr {
478  Selector SelName;
479  SourceLocation AtLoc, RParenLoc;
480 
481 public:
484  : Expr(ObjCSelectorExprClass, T, VK_RValue, OK_Ordinary, false, false,
485  false, false),
486  SelName(selInfo), AtLoc(at), RParenLoc(rp) {}
487  explicit ObjCSelectorExpr(EmptyShell Empty)
488  : Expr(ObjCSelectorExprClass, Empty) {}
489 
490  Selector getSelector() const { return SelName; }
491  void setSelector(Selector S) { SelName = S; }
492 
493  SourceLocation getAtLoc() const { return AtLoc; }
494  SourceLocation getRParenLoc() const { return RParenLoc; }
495  void setAtLoc(SourceLocation L) { AtLoc = L; }
496  void setRParenLoc(SourceLocation L) { RParenLoc = L; }
497 
498  LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocStart() const LLVM_READONLY,
499  "Use getBeginLoc instead") {
500  return getBeginLoc();
501  }
502  SourceLocation getBeginLoc() const LLVM_READONLY { return AtLoc; }
503  LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocEnd() const LLVM_READONLY,
504  "Use getEndLoc instead") {
505  return getEndLoc();
506  }
507  SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
508 
509  /// getNumArgs - Return the number of actual arguments to this call.
510  unsigned getNumArgs() const { return SelName.getNumArgs(); }
511 
512  // Iterators
515  }
516 
517  static bool classof(const Stmt *T) {
518  return T->getStmtClass() == ObjCSelectorExprClass;
519  }
520 };
521 
522 /// ObjCProtocolExpr used for protocol expression in Objective-C.
523 ///
524 /// This is used as: \@protocol(foo), as in:
525 /// \code
526 /// [obj conformsToProtocol:@protocol(foo)]
527 /// \endcode
528 ///
529 /// The return type is "Protocol*".
530 class ObjCProtocolExpr : public Expr {
531  ObjCProtocolDecl *TheProtocol;
532  SourceLocation AtLoc, ProtoLoc, RParenLoc;
533 
534 public:
535  friend class ASTStmtReader;
536  friend class ASTStmtWriter;
537 
540  : Expr(ObjCProtocolExprClass, T, VK_RValue, OK_Ordinary, false, false,
541  false, false),
542  TheProtocol(protocol), AtLoc(at), ProtoLoc(protoLoc), RParenLoc(rp) {}
543  explicit ObjCProtocolExpr(EmptyShell Empty)
544  : Expr(ObjCProtocolExprClass, Empty) {}
545 
546  ObjCProtocolDecl *getProtocol() const { return TheProtocol; }
547  void setProtocol(ObjCProtocolDecl *P) { TheProtocol = P; }
548 
549  SourceLocation getProtocolIdLoc() const { return ProtoLoc; }
550  SourceLocation getAtLoc() const { return AtLoc; }
551  SourceLocation getRParenLoc() const { return RParenLoc; }
552  void setAtLoc(SourceLocation L) { AtLoc = L; }
553  void setRParenLoc(SourceLocation L) { RParenLoc = L; }
554 
555  LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocStart() const LLVM_READONLY,
556  "Use getBeginLoc instead") {
557  return getBeginLoc();
558  }
559  SourceLocation getBeginLoc() const LLVM_READONLY { return AtLoc; }
560  LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocEnd() const LLVM_READONLY,
561  "Use getEndLoc instead") {
562  return getEndLoc();
563  }
564  SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
565 
566  // Iterators
569  }
570 
571  static bool classof(const Stmt *T) {
572  return T->getStmtClass() == ObjCProtocolExprClass;
573  }
574 };
575 
576 /// ObjCIvarRefExpr - A reference to an ObjC instance variable.
577 class ObjCIvarRefExpr : public Expr {
578  ObjCIvarDecl *D;
579  Stmt *Base;
580  SourceLocation Loc;
581 
582  /// OpLoc - This is the location of '.' or '->'
583  SourceLocation OpLoc;
584 
585  // True if this is "X->F", false if this is "X.F".
586  bool IsArrow : 1;
587 
588  // True if ivar reference has no base (self assumed).
589  bool IsFreeIvar : 1;
590 
591 public:
594  Expr *base,
595  bool arrow = false, bool freeIvar = false)
596  : Expr(ObjCIvarRefExprClass, t, VK_LValue,
597  d->isBitField() ? OK_BitField : OK_Ordinary,
598  /*TypeDependent=*/false, base->isValueDependent(),
599  base->isInstantiationDependent(),
601  D(d), Base(base), Loc(l), OpLoc(oploc), IsArrow(arrow),
602  IsFreeIvar(freeIvar) {}
603 
604  explicit ObjCIvarRefExpr(EmptyShell Empty)
605  : Expr(ObjCIvarRefExprClass, Empty) {}
606 
607  ObjCIvarDecl *getDecl() { return D; }
608  const ObjCIvarDecl *getDecl() const { return D; }
609  void setDecl(ObjCIvarDecl *d) { D = d; }
610 
611  const Expr *getBase() const { return cast<Expr>(Base); }
612  Expr *getBase() { return cast<Expr>(Base); }
613  void setBase(Expr * base) { Base = base; }
614 
615  bool isArrow() const { return IsArrow; }
616  bool isFreeIvar() const { return IsFreeIvar; }
617  void setIsArrow(bool A) { IsArrow = A; }
618  void setIsFreeIvar(bool A) { IsFreeIvar = A; }
619 
620  SourceLocation getLocation() const { return Loc; }
621  void setLocation(SourceLocation L) { Loc = L; }
622 
623  LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocStart() const LLVM_READONLY,
624  "Use getBeginLoc instead") {
625  return getBeginLoc();
626  }
627  SourceLocation getBeginLoc() const LLVM_READONLY {
628  return isFreeIvar() ? Loc : getBase()->getBeginLoc();
629  }
630  LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocEnd() const LLVM_READONLY,
631  "Use getEndLoc instead") {
632  return getEndLoc();
633  }
634  SourceLocation getEndLoc() const LLVM_READONLY { return Loc; }
635 
636  SourceLocation getOpLoc() const { return OpLoc; }
637  void setOpLoc(SourceLocation L) { OpLoc = L; }
638 
639  // Iterators
640  child_range children() { return child_range(&Base, &Base+1); }
641 
642  static bool classof(const Stmt *T) {
643  return T->getStmtClass() == ObjCIvarRefExprClass;
644  }
645 };
646 
647 /// ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC
648 /// property.
649 class ObjCPropertyRefExpr : public Expr {
650 private:
651  /// If the bool is true, this is an implicit property reference; the
652  /// pointer is an (optional) ObjCMethodDecl and Setter may be set.
653  /// if the bool is false, this is an explicit property reference;
654  /// the pointer is an ObjCPropertyDecl and Setter is always null.
655  llvm::PointerIntPair<NamedDecl *, 1, bool> PropertyOrGetter;
656 
657  /// Indicates whether the property reference will result in a message
658  /// to the getter, the setter, or both.
659  /// This applies to both implicit and explicit property references.
660  enum MethodRefFlags {
661  MethodRef_None = 0,
662  MethodRef_Getter = 0x1,
663  MethodRef_Setter = 0x2
664  };
665 
666  /// Contains the Setter method pointer and MethodRefFlags bit flags.
667  llvm::PointerIntPair<ObjCMethodDecl *, 2, unsigned> SetterAndMethodRefFlags;
668 
669  // FIXME: Maybe we should store the property identifier here,
670  // because it's not rederivable from the other data when there's an
671  // implicit property with no getter (because the 'foo' -> 'setFoo:'
672  // transformation is lossy on the first character).
673 
674  SourceLocation IdLoc;
675 
676  /// When the receiver in property access is 'super', this is
677  /// the location of the 'super' keyword. When it's an interface,
678  /// this is that interface.
679  SourceLocation ReceiverLoc;
680  llvm::PointerUnion3<Stmt *, const Type *, ObjCInterfaceDecl *> Receiver;
681 
682 public:
685  SourceLocation l, Expr *base)
686  : Expr(ObjCPropertyRefExprClass, t, VK, OK,
687  /*TypeDependent=*/false, base->isValueDependent(),
688  base->isInstantiationDependent(),
690  PropertyOrGetter(PD, false), IdLoc(l), Receiver(base) {
691  assert(t->isSpecificPlaceholderType(BuiltinType::PseudoObject));
692  }
693 
697  : Expr(ObjCPropertyRefExprClass, t, VK, OK,
698  /*TypeDependent=*/false, false, st->isInstantiationDependentType(),
700  PropertyOrGetter(PD, false), IdLoc(l), ReceiverLoc(sl),
701  Receiver(st.getTypePtr()) {
702  assert(t->isSpecificPlaceholderType(BuiltinType::PseudoObject));
703  }
704 
707  SourceLocation IdLoc, Expr *Base)
708  : Expr(ObjCPropertyRefExprClass, T, VK, OK, false,
711  PropertyOrGetter(Getter, true), SetterAndMethodRefFlags(Setter, 0),
712  IdLoc(IdLoc), Receiver(Base) {
713  assert(T->isSpecificPlaceholderType(BuiltinType::PseudoObject));
714  }
715 
718  SourceLocation IdLoc,
719  SourceLocation SuperLoc, QualType SuperTy)
720  : Expr(ObjCPropertyRefExprClass, T, VK, OK, false, false, false, false),
721  PropertyOrGetter(Getter, true), SetterAndMethodRefFlags(Setter, 0),
722  IdLoc(IdLoc), ReceiverLoc(SuperLoc), Receiver(SuperTy.getTypePtr()) {
723  assert(T->isSpecificPlaceholderType(BuiltinType::PseudoObject));
724  }
725 
728  SourceLocation IdLoc,
729  SourceLocation ReceiverLoc, ObjCInterfaceDecl *Receiver)
730  : Expr(ObjCPropertyRefExprClass, T, VK, OK, false, false, false, false),
731  PropertyOrGetter(Getter, true), SetterAndMethodRefFlags(Setter, 0),
732  IdLoc(IdLoc), ReceiverLoc(ReceiverLoc), Receiver(Receiver) {
733  assert(T->isSpecificPlaceholderType(BuiltinType::PseudoObject));
734  }
735 
737  : Expr(ObjCPropertyRefExprClass, Empty) {}
738 
739  bool isImplicitProperty() const { return PropertyOrGetter.getInt(); }
740  bool isExplicitProperty() const { return !PropertyOrGetter.getInt(); }
741 
743  assert(!isImplicitProperty());
744  return cast<ObjCPropertyDecl>(PropertyOrGetter.getPointer());
745  }
746 
748  assert(isImplicitProperty());
749  return cast_or_null<ObjCMethodDecl>(PropertyOrGetter.getPointer());
750  }
751 
753  assert(isImplicitProperty());
754  return SetterAndMethodRefFlags.getPointer();
755  }
756 
758  if (isImplicitProperty())
759  return getImplicitPropertyGetter()->getSelector();
760  return getExplicitProperty()->getGetterName();
761  }
762 
764  if (isImplicitProperty())
765  return getImplicitPropertySetter()->getSelector();
766  return getExplicitProperty()->getSetterName();
767  }
768 
769  /// True if the property reference will result in a message to the
770  /// getter.
771  /// This applies to both implicit and explicit property references.
772  bool isMessagingGetter() const {
773  return SetterAndMethodRefFlags.getInt() & MethodRef_Getter;
774  }
775 
776  /// True if the property reference will result in a message to the
777  /// setter.
778  /// This applies to both implicit and explicit property references.
779  bool isMessagingSetter() const {
780  return SetterAndMethodRefFlags.getInt() & MethodRef_Setter;
781  }
782 
783  void setIsMessagingGetter(bool val = true) {
784  setMethodRefFlag(MethodRef_Getter, val);
785  }
786 
787  void setIsMessagingSetter(bool val = true) {
788  setMethodRefFlag(MethodRef_Setter, val);
789  }
790 
791  const Expr *getBase() const {
792  return cast<Expr>(Receiver.get<Stmt*>());
793  }
795  return cast<Expr>(Receiver.get<Stmt*>());
796  }
797 
798  SourceLocation getLocation() const { return IdLoc; }
799 
800  SourceLocation getReceiverLocation() const { return ReceiverLoc; }
801 
803  return QualType(Receiver.get<const Type*>(), 0);
804  }
805 
807  return Receiver.get<ObjCInterfaceDecl*>();
808  }
809 
810  bool isObjectReceiver() const { return Receiver.is<Stmt*>(); }
811  bool isSuperReceiver() const { return Receiver.is<const Type*>(); }
812  bool isClassReceiver() const { return Receiver.is<ObjCInterfaceDecl*>(); }
813 
814  /// Determine the type of the base, regardless of the kind of receiver.
815  QualType getReceiverType(const ASTContext &ctx) const;
816 
817  LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocStart() const LLVM_READONLY,
818  "Use getBeginLoc instead") {
819  return getBeginLoc();
820  }
821  SourceLocation getBeginLoc() const LLVM_READONLY {
822  return isObjectReceiver() ? getBase()->getBeginLoc()
823  : getReceiverLocation();
824  }
825 
826  LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocEnd() const LLVM_READONLY,
827  "Use getEndLoc instead") {
828  return getEndLoc();
829  }
830  SourceLocation getEndLoc() const LLVM_READONLY { return IdLoc; }
831 
832  // Iterators
834  if (Receiver.is<Stmt*>()) {
835  Stmt **begin = reinterpret_cast<Stmt**>(&Receiver); // hack!
836  return child_range(begin, begin+1);
837  }
839  }
840 
841  static bool classof(const Stmt *T) {
842  return T->getStmtClass() == ObjCPropertyRefExprClass;
843  }
844 
845 private:
846  friend class ASTStmtReader;
847  friend class ASTStmtWriter;
848 
849  void setExplicitProperty(ObjCPropertyDecl *D, unsigned methRefFlags) {
850  PropertyOrGetter.setPointer(D);
851  PropertyOrGetter.setInt(false);
852  SetterAndMethodRefFlags.setPointer(nullptr);
853  SetterAndMethodRefFlags.setInt(methRefFlags);
854  }
855 
856  void setImplicitProperty(ObjCMethodDecl *Getter, ObjCMethodDecl *Setter,
857  unsigned methRefFlags) {
858  PropertyOrGetter.setPointer(Getter);
859  PropertyOrGetter.setInt(true);
860  SetterAndMethodRefFlags.setPointer(Setter);
861  SetterAndMethodRefFlags.setInt(methRefFlags);
862  }
863 
864  void setBase(Expr *Base) { Receiver = Base; }
865  void setSuperReceiver(QualType T) { Receiver = T.getTypePtr(); }
866  void setClassReceiver(ObjCInterfaceDecl *D) { Receiver = D; }
867 
868  void setLocation(SourceLocation L) { IdLoc = L; }
869  void setReceiverLocation(SourceLocation Loc) { ReceiverLoc = Loc; }
870 
871  void setMethodRefFlag(MethodRefFlags flag, bool val) {
872  unsigned f = SetterAndMethodRefFlags.getInt();
873  if (val)
874  f |= flag;
875  else
876  f &= ~flag;
877  SetterAndMethodRefFlags.setInt(f);
878  }
879 };
880 
881 /// ObjCSubscriptRefExpr - used for array and dictionary subscripting.
882 /// array[4] = array[3]; dictionary[key] = dictionary[alt_key];
883 class ObjCSubscriptRefExpr : public Expr {
884  // Location of ']' in an indexing expression.
885  SourceLocation RBracket;
886 
887  // array/dictionary base expression.
888  // for arrays, this is a numeric expression. For dictionaries, this is
889  // an objective-c object pointer expression.
890  enum { BASE, KEY, END_EXPR };
891  Stmt* SubExprs[END_EXPR];
892 
893  ObjCMethodDecl *GetAtIndexMethodDecl;
894 
895  // For immutable objects this is null. When ObjCSubscriptRefExpr is to read
896  // an indexed object this is null too.
897  ObjCMethodDecl *SetAtIndexMethodDecl;
898 
899 public:
902  ObjCMethodDecl *getMethod,
903  ObjCMethodDecl *setMethod, SourceLocation RB)
904  : Expr(ObjCSubscriptRefExprClass, T, VK, OK,
905  base->isTypeDependent() || key->isTypeDependent(),
906  base->isValueDependent() || key->isValueDependent(),
907  (base->isInstantiationDependent() ||
908  key->isInstantiationDependent()),
911  RBracket(RB), GetAtIndexMethodDecl(getMethod),
912  SetAtIndexMethodDecl(setMethod) {
913  SubExprs[BASE] = base; SubExprs[KEY] = key;
914  }
915 
917  : Expr(ObjCSubscriptRefExprClass, Empty) {}
918 
919  SourceLocation getRBracket() const { return RBracket; }
920  void setRBracket(SourceLocation RB) { RBracket = RB; }
921 
922  LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocStart() const LLVM_READONLY,
923  "Use getBeginLoc instead") {
924  return getBeginLoc();
925  }
926  SourceLocation getBeginLoc() const LLVM_READONLY {
927  return SubExprs[BASE]->getBeginLoc();
928  }
929 
930  LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocEnd() const LLVM_READONLY,
931  "Use getEndLoc instead") {
932  return getEndLoc();
933  }
934  SourceLocation getEndLoc() const LLVM_READONLY { return RBracket; }
935 
936  Expr *getBaseExpr() const { return cast<Expr>(SubExprs[BASE]); }
937  void setBaseExpr(Stmt *S) { SubExprs[BASE] = S; }
938 
939  Expr *getKeyExpr() const { return cast<Expr>(SubExprs[KEY]); }
940  void setKeyExpr(Stmt *S) { SubExprs[KEY] = S; }
941 
943  return GetAtIndexMethodDecl;
944  }
945 
947  return SetAtIndexMethodDecl;
948  }
949 
950  bool isArraySubscriptRefExpr() const {
951  return getKeyExpr()->getType()->isIntegralOrEnumerationType();
952  }
953 
955  return child_range(SubExprs, SubExprs+END_EXPR);
956  }
957 
958  static bool classof(const Stmt *T) {
959  return T->getStmtClass() == ObjCSubscriptRefExprClass;
960  }
961 
962 private:
963  friend class ASTStmtReader;
964 };
965 
966 /// An expression that sends a message to the given Objective-C
967 /// object or class.
968 ///
969 /// The following contains two message send expressions:
970 ///
971 /// \code
972 /// [[NSString alloc] initWithString:@"Hello"]
973 /// \endcode
974 ///
975 /// The innermost message send invokes the "alloc" class method on the
976 /// NSString class, while the outermost message send invokes the
977 /// "initWithString" instance method on the object returned from
978 /// NSString's "alloc". In all, an Objective-C message send can take
979 /// on four different (although related) forms:
980 ///
981 /// 1. Send to an object instance.
982 /// 2. Send to a class.
983 /// 3. Send to the superclass instance of the current class.
984 /// 4. Send to the superclass of the current class.
985 ///
986 /// All four kinds of message sends are modeled by the ObjCMessageExpr
987 /// class, and can be distinguished via \c getReceiverKind(). Example:
988 ///
989 /// The "void *" trailing objects are actually ONE void * (the
990 /// receiver pointer), and NumArgs Expr *. But due to the
991 /// implementation of children(), these must be together contiguously.
992 class ObjCMessageExpr final
993  : public Expr,
994  private llvm::TrailingObjects<ObjCMessageExpr, void *, SourceLocation> {
995  /// Stores either the selector that this message is sending
996  /// to (when \c HasMethod is zero) or an \c ObjCMethodDecl pointer
997  /// referring to the method that we type-checked against.
998  uintptr_t SelectorOrMethod = 0;
999 
1000  enum { NumArgsBitWidth = 16 };
1001 
1002  /// The number of arguments in the message send, not
1003  /// including the receiver.
1004  unsigned NumArgs : NumArgsBitWidth;
1005 
1006  /// The kind of message send this is, which is one of the
1007  /// ReceiverKind values.
1008  ///
1009  /// We pad this out to a byte to avoid excessive masking and shifting.
1010  unsigned Kind : 8;
1011 
1012  /// Whether we have an actual method prototype in \c
1013  /// SelectorOrMethod.
1014  ///
1015  /// When non-zero, we have a method declaration; otherwise, we just
1016  /// have a selector.
1017  unsigned HasMethod : 1;
1018 
1019  /// Whether this message send is a "delegate init call",
1020  /// i.e. a call of an init method on self from within an init method.
1021  unsigned IsDelegateInitCall : 1;
1022 
1023  /// Whether this message send was implicitly generated by
1024  /// the implementation rather than explicitly written by the user.
1025  unsigned IsImplicit : 1;
1026 
1027  /// Whether the locations of the selector identifiers are in a
1028  /// "standard" position, a enum SelectorLocationsKind.
1029  unsigned SelLocsKind : 2;
1030 
1031  /// When the message expression is a send to 'super', this is
1032  /// the location of the 'super' keyword.
1033  SourceLocation SuperLoc;
1034 
1035  /// The source locations of the open and close square
1036  /// brackets ('[' and ']', respectively).
1037  SourceLocation LBracLoc, RBracLoc;
1038 
1039  ObjCMessageExpr(EmptyShell Empty, unsigned NumArgs)
1040  : Expr(ObjCMessageExprClass, Empty), Kind(0), HasMethod(false),
1041  IsDelegateInitCall(false), IsImplicit(false), SelLocsKind(0) {
1042  setNumArgs(NumArgs);
1043  }
1044 
1046  SourceLocation LBracLoc,
1047  SourceLocation SuperLoc,
1048  bool IsInstanceSuper,
1049  QualType SuperType,
1050  Selector Sel,
1051  ArrayRef<SourceLocation> SelLocs,
1052  SelectorLocationsKind SelLocsK,
1053  ObjCMethodDecl *Method,
1054  ArrayRef<Expr *> Args,
1055  SourceLocation RBracLoc,
1056  bool isImplicit);
1058  SourceLocation LBracLoc,
1059  TypeSourceInfo *Receiver,
1060  Selector Sel,
1061  ArrayRef<SourceLocation> SelLocs,
1062  SelectorLocationsKind SelLocsK,
1063  ObjCMethodDecl *Method,
1064  ArrayRef<Expr *> Args,
1065  SourceLocation RBracLoc,
1066  bool isImplicit);
1068  SourceLocation LBracLoc,
1069  Expr *Receiver,
1070  Selector Sel,
1071  ArrayRef<SourceLocation> SelLocs,
1072  SelectorLocationsKind SelLocsK,
1073  ObjCMethodDecl *Method,
1074  ArrayRef<Expr *> Args,
1075  SourceLocation RBracLoc,
1076  bool isImplicit);
1077 
1078  size_t numTrailingObjects(OverloadToken<void *>) const { return NumArgs + 1; }
1079 
1080  void setNumArgs(unsigned Num) {
1081  assert((Num >> NumArgsBitWidth) == 0 && "Num of args is out of range!");
1082  NumArgs = Num;
1083  }
1084 
1085  void initArgsAndSelLocs(ArrayRef<Expr *> Args,
1086  ArrayRef<SourceLocation> SelLocs,
1087  SelectorLocationsKind SelLocsK);
1088 
1089  /// Retrieve the pointer value of the message receiver.
1090  void *getReceiverPointer() const { return *getTrailingObjects<void *>(); }
1091 
1092  /// Set the pointer value of the message receiver.
1093  void setReceiverPointer(void *Value) {
1094  *getTrailingObjects<void *>() = Value;
1095  }
1096 
1097  SelectorLocationsKind getSelLocsKind() const {
1098  return (SelectorLocationsKind)SelLocsKind;
1099  }
1100 
1101  bool hasStandardSelLocs() const {
1102  return getSelLocsKind() != SelLoc_NonStandard;
1103  }
1104 
1105  /// Get a pointer to the stored selector identifiers locations array.
1106  /// No locations will be stored if HasStandardSelLocs is true.
1107  SourceLocation *getStoredSelLocs() {
1108  return getTrailingObjects<SourceLocation>();
1109  }
1110  const SourceLocation *getStoredSelLocs() const {
1111  return getTrailingObjects<SourceLocation>();
1112  }
1113 
1114  /// Get the number of stored selector identifiers locations.
1115  /// No locations will be stored if HasStandardSelLocs is true.
1116  unsigned getNumStoredSelLocs() const {
1117  if (hasStandardSelLocs())
1118  return 0;
1119  return getNumSelectorLocs();
1120  }
1121 
1122  static ObjCMessageExpr *alloc(const ASTContext &C,
1123  ArrayRef<Expr *> Args,
1124  SourceLocation RBraceLoc,
1125  ArrayRef<SourceLocation> SelLocs,
1126  Selector Sel,
1127  SelectorLocationsKind &SelLocsK);
1128  static ObjCMessageExpr *alloc(const ASTContext &C,
1129  unsigned NumArgs,
1130  unsigned NumStoredSelLocs);
1131 
1132 public:
1133  friend class ASTStmtReader;
1134  friend class ASTStmtWriter;
1136 
1137  /// The kind of receiver this message is sending to.
1139  /// The receiver is a class.
1140  Class = 0,
1141 
1142  /// The receiver is an object instance.
1144 
1145  /// The receiver is a superclass.
1147 
1148  /// The receiver is the instance of the superclass object.
1149  SuperInstance
1150  };
1151 
1152  /// Create a message send to super.
1153  ///
1154  /// \param Context The ASTContext in which this expression will be created.
1155  ///
1156  /// \param T The result type of this message.
1157  ///
1158  /// \param VK The value kind of this message. A message returning
1159  /// a l-value or r-value reference will be an l-value or x-value,
1160  /// respectively.
1161  ///
1162  /// \param LBracLoc The location of the open square bracket '['.
1163  ///
1164  /// \param SuperLoc The location of the "super" keyword.
1165  ///
1166  /// \param IsInstanceSuper Whether this is an instance "super"
1167  /// message (otherwise, it's a class "super" message).
1168  ///
1169  /// \param Sel The selector used to determine which method gets called.
1170  ///
1171  /// \param Method The Objective-C method against which this message
1172  /// send was type-checked. May be nullptr.
1173  ///
1174  /// \param Args The message send arguments.
1175  ///
1176  /// \param RBracLoc The location of the closing square bracket ']'.
1177  static ObjCMessageExpr *Create(const ASTContext &Context, QualType T,
1178  ExprValueKind VK,
1179  SourceLocation LBracLoc,
1180  SourceLocation SuperLoc,
1181  bool IsInstanceSuper,
1182  QualType SuperType,
1183  Selector Sel,
1184  ArrayRef<SourceLocation> SelLocs,
1185  ObjCMethodDecl *Method,
1186  ArrayRef<Expr *> Args,
1187  SourceLocation RBracLoc,
1188  bool isImplicit);
1189 
1190  /// Create a class message send.
1191  ///
1192  /// \param Context The ASTContext in which this expression will be created.
1193  ///
1194  /// \param T The result type of this message.
1195  ///
1196  /// \param VK The value kind of this message. A message returning
1197  /// a l-value or r-value reference will be an l-value or x-value,
1198  /// respectively.
1199  ///
1200  /// \param LBracLoc The location of the open square bracket '['.
1201  ///
1202  /// \param Receiver The type of the receiver, including
1203  /// source-location information.
1204  ///
1205  /// \param Sel The selector used to determine which method gets called.
1206  ///
1207  /// \param Method The Objective-C method against which this message
1208  /// send was type-checked. May be nullptr.
1209  ///
1210  /// \param Args The message send arguments.
1211  ///
1212  /// \param RBracLoc The location of the closing square bracket ']'.
1213  static ObjCMessageExpr *Create(const ASTContext &Context, QualType T,
1214  ExprValueKind VK,
1215  SourceLocation LBracLoc,
1216  TypeSourceInfo *Receiver,
1217  Selector Sel,
1218  ArrayRef<SourceLocation> SelLocs,
1219  ObjCMethodDecl *Method,
1220  ArrayRef<Expr *> Args,
1221  SourceLocation RBracLoc,
1222  bool isImplicit);
1223 
1224  /// Create an instance message send.
1225  ///
1226  /// \param Context The ASTContext in which this expression will be created.
1227  ///
1228  /// \param T The result type of this message.
1229  ///
1230  /// \param VK The value kind of this message. A message returning
1231  /// a l-value or r-value reference will be an l-value or x-value,
1232  /// respectively.
1233  ///
1234  /// \param LBracLoc The location of the open square bracket '['.
1235  ///
1236  /// \param Receiver The expression used to produce the object that
1237  /// will receive this message.
1238  ///
1239  /// \param Sel The selector used to determine which method gets called.
1240  ///
1241  /// \param Method The Objective-C method against which this message
1242  /// send was type-checked. May be nullptr.
1243  ///
1244  /// \param Args The message send arguments.
1245  ///
1246  /// \param RBracLoc The location of the closing square bracket ']'.
1247  static ObjCMessageExpr *Create(const ASTContext &Context, QualType T,
1248  ExprValueKind VK,
1249  SourceLocation LBracLoc,
1250  Expr *Receiver,
1251  Selector Sel,
1252  ArrayRef<SourceLocation> SeLocs,
1253  ObjCMethodDecl *Method,
1254  ArrayRef<Expr *> Args,
1255  SourceLocation RBracLoc,
1256  bool isImplicit);
1257 
1258  /// Create an empty Objective-C message expression, to be
1259  /// filled in by subsequent calls.
1260  ///
1261  /// \param Context The context in which the message send will be created.
1262  ///
1263  /// \param NumArgs The number of message arguments, not including
1264  /// the receiver.
1265  static ObjCMessageExpr *CreateEmpty(const ASTContext &Context,
1266  unsigned NumArgs,
1267  unsigned NumStoredSelLocs);
1268 
1269  /// Indicates whether the message send was implicitly
1270  /// generated by the implementation. If false, it was written explicitly
1271  /// in the source code.
1272  bool isImplicit() const { return IsImplicit; }
1273 
1274  /// Determine the kind of receiver that this message is being
1275  /// sent to.
1277 
1278  /// Source range of the receiver.
1279  SourceRange getReceiverRange() const;
1280 
1281  /// Determine whether this is an instance message to either a
1282  /// computed object or to super.
1283  bool isInstanceMessage() const {
1284  return getReceiverKind() == Instance || getReceiverKind() == SuperInstance;
1285  }
1286 
1287  /// Determine whether this is an class message to either a
1288  /// specified class or to super.
1289  bool isClassMessage() const {
1290  return getReceiverKind() == Class || getReceiverKind() == SuperClass;
1291  }
1292 
1293  /// Returns the object expression (receiver) for an instance message,
1294  /// or null for a message that is not an instance message.
1296  if (getReceiverKind() == Instance)
1297  return static_cast<Expr *>(getReceiverPointer());
1298 
1299  return nullptr;
1300  }
1301  const Expr *getInstanceReceiver() const {
1302  return const_cast<ObjCMessageExpr*>(this)->getInstanceReceiver();
1303  }
1304 
1305  /// Turn this message send into an instance message that
1306  /// computes the receiver object with the given expression.
1308  Kind = Instance;
1309  setReceiverPointer(rec);
1310  }
1311 
1312  /// Returns the type of a class message send, or NULL if the
1313  /// message is not a class message.
1315  if (TypeSourceInfo *TSInfo = getClassReceiverTypeInfo())
1316  return TSInfo->getType();
1317 
1318  return {};
1319  }
1320 
1321  /// Returns a type-source information of a class message
1322  /// send, or nullptr if the message is not a class message.
1324  if (getReceiverKind() == Class)
1325  return reinterpret_cast<TypeSourceInfo *>(getReceiverPointer());
1326  return nullptr;
1327  }
1328 
1330  Kind = Class;
1331  setReceiverPointer(TSInfo);
1332  }
1333 
1334  /// Retrieve the location of the 'super' keyword for a class
1335  /// or instance message to 'super', otherwise an invalid source location.
1337  if (getReceiverKind() == SuperInstance || getReceiverKind() == SuperClass)
1338  return SuperLoc;
1339 
1340  return SourceLocation();
1341  }
1342 
1343  /// Retrieve the receiver type to which this message is being directed.
1344  ///
1345  /// This routine cross-cuts all of the different kinds of message
1346  /// sends to determine what the underlying (statically known) type
1347  /// of the receiver will be; use \c getReceiverKind() to determine
1348  /// whether the message is a class or an instance method, whether it
1349  /// is a send to super or not, etc.
1350  ///
1351  /// \returns The type of the receiver.
1352  QualType getReceiverType() const;
1353 
1354  /// Retrieve the Objective-C interface to which this message
1355  /// is being directed, if known.
1356  ///
1357  /// This routine cross-cuts all of the different kinds of message
1358  /// sends to determine what the underlying (statically known) type
1359  /// of the receiver will be; use \c getReceiverKind() to determine
1360  /// whether the message is a class or an instance method, whether it
1361  /// is a send to super or not, etc.
1362  ///
1363  /// \returns The Objective-C interface if known, otherwise nullptr.
1364  ObjCInterfaceDecl *getReceiverInterface() const;
1365 
1366  /// Retrieve the type referred to by 'super'.
1367  ///
1368  /// The returned type will either be an ObjCInterfaceType (for an
1369  /// class message to super) or an ObjCObjectPointerType that refers
1370  /// to a class (for an instance message to super);
1372  if (getReceiverKind() == SuperInstance || getReceiverKind() == SuperClass)
1373  return QualType::getFromOpaquePtr(getReceiverPointer());
1374 
1375  return QualType();
1376  }
1377 
1378  void setSuper(SourceLocation Loc, QualType T, bool IsInstanceSuper) {
1379  Kind = IsInstanceSuper? SuperInstance : SuperClass;
1380  SuperLoc = Loc;
1381  setReceiverPointer(T.getAsOpaquePtr());
1382  }
1383 
1384  Selector getSelector() const;
1385 
1387  HasMethod = false;
1388  SelectorOrMethod = reinterpret_cast<uintptr_t>(S.getAsOpaquePtr());
1389  }
1390 
1392  if (HasMethod)
1393  return reinterpret_cast<const ObjCMethodDecl *>(SelectorOrMethod);
1394 
1395  return nullptr;
1396  }
1397 
1399  if (HasMethod)
1400  return reinterpret_cast<ObjCMethodDecl *>(SelectorOrMethod);
1401 
1402  return nullptr;
1403  }
1404 
1406  HasMethod = true;
1407  SelectorOrMethod = reinterpret_cast<uintptr_t>(MD);
1408  }
1409 
1411  if (HasMethod) return getMethodDecl()->getMethodFamily();
1412  return getSelector().getMethodFamily();
1413  }
1414 
1415  /// Return the number of actual arguments in this message,
1416  /// not counting the receiver.
1417  unsigned getNumArgs() const { return NumArgs; }
1418 
1419  /// Retrieve the arguments to this message, not including the
1420  /// receiver.
1422  return reinterpret_cast<Expr **>(getTrailingObjects<void *>() + 1);
1423  }
1424  const Expr * const *getArgs() const {
1425  return reinterpret_cast<const Expr *const *>(getTrailingObjects<void *>() +
1426  1);
1427  }
1428 
1429  /// getArg - Return the specified argument.
1430  Expr *getArg(unsigned Arg) {
1431  assert(Arg < NumArgs && "Arg access out of range!");
1432  return getArgs()[Arg];
1433  }
1434  const Expr *getArg(unsigned Arg) const {
1435  assert(Arg < NumArgs && "Arg access out of range!");
1436  return getArgs()[Arg];
1437  }
1438 
1439  /// setArg - Set the specified argument.
1440  void setArg(unsigned Arg, Expr *ArgExpr) {
1441  assert(Arg < NumArgs && "Arg access out of range!");
1442  getArgs()[Arg] = ArgExpr;
1443  }
1444 
1445  /// isDelegateInitCall - Answers whether this message send has been
1446  /// tagged as a "delegate init call", i.e. a call to a method in the
1447  /// -init family on self from within an -init method implementation.
1448  bool isDelegateInitCall() const { return IsDelegateInitCall; }
1449  void setDelegateInitCall(bool isDelegate) { IsDelegateInitCall = isDelegate; }
1450 
1451  SourceLocation getLeftLoc() const { return LBracLoc; }
1452  SourceLocation getRightLoc() const { return RBracLoc; }
1453 
1455  if (isImplicit())
1456  return getBeginLoc();
1457  return getSelectorLoc(0);
1458  }
1459 
1460  SourceLocation getSelectorLoc(unsigned Index) const {
1461  assert(Index < getNumSelectorLocs() && "Index out of range!");
1462  if (hasStandardSelLocs())
1463  return getStandardSelectorLoc(Index, getSelector(),
1464  getSelLocsKind() == SelLoc_StandardWithSpace,
1465  llvm::makeArrayRef(const_cast<Expr**>(getArgs()),
1466  getNumArgs()),
1467  RBracLoc);
1468  return getStoredSelLocs()[Index];
1469  }
1470 
1471  void getSelectorLocs(SmallVectorImpl<SourceLocation> &SelLocs) const;
1472 
1473  unsigned getNumSelectorLocs() const {
1474  if (isImplicit())
1475  return 0;
1476  Selector Sel = getSelector();
1477  if (Sel.isUnarySelector())
1478  return 1;
1479  return Sel.getNumArgs();
1480  }
1481 
1483  LBracLoc = R.getBegin();
1484  RBracLoc = R.getEnd();
1485  }
1486 
1487  LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocStart() const LLVM_READONLY,
1488  "Use getBeginLoc instead") {
1489  return getBeginLoc();
1490  }
1491  SourceLocation getBeginLoc() const LLVM_READONLY { return LBracLoc; }
1492  LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocEnd() const LLVM_READONLY,
1493  "Use getEndLoc instead") {
1494  return getEndLoc();
1495  }
1496  SourceLocation getEndLoc() const LLVM_READONLY { return RBracLoc; }
1497 
1498  // Iterators
1500 
1503 
1504  llvm::iterator_range<arg_iterator> arguments() {
1505  return llvm::make_range(arg_begin(), arg_end());
1506  }
1507 
1508  llvm::iterator_range<const_arg_iterator> arguments() const {
1509  return llvm::make_range(arg_begin(), arg_end());
1510  }
1511 
1512  arg_iterator arg_begin() { return reinterpret_cast<Stmt **>(getArgs()); }
1513 
1515  return reinterpret_cast<Stmt **>(getArgs() + NumArgs);
1516  }
1517 
1519  return reinterpret_cast<Stmt const * const*>(getArgs());
1520  }
1521 
1523  return reinterpret_cast<Stmt const * const*>(getArgs() + NumArgs);
1524  }
1525 
1526  static bool classof(const Stmt *T) {
1527  return T->getStmtClass() == ObjCMessageExprClass;
1528  }
1529 };
1530 
1531 /// ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC 'id' type.
1532 /// (similar in spirit to MemberExpr).
1533 class ObjCIsaExpr : public Expr {
1534  /// Base - the expression for the base object pointer.
1535  Stmt *Base;
1536 
1537  /// IsaMemberLoc - This is the location of the 'isa'.
1538  SourceLocation IsaMemberLoc;
1539 
1540  /// OpLoc - This is the location of '.' or '->'
1541  SourceLocation OpLoc;
1542 
1543  /// IsArrow - True if this is "X->F", false if this is "X.F".
1544  bool IsArrow;
1545 
1546 public:
1547  ObjCIsaExpr(Expr *base, bool isarrow, SourceLocation l, SourceLocation oploc,
1548  QualType ty)
1549  : Expr(ObjCIsaExprClass, ty, VK_LValue, OK_Ordinary,
1550  /*TypeDependent=*/false, base->isValueDependent(),
1551  base->isInstantiationDependent(),
1552  /*ContainsUnexpandedParameterPack=*/false),
1553  Base(base), IsaMemberLoc(l), OpLoc(oploc), IsArrow(isarrow) {}
1554 
1555  /// Build an empty expression.
1556  explicit ObjCIsaExpr(EmptyShell Empty) : Expr(ObjCIsaExprClass, Empty) {}
1557 
1558  void setBase(Expr *E) { Base = E; }
1559  Expr *getBase() const { return cast<Expr>(Base); }
1560 
1561  bool isArrow() const { return IsArrow; }
1562  void setArrow(bool A) { IsArrow = A; }
1563 
1564  /// getMemberLoc - Return the location of the "member", in X->F, it is the
1565  /// location of 'F'.
1566  SourceLocation getIsaMemberLoc() const { return IsaMemberLoc; }
1567  void setIsaMemberLoc(SourceLocation L) { IsaMemberLoc = L; }
1568 
1569  SourceLocation getOpLoc() const { return OpLoc; }
1570  void setOpLoc(SourceLocation L) { OpLoc = L; }
1571 
1572  LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocStart() const LLVM_READONLY,
1573  "Use getBeginLoc instead") {
1574  return getBeginLoc();
1575  }
1576  SourceLocation getBeginLoc() const LLVM_READONLY {
1577  return getBase()->getBeginLoc();
1578  }
1579 
1580  SourceLocation getBaseLocEnd() const LLVM_READONLY {
1581  return getBase()->getEndLoc();
1582  }
1583 
1584  LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocEnd() const LLVM_READONLY,
1585  "Use getEndLoc instead") {
1586  return getEndLoc();
1587  }
1588  SourceLocation getEndLoc() const LLVM_READONLY { return IsaMemberLoc; }
1589 
1590  SourceLocation getExprLoc() const LLVM_READONLY { return IsaMemberLoc; }
1591 
1592  // Iterators
1593  child_range children() { return child_range(&Base, &Base+1); }
1594 
1595  static bool classof(const Stmt *T) {
1596  return T->getStmtClass() == ObjCIsaExprClass;
1597  }
1598 };
1599 
1600 /// ObjCIndirectCopyRestoreExpr - Represents the passing of a function
1601 /// argument by indirect copy-restore in ARC. This is used to support
1602 /// passing indirect arguments with the wrong lifetime, e.g. when
1603 /// passing the address of a __strong local variable to an 'out'
1604 /// parameter. This expression kind is only valid in an "argument"
1605 /// position to some sort of call expression.
1606 ///
1607 /// The parameter must have type 'pointer to T', and the argument must
1608 /// have type 'pointer to U', where T and U agree except possibly in
1609 /// qualification. If the argument value is null, then a null pointer
1610 /// is passed; otherwise it points to an object A, and:
1611 /// 1. A temporary object B of type T is initialized, either by
1612 /// zero-initialization (used when initializing an 'out' parameter)
1613 /// or copy-initialization (used when initializing an 'inout'
1614 /// parameter).
1615 /// 2. The address of the temporary is passed to the function.
1616 /// 3. If the call completes normally, A is move-assigned from B.
1617 /// 4. Finally, A is destroyed immediately.
1618 ///
1619 /// Currently 'T' must be a retainable object lifetime and must be
1620 /// __autoreleasing; this qualifier is ignored when initializing
1621 /// the value.
1623  friend class ASTReader;
1624  friend class ASTStmtReader;
1625 
1626  Stmt *Operand;
1627 
1628  // unsigned ObjCIndirectCopyRestoreBits.ShouldCopy : 1;
1629 
1630  explicit ObjCIndirectCopyRestoreExpr(EmptyShell Empty)
1631  : Expr(ObjCIndirectCopyRestoreExprClass, Empty) {}
1632 
1633  void setShouldCopy(bool shouldCopy) {
1634  ObjCIndirectCopyRestoreExprBits.ShouldCopy = shouldCopy;
1635  }
1636 
1637 public:
1638  ObjCIndirectCopyRestoreExpr(Expr *operand, QualType type, bool shouldCopy)
1639  : Expr(ObjCIndirectCopyRestoreExprClass, type, VK_LValue, OK_Ordinary,
1640  operand->isTypeDependent(), operand->isValueDependent(),
1641  operand->isInstantiationDependent(),
1642  operand->containsUnexpandedParameterPack()),
1643  Operand(operand) {
1644  setShouldCopy(shouldCopy);
1645  }
1646 
1647  Expr *getSubExpr() { return cast<Expr>(Operand); }
1648  const Expr *getSubExpr() const { return cast<Expr>(Operand); }
1649 
1650  /// shouldCopy - True if we should do the 'copy' part of the
1651  /// copy-restore. If false, the temporary will be zero-initialized.
1652  bool shouldCopy() const { return ObjCIndirectCopyRestoreExprBits.ShouldCopy; }
1653 
1654  child_range children() { return child_range(&Operand, &Operand+1); }
1655 
1656  // Source locations are determined by the subexpression.
1657  LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocStart() const LLVM_READONLY,
1658  "Use getBeginLoc instead") {
1659  return getBeginLoc();
1660  }
1661  SourceLocation getBeginLoc() const LLVM_READONLY {
1662  return Operand->getBeginLoc();
1663  }
1664  LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocEnd() const LLVM_READONLY,
1665  "Use getEndLoc instead") {
1666  return getEndLoc();
1667  }
1668  SourceLocation getEndLoc() const LLVM_READONLY {
1669  return Operand->getEndLoc();
1670  }
1671 
1672  SourceLocation getExprLoc() const LLVM_READONLY {
1673  return getSubExpr()->getExprLoc();
1674  }
1675 
1676  static bool classof(const Stmt *s) {
1677  return s->getStmtClass() == ObjCIndirectCopyRestoreExprClass;
1678  }
1679 };
1680 
1681 /// An Objective-C "bridged" cast expression, which casts between
1682 /// Objective-C pointers and C pointers, transferring ownership in the process.
1683 ///
1684 /// \code
1685 /// NSString *str = (__bridge_transfer NSString *)CFCreateString();
1686 /// \endcode
1688  : public ExplicitCastExpr,
1689  private llvm::TrailingObjects<
1690  ObjCBridgedCastExpr, CastExpr::BasePathSizeTy, CXXBaseSpecifier *> {
1691  friend class ASTStmtReader;
1692  friend class ASTStmtWriter;
1693  friend class CastExpr;
1694  friend TrailingObjects;
1695 
1696  SourceLocation LParenLoc;
1697  SourceLocation BridgeKeywordLoc;
1698  unsigned Kind : 2;
1699 
1700  size_t numTrailingObjects(OverloadToken<CastExpr::BasePathSizeTy>) const {
1701  return path_empty() ? 0 : 1;
1702  }
1703 
1704 public:
1706  CastKind CK, SourceLocation BridgeKeywordLoc,
1707  TypeSourceInfo *TSInfo, Expr *Operand)
1708  : ExplicitCastExpr(ObjCBridgedCastExprClass, TSInfo->getType(), VK_RValue,
1709  CK, Operand, 0, TSInfo),
1710  LParenLoc(LParenLoc), BridgeKeywordLoc(BridgeKeywordLoc), Kind(Kind) {}
1711 
1712  /// Construct an empty Objective-C bridged cast.
1714  : ExplicitCastExpr(ObjCBridgedCastExprClass, Shell, 0) {}
1715 
1716  SourceLocation getLParenLoc() const { return LParenLoc; }
1717 
1718  /// Determine which kind of bridge is being performed via this cast.
1720  return static_cast<ObjCBridgeCastKind>(Kind);
1721  }
1722 
1723  /// Retrieve the kind of bridge being performed as a string.
1724  StringRef getBridgeKindName() const;
1725 
1726  /// The location of the bridge keyword.
1727  SourceLocation getBridgeKeywordLoc() const { return BridgeKeywordLoc; }
1728 
1729  LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocStart() const LLVM_READONLY,
1730  "Use getBeginLoc instead") {
1731  return getBeginLoc();
1732  }
1733  SourceLocation getBeginLoc() const LLVM_READONLY { return LParenLoc; }
1734 
1735  LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocEnd() const LLVM_READONLY,
1736  "Use getEndLoc instead") {
1737  return getEndLoc();
1738  }
1739  SourceLocation getEndLoc() const LLVM_READONLY {
1740  return getSubExpr()->getEndLoc();
1741  }
1742 
1743  static bool classof(const Stmt *T) {
1744  return T->getStmtClass() == ObjCBridgedCastExprClass;
1745  }
1746 };
1747 
1748 /// A runtime availability query.
1749 ///
1750 /// There are 2 ways to spell this node:
1751 /// \code
1752 /// @available(macos 10.10, ios 8, *); // Objective-C
1753 /// __builtin_available(macos 10.10, ios 8, *); // C, C++, and Objective-C
1754 /// \endcode
1755 ///
1756 /// Note that we only need to keep track of one \c VersionTuple here, which is
1757 /// the one that corresponds to the current deployment target. This is meant to
1758 /// be used in the condition of an \c if, but it is also usable as top level
1759 /// expressions.
1760 ///
1762  friend class ASTStmtReader;
1763 
1764  VersionTuple VersionToCheck;
1765  SourceLocation AtLoc, RParen;
1766 
1767 public:
1768  ObjCAvailabilityCheckExpr(VersionTuple VersionToCheck, SourceLocation AtLoc,
1769  SourceLocation RParen, QualType Ty)
1770  : Expr(ObjCAvailabilityCheckExprClass, Ty, VK_RValue, OK_Ordinary, false,
1771  false, false, false),
1772  VersionToCheck(VersionToCheck), AtLoc(AtLoc), RParen(RParen) {}
1773 
1775  : Expr(ObjCAvailabilityCheckExprClass, Shell) {}
1776 
1777  LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocStart() const LLVM_READONLY,
1778  "Use getBeginLoc instead") {
1779  return getBeginLoc();
1780  }
1781  SourceLocation getBeginLoc() const { return AtLoc; }
1782  LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocEnd() const LLVM_READONLY,
1783  "Use getEndLoc instead") {
1784  return getEndLoc();
1785  }
1786  SourceLocation getEndLoc() const { return RParen; }
1787  SourceRange getSourceRange() const { return {AtLoc, RParen}; }
1788 
1789  /// This may be '*', in which case this should fold to true.
1790  bool hasVersion() const { return !VersionToCheck.empty(); }
1791  VersionTuple getVersion() { return VersionToCheck; }
1792 
1795  }
1796 
1797  static bool classof(const Stmt *T) {
1798  return T->getStmtClass() == ObjCAvailabilityCheckExprClass;
1799  }
1800 };
1801 
1802 } // namespace clang
1803 
1804 #endif // LLVM_CLANG_AST_EXPROBJC_H
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Definition: ExprObjC.h:649
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
Definition: ExprObjC.h:1622
For nullary selectors, immediately before the end: "[foo release]" / "-(void)release;" Or with a spac...
LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocStart() const LLVM_READONLY, "Use getBeginLoc instead")
Definition: ExprObjC.h:1572
The receiver is an object instance.
Definition: ExprObjC.h:1143
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: ExprObjC.h:926
SourceLocation getOpLoc() const
Definition: ExprObjC.h:1569
ObjCDictionaryElement getKeyValueElement(unsigned Index) const
Definition: ExprObjC.h:376
child_range children()
Definition: ExprObjC.h:120
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: ExprObjC.h:1661
Smart pointer class that efficiently represents Objective-C method names.
A (possibly-)qualified type.
Definition: Type.h:640
static bool classof(const Stmt *T)
Definition: ExprObjC.h:418
void * getAsOpaquePtr() const
LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocStart() const LLVM_READONLY, "Use getBeginLoc instead")
Definition: ExprObjC.h:70
child_range children()
Definition: ExprObjC.h:833
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: ExprObjC.h:109
ObjCMethodDecl * getAtIndexMethodDecl() const
Definition: ExprObjC.h:942
Expr(StmtClass SC, QualType T, ExprValueKind VK, ExprObjectKind OK, bool TD, bool VD, bool ID, bool ContainsUnexpandedParameterPack)
Definition: Expr.h:110
SourceLocation EllipsisLoc
The location of the ellipsis, if this element is a pack expansion.
Definition: ExprObjC.h:311
LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocStart() const LLVM_READONLY, "Use getBeginLoc instead")
Definition: ExprObjC.h:160
bool isSuperReceiver() const
Definition: ExprObjC.h:811
SourceLocation getEndLoc() const LLVM_READONLY
Definition: ExprObjC.h:564
ObjCBridgeCastKind
The kind of bridging performed by the Objective-C bridge cast.
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
Definition: Dominators.h:30
ObjCProtocolDecl * getProtocol() const
Definition: ExprObjC.h:546
Stmt - This represents one statement.
Definition: Stmt.h:66
ObjCMethodDecl * setAtIndexMethodDecl() const
Definition: ExprObjC.h:946
void setArrow(bool A)
Definition: ExprObjC.h:1562
C Language Family Type Representation.
bool isSpecificPlaceholderType(unsigned K) const
Test for a specific placeholder type.
Definition: Type.h:6363
void setAtLoc(SourceLocation L)
Definition: ExprObjC.h:495
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: ExprObjC.h:559
void setRBracket(SourceLocation RB)
Definition: ExprObjC.h:920
ObjCMethodDecl * getImplicitPropertySetter() const
Definition: ExprObjC.h:752
StringRef P
const_arg_iterator arg_end() const
Definition: ExprObjC.h:184
ObjCStringLiteral(EmptyShell Empty)
Definition: ExprObjC.h:60
SourceLocation getExprLoc() const LLVM_READONLY
Definition: ExprObjC.h:1672
void setSuper(SourceLocation Loc, QualType T, bool IsInstanceSuper)
Definition: ExprObjC.h:1378
The base class of the type hierarchy.
Definition: Type.h:1413
llvm::iterator_range< child_iterator > child_range
Definition: Stmt.h:464
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Definition: ExprObjC.h:883
A container of type source information.
Definition: Decl.h:86
void setInstanceReceiver(Expr *rec)
Turn this message send into an instance message that computes the receiver object with the given expr...
Definition: ExprObjC.h:1307
ObjCBoxedExpr(Expr *E, QualType T, ObjCMethodDecl *method, SourceRange R)
Definition: ExprObjC.h:141
void setLocation(SourceLocation L)
Definition: ExprObjC.h:621
void setDelegateInitCall(bool isDelegate)
Definition: ExprObjC.h:1449
void setProtocol(ObjCProtocolDecl *P)
Definition: ExprObjC.h:547
SourceLocation getAtLoc() const
Definition: ExprObjC.h:67
ObjCPropertyRefExpr(ObjCPropertyDecl *PD, QualType t, ExprValueKind VK, ExprObjectKind OK, SourceLocation l, Expr *base)
Definition: ExprObjC.h:683
Selector getSetterSelector() const
Definition: ExprObjC.h:763
ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC &#39;id&#39; type.
Definition: ExprObjC.h:1533
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: ExprObjC.h:164
unsigned NumExpansionsPlusOne
If non-zero, the number of elements that this pack expansion will expand to (+1). ...
Definition: ExprObjC.h:315
SourceLocation getAtLoc() const
Definition: ExprObjC.h:493
void setOpLoc(SourceLocation L)
Definition: ExprObjC.h:1570
LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocStart() const LLVM_READONLY, "Use getBeginLoc instead")
Definition: ExprObjC.h:105
ObjCInterfaceDecl * getClassReceiver() const
Definition: ExprObjC.h:806
bool isArrow() const
Definition: ExprObjC.h:1561
ObjCMethodDecl - Represents an instance or class method declaration.
Definition: DeclObjC.h:139
SourceLocation getLeftLoc() const
Definition: ExprObjC.h:1451
ObjCBridgedCastExpr(EmptyShell Shell)
Construct an empty Objective-C bridged cast.
Definition: ExprObjC.h:1713
const StringLiteral * getString() const
Definition: ExprObjC.h:64
static bool classof(const Stmt *T)
Definition: ExprObjC.h:1595
child_range children()
Definition: ExprObjC.h:513
ObjCPropertyRefExpr(EmptyShell Empty)
Definition: ExprObjC.h:736
ReceiverKind
The kind of receiver this message is sending to.
Definition: ExprObjC.h:1138
const_arg_iterator arg_end() const
Definition: ExprObjC.h:1522
SourceRange getSourceRange() const LLVM_READONLY
Definition: ExprObjC.h:171
static bool classof(const Stmt *T)
Definition: ExprObjC.h:642
child_range children()
Definition: ExprObjC.h:640
ObjCPropertyDecl * getExplicitProperty() const
Definition: ExprObjC.h:742
void setAtLoc(SourceLocation L)
Definition: ExprObjC.h:68
SourceLocation getAtLoc() const
Definition: ExprObjC.h:550
TypeSourceInfo * getEncodedTypeSourceInfo() const
Definition: ExprObjC.h:449
SourceLocation getBaseLocEnd() const LLVM_READONLY
Definition: ExprObjC.h:1580
LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocStart() const LLVM_READONLY, "Use getBeginLoc instead")
Definition: ExprObjC.h:623
An element in an Objective-C dictionary literal.
Definition: ExprObjC.h:271
LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocEnd() const LLVM_READONLY, "Use getEndLoc instead")
Definition: ExprObjC.h:1782
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:153
Internal struct for storing Key/value pair.
Definition: ExprObjC.h:300
ObjCMethodFamily
A family of Objective-C methods.
void setKeyExpr(Stmt *S)
Definition: ExprObjC.h:940
bool isExplicitProperty() const
Definition: ExprObjC.h:740
ObjCPropertyRefExpr(ObjCMethodDecl *Getter, ObjCMethodDecl *Setter, QualType T, ExprValueKind VK, ExprObjectKind OK, SourceLocation IdLoc, Expr *Base)
Definition: ExprObjC.h:705
child_range children()
Definition: ExprObjC.h:259
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.cpp:280
StringLiteral * getString()
Definition: ExprObjC.h:63
ObjCEncodeExpr(EmptyShell Empty)
Definition: ExprObjC.h:440
ObjCIndirectCopyRestoreExprBitfields ObjCIndirectCopyRestoreExprBits
Definition: Stmt.h:310
ObjCSubscriptRefExpr(Expr *base, Expr *key, QualType T, ExprValueKind VK, ExprObjectKind OK, ObjCMethodDecl *getMethod, ObjCMethodDecl *setMethod, SourceLocation RB)
Definition: ExprObjC.h:900
bool isClassMessage() const
Determine whether this is an class message to either a specified class or to super.
Definition: ExprObjC.h:1289
ObjCBoxedExpr(EmptyShell Empty)
Definition: ExprObjC.h:148
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp, [NSNumber numberWithInt:42]];.
Definition: ExprObjC.h:195
ObjCSelectorExpr(QualType T, Selector selInfo, SourceLocation at, SourceLocation rp)
Definition: ExprObjC.h:482
SourceLocation getEndLoc() const LLVM_READONLY
Definition: ExprObjC.h:230
An r-value expression (a pr-value in the C++11 taxonomy) produces a temporary value.
Definition: Specifiers.h:110
Selector getSelector() const
Definition: ExprObjC.h:490
bool isUnarySelector() const
LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocEnd() const LLVM_READONLY, "Use getEndLoc instead")
Definition: ExprObjC.h:1735
SourceLocation getOpLoc() const
Definition: ExprObjC.h:636
bool isArrow() const
Definition: ExprObjC.h:615
const Expr * getElement(unsigned Index) const
Definition: ExprObjC.h:249
Expr * getKeyExpr() const
Definition: ExprObjC.h:939
ObjCBoolLiteralExpr(bool val, QualType Ty, SourceLocation l)
Definition: ExprObjC.h:95
SelectorLocationsKind
Whether all locations of the selector identifiers are in a "standard" position.
bool isMessagingSetter() const
True if the property reference will result in a message to the setter.
Definition: ExprObjC.h:779
Expr * getBaseExpr() const
Definition: ExprObjC.h:936
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
void setSelector(Selector S)
Definition: ExprObjC.h:491
void setLocation(SourceLocation L)
Definition: ExprObjC.h:117
SourceLocation getIsaMemberLoc() const
getMemberLoc - Return the location of the "member", in X->F, it is the location of &#39;F&#39;...
Definition: ExprObjC.h:1566
unsigned getNumSelectorLocs() const
Definition: ExprObjC.h:1473
bool isClassReceiver() const
Definition: ExprObjC.h:812
SourceLocation getEndLoc() const LLVM_READONLY
Definition: ExprObjC.h:169
const Expr *const * getElements() const
Retrieve elements of array of literals.
Definition: ExprObjC.h:237
void setString(StringLiteral *S)
Definition: ExprObjC.h:65
ObjCStringLiteral, used for Objective-C string literals i.e.
Definition: ExprObjC.h:51
static bool classof(const Stmt *T)
Definition: ExprObjC.h:1526
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
Definition: Type.h:5925
ObjCIsaExpr(Expr *base, bool isarrow, SourceLocation l, SourceLocation oploc, QualType ty)
Definition: ExprObjC.h:1547
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition: Expr.h:2935
Represents an Objective-C protocol declaration.
Definition: DeclObjC.h:2061
LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocEnd() const LLVM_READONLY, "Use getEndLoc instead")
Definition: ExprObjC.h:826
Expr * Key
The key for the dictionary element.
Definition: ExprObjC.h:273
ObjCMethodDecl * getArrayWithObjectsMethod() const
Definition: ExprObjC.h:254
LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocStart() const LLVM_READONLY, "Use getBeginLoc instead")
Definition: ExprObjC.h:1729
bool isTypeDependent() const
isTypeDependent - Determines whether this expression is type-dependent (C++ [temp.dep.expr]), which means that its type could change from one template instantiation to the next.
Definition: Expr.h:167
void * getAsOpaquePtr() const
Definition: Type.h:685
An ordinary object is located at an address in memory.
Definition: Specifiers.h:126
Represents an ObjC class declaration.
Definition: DeclObjC.h:1169
child_range children()
Definition: ExprObjC.h:954
SourceLocation getLocation() const
Definition: ExprObjC.h:116
LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocEnd() const LLVM_READONLY, "Use getEndLoc instead")
Definition: ExprObjC.h:1584
Iterator for iterating over Stmt * arrays that contain only Expr *.
Definition: Stmt.h:345
const Expr *const * getArgs() const
Definition: ExprObjC.h:1424
ObjCMethodDecl * getDictWithObjectsMethod() const
Definition: ExprObjC.h:390
ObjCBoolLiteralExpr(EmptyShell Empty)
Definition: ExprObjC.h:99
ObjCIvarDecl * getDecl()
Definition: ExprObjC.h:607
SourceLocation getEndLoc() const LLVM_READONLY
Definition: ExprObjC.h:830
Const iterator for iterating over Stmt * arrays that contain only Expr *.
Definition: Stmt.h:359
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: ExprObjC.h:1576
static bool classof(const Stmt *T)
Definition: ExprObjC.h:841
SourceLocation getRBracket() const
Definition: ExprObjC.h:919
LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocEnd() const LLVM_READONLY, "Use getEndLoc instead")
Definition: ExprObjC.h:110
SourceLocation getEndLoc() const LLVM_READONLY
Definition: ExprObjC.h:1739
LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocEnd() const LLVM_READONLY, "Use getEndLoc instead")
Definition: ExprObjC.h:1492
CastKind
CastKind - The kind of operation required for a conversion.
SourceRange getSourceRange() const LLVM_READONLY
Definition: ExprObjC.h:231
SourceLocation getRParenLoc() const
Definition: ExprObjC.h:494
SourceLocation getEndLoc() const LLVM_READONLY
Definition: ExprObjC.h:79
void setIsMessagingGetter(bool val=true)
Definition: ExprObjC.h:783
ObjCAvailabilityCheckExpr(VersionTuple VersionToCheck, SourceLocation AtLoc, SourceLocation RParen, QualType Ty)
Definition: ExprObjC.h:1768
LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocEnd() const LLVM_READONLY, "Use getEndLoc instead")
Definition: ExprObjC.h:560
ObjCEncodeExpr(QualType T, TypeSourceInfo *EncodedType, SourceLocation at, SourceLocation rp)
Definition: ExprObjC.h:431
ObjCMethodDecl * getBoxingMethod() const
Definition: ExprObjC.h:154
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: ExprObjC.h:1733
Expr - This represents one expression.
Definition: Expr.h:106
const Expr * getInstanceReceiver() const
Definition: ExprObjC.h:1301
ObjCIvarRefExpr(EmptyShell Empty)
Definition: ExprObjC.h:604
ObjCIsaExpr(EmptyShell Empty)
Build an empty expression.
Definition: ExprObjC.h:1556
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
Definition: Specifiers.h:107
LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocStart() const LLVM_READONLY, "Use getBeginLoc instead")
Definition: ExprObjC.h:221
SourceLocation getExprLoc() const LLVM_READONLY
Definition: ExprObjC.h:1590
SourceLocation getEndLoc() const
Definition: ExprObjC.h:1786
SourceLocation getStandardSelectorLoc(unsigned Index, Selector Sel, bool WithArgSpace, ArrayRef< Expr *> Args, SourceLocation EndLoc)
Get the "standard" location of a selector identifier, e.g: For nullary selectors, immediately before ...
SourceLocation getEndLoc() const LLVM_READONLY
Definition: ExprObjC.h:1496
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: ExprObjC.h:459
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
Definition: ExprObjC.h:320
ObjCSelectorExpr used for @selector in Objective-C.
Definition: ExprObjC.h:477
Expr ** getArgs()
Retrieve the arguments to this message, not including the receiver.
Definition: ExprObjC.h:1421
ObjCPropertyRefExpr(ObjCPropertyDecl *PD, QualType t, ExprValueKind VK, ExprObjectKind OK, SourceLocation l, SourceLocation sl, QualType st)
Definition: ExprObjC.h:694
static bool classof(const Stmt *T)
Definition: ExprObjC.h:958
ObjCStringLiteral(StringLiteral *SL, QualType T, SourceLocation L)
Definition: ExprObjC.h:56
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
QualType getType() const
Definition: Expr.h:128
LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocEnd() const LLVM_READONLY, "Use getEndLoc instead")
Definition: ExprObjC.h:165
LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocEnd() const LLVM_READONLY, "Use getEndLoc instead")
Definition: ExprObjC.h:503
LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocEnd() const LLVM_READONLY, "Use getEndLoc instead")
Definition: ExprObjC.h:399
Expr * getElement(unsigned Index)
getElement - Return the Element at the specified index.
Definition: ExprObjC.h:245
static OMPLinearClause * CreateEmpty(const ASTContext &C, unsigned NumVars)
Creates an empty clause with the place for NumVars variables.
Optional< unsigned > NumExpansions
The number of elements this pack expansion will expand to, if this is a pack expansion and is known...
Definition: ExprObjC.h:283
void setRParenLoc(SourceLocation L)
Definition: ExprObjC.h:553
QualType getEncodedType() const
Definition: ExprObjC.h:447
An expression that sends a message to the given Objective-C object or class.
Definition: ExprObjC.h:992
void setIsArrow(bool A)
Definition: ExprObjC.h:617
ObjCMethodDecl * getImplicitPropertyGetter() const
Definition: ExprObjC.h:747
SourceLocation getEnd() const
static bool classof(const Stmt *T)
Definition: ExprObjC.h:517
void setAtLoc(SourceLocation L)
Definition: ExprObjC.h:443
ReceiverKind getReceiverKind() const
Determine the kind of receiver that this message is being sent to.
Definition: ExprObjC.h:1276
StmtIterator child_iterator
Child Iterators: All subclasses must implement &#39;children&#39; to permit easy iteration over the substatem...
Definition: Stmt.h:461
unsigned getNumArgs() const
void setBase(Expr *base)
Definition: ExprObjC.h:613
void setRParenLoc(SourceLocation L)
Definition: ExprObjC.h:496
The result type of a method or function.
ObjCBridgeCastKind getBridgeKind() const
Determine which kind of bridge is being performed via this cast.
Definition: ExprObjC.h:1719
LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocEnd() const LLVM_READONLY, "Use getEndLoc instead")
Definition: ExprObjC.h:1664
const_arg_iterator arg_begin() const
Definition: ExprObjC.h:1518
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
Definition: opencl-c.h:82
ObjCIvarRefExpr(ObjCIvarDecl *d, QualType t, SourceLocation l, SourceLocation oploc, Expr *base, bool arrow=false, bool freeIvar=false)
Definition: ExprObjC.h:592
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
Definition: ExprObjC.h:1430
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.cpp:293
ObjCPropertyRefExpr(ObjCMethodDecl *Getter, ObjCMethodDecl *Setter, QualType T, ExprValueKind VK, ExprObjectKind OK, SourceLocation IdLoc, SourceLocation ReceiverLoc, ObjCInterfaceDecl *Receiver)
Definition: ExprObjC.h:726
SourceLocation getProtocolIdLoc() const
Definition: ExprObjC.h:549
ObjCSubscriptRefExpr(EmptyShell Empty)
Definition: ExprObjC.h:916
unsigned getNumArgs() const
Return the number of actual arguments in this message, not counting the receiver. ...
Definition: ExprObjC.h:1417
#define false
Definition: stdbool.h:33
ObjCIndirectCopyRestoreExpr(Expr *operand, QualType type, bool shouldCopy)
Definition: ExprObjC.h:1638
Kind
static bool classof(const Stmt *T)
Definition: ExprObjC.h:124
bool isImplicitProperty() const
Definition: ExprObjC.h:739
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on a template...
Definition: Expr.h:191
LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocStart() const LLVM_READONLY, "Use getBeginLoc instead")
Definition: ExprObjC.h:1777
Encodes a location in the source.
Selector getGetterSelector() const
Definition: ExprObjC.h:757
SourceLocation getEndLoc() const LLVM_READONLY
Definition: ExprObjC.h:403
ObjCSelectorExpr(EmptyShell Empty)
Definition: ExprObjC.h:487
SourceLocation getEndLoc() const LLVM_READONLY
Definition: ExprObjC.h:114
void setIsMessagingSetter(bool val=true)
Definition: ExprObjC.h:787
unsigned getNumElements() const
getNumElements - Return number of elements of objective-c dictionary literal.
Definition: ExprObjC.h:374
ObjCMethodFamily getMethodFamily() const
Definition: ExprObjC.h:1410
SourceRange getSourceRange() const LLVM_READONLY
Definition: ExprObjC.h:404
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: ExprObjC.h:502
static bool classof(const Stmt *T)
Definition: ExprObjC.h:188
ExprObjectKind
A further classification of the kind of object referenced by an l-value or x-value.
Definition: Specifiers.h:124
void setClassReceiver(TypeSourceInfo *TSInfo)
Definition: ExprObjC.h:1329
SourceLocation getRParenLoc() const
Definition: ExprObjC.h:444
SourceLocation getSuperLoc() const
Retrieve the location of the &#39;super&#39; keyword for a class or instance message to &#39;super&#39;, otherwise an invalid source location.
Definition: ExprObjC.h:1336
SourceLocation getAtLoc() const
Definition: ExprObjC.h:442
SourceLocation getEndLoc() const LLVM_READONLY
Definition: ExprObjC.h:1588
SourceRange getSourceRange() const
Definition: ExprObjC.h:1787
LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocStart() const LLVM_READONLY, "Use getBeginLoc instead")
Definition: ExprObjC.h:498
void setIsFreeIvar(bool A)
Definition: ExprObjC.h:618
ObjCProtocolExpr used for protocol expression in Objective-C.
Definition: ExprObjC.h:530
SourceLocation getSelectorLoc(unsigned Index) const
Definition: ExprObjC.h:1460
bool isValueDependent() const
isValueDependent - Determines whether this expression is value-dependent (C++ [temp.dep.constexpr]).
Definition: Expr.h:149
LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocEnd() const LLVM_READONLY, "Use getEndLoc instead")
Definition: ExprObjC.h:930
bool hasVersion() const
This may be &#39;*&#39;, in which case this should fold to true.
Definition: ExprObjC.h:1790
Represents one property declaration in an Objective-C interface.
Definition: DeclObjC.h:726
const ObjCIvarDecl * getDecl() const
Definition: ExprObjC.h:608
bool isImplicit() const
Indicates whether the message send was implicitly generated by the implementation.
Definition: ExprObjC.h:1272
bool isMessagingGetter() const
True if the property reference will result in a message to the getter.
Definition: ExprObjC.h:772
void setBaseExpr(Stmt *S)
Definition: ExprObjC.h:937
Expr * getSubExpr()
Definition: ExprObjC.h:151
void setEncodedTypeSourceInfo(TypeSourceInfo *EncType)
Definition: ExprObjC.h:451
const ObjCMethodDecl * getMethodDecl() const
Definition: ExprObjC.h:1391
LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocEnd() const LLVM_READONLY, "Use getEndLoc instead")
Definition: ExprObjC.h:75
ObjCBoxedExpr - used for generalized expression boxing.
Definition: ExprObjC.h:133
static QualType getFromOpaquePtr(const void *Ptr)
Definition: Type.h:687
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: ExprObjC.h:225
llvm::iterator_range< const_arg_iterator > arguments() const
Definition: ExprObjC.h:1508
A placeholder type used to construct an empty shell of a type, that will be filled in later (e...
Definition: Stmt.h:338
Expr * Value
The value of the dictionary element.
Definition: ExprObjC.h:276
Expr ** getElements()
Retrieve elements of array of literals.
Definition: ExprObjC.h:234
Defines various enumerations that describe declaration and type specifiers.
Expr * getInstanceReceiver()
Returns the object expression (receiver) for an instance message, or null for a message that is not a...
Definition: ExprObjC.h:1295
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: ExprObjC.h:821
An Objective-C "bridged" cast expression, which casts between Objective-C pointers and C pointers...
Definition: ExprObjC.h:1687
LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocStart() const LLVM_READONLY, "Use getBeginLoc instead")
Definition: ExprObjC.h:555
arg_iterator arg_end()
Definition: ExprObjC.h:1514
Dataflow Directional Tag Classes.
bool isValid() const
Return true if this is a valid SourceLocation object.
SourceLocation getLocation() const
Definition: ExprObjC.h:798
Reads an AST files chain containing the contents of a translation unit.
Definition: ASTReader.h:354
void setAtLoc(SourceLocation L)
Definition: ExprObjC.h:552
QualType getSuperType() const
Retrieve the type referred to by &#39;super&#39;.
Definition: ExprObjC.h:1371
SourceLocation EllipsisLoc
The location of the ellipsis, if this is a pack expansion.
Definition: ExprObjC.h:279
void setDecl(ObjCIvarDecl *d)
Definition: ExprObjC.h:609
SourceLocation getEndLoc() const LLVM_READONLY
Definition: ExprObjC.h:634
A runtime availability query.
Definition: ExprObjC.h:1761
LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocEnd() const LLVM_READONLY, "Use getEndLoc instead")
Definition: ExprObjC.h:226
static bool classof(const Stmt *T)
Definition: ExprObjC.h:571
StmtClass getStmtClass() const
Definition: Stmt.h:391
child_range children()
Definition: ExprObjC.h:176
static bool classof(const Stmt *T)
Definition: ExprObjC.h:1743
ExplicitCastExpr - An explicit cast written in the source code.
Definition: Expr.h:3153
void setSelector(Selector S)
Definition: ExprObjC.h:1386
void setMethodDecl(ObjCMethodDecl *MD)
Definition: ExprObjC.h:1405
SourceLocation getLParenLoc() const
Definition: ExprObjC.h:1716
SourceLocation getRParenLoc() const
Definition: ExprObjC.h:551
child_range children()
Definition: ExprObjC.h:82
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: ExprObjC.h:398
QualType getClassReceiver() const
Returns the type of a class message send, or NULL if the message is not a class message.
Definition: ExprObjC.h:1314
const_arg_iterator arg_begin() const
Definition: ExprObjC.h:180
SourceLocation getEndLoc() const LLVM_READONLY
Definition: ExprObjC.h:507
static bool classof(const Stmt *T)
Definition: ExprObjC.h:471
arg_iterator arg_begin()
Definition: ExprObjC.h:1512
SourceLocation getAtLoc() const
Definition: ExprObjC.h:158
Expr * getBase() const
Definition: ExprObjC.h:1559
SourceLocation getBeginLoc() const
Definition: ExprObjC.h:1781
ObjCPropertyRefExpr(ObjCMethodDecl *Getter, ObjCMethodDecl *Setter, QualType T, ExprValueKind VK, ExprObjectKind OK, SourceLocation IdLoc, SourceLocation SuperLoc, QualType SuperTy)
Definition: ExprObjC.h:716
unsigned getNumElements() const
getNumElements - Return number of elements of objective-c array literal.
Definition: ExprObjC.h:242
child_range children()
Definition: ExprObjC.h:467
LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocStart() const LLVM_READONLY, "Use getBeginLoc instead")
Definition: ExprObjC.h:394
ObjCEncodeExpr, used for @encode in Objective-C.
Definition: ExprObjC.h:426
friend TrailingObjects
Definition: OpenMPClause.h:93
static bool classof(const Stmt *s)
Definition: ExprObjC.h:1676
SourceLocation getLocation() const
Definition: ExprObjC.h:620
ObjCAvailabilityCheckExpr(EmptyShell Shell)
Definition: ExprObjC.h:1774
ObjCBridgedCastExpr(SourceLocation LParenLoc, ObjCBridgeCastKind Kind, CastKind CK, SourceLocation BridgeKeywordLoc, TypeSourceInfo *TSInfo, Expr *Operand)
Definition: ExprObjC.h:1705
bool isDelegateInitCall() const
isDelegateInitCall - Answers whether this message send has been tagged as a "delegate init call"...
Definition: ExprObjC.h:1448
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
Definition: ExprObjC.h:510
child_range children()
Definition: ExprObjC.h:1593
const Expr * getBase() const
Definition: ExprObjC.h:611
ObjCProtocolExpr(EmptyShell Empty)
Definition: ExprObjC.h:543
void setRParenLoc(SourceLocation L)
Definition: ExprObjC.h:445
A bitfield object is a bitfield on a C or C++ record.
Definition: Specifiers.h:129
ObjCIvarRefExpr - A reference to an ObjC instance variable.
Definition: ExprObjC.h:577
SourceLocation getEndLoc() const LLVM_READONLY
Definition: ExprObjC.h:934
bool isFreeIvar() const
Definition: ExprObjC.h:616
QualType getSuperReceiverType() const
Definition: ExprObjC.h:802
LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocStart() const LLVM_READONLY, "Use getBeginLoc instead")
Definition: ExprObjC.h:455
Defines the clang::SourceLocation class and associated facilities.
llvm::iterator_range< arg_iterator > arguments()
Definition: ExprObjC.h:1504
void setSourceRange(SourceRange R)
Definition: ExprObjC.h:1482
SourceLocation getSelectorStartLoc() const
Definition: ExprObjC.h:1454
SourceLocation getEndLoc() const LLVM_READONLY
Definition: ExprObjC.h:1668
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: ExprObjC.h:1491
bool isPackExpansion() const
Determines whether this dictionary element is a pack expansion.
Definition: ExprObjC.h:286
ObjCIvarDecl - Represents an ObjC instance variable.
Definition: DeclObjC.h:1942
void setIsaMemberLoc(SourceLocation L)
Definition: ExprObjC.h:1567
bool containsUnexpandedParameterPack() const
Whether this expression contains an unexpanded parameter pack (for C++11 variadic templates)...
Definition: Expr.h:214
LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocEnd() const LLVM_READONLY, "Use getEndLoc instead")
Definition: ExprObjC.h:460
bool shouldCopy() const
shouldCopy - True if we should do the &#39;copy&#39; part of the copy-restore.
Definition: ExprObjC.h:1652
LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocStart() const LLVM_READONLY, "Use getBeginLoc instead")
Definition: ExprObjC.h:1657
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1633
void setOpLoc(SourceLocation L)
Definition: ExprObjC.h:637
const Expr * getArg(unsigned Arg) const
Definition: ExprObjC.h:1434
Internal struct to describes an element that is a pack expansion, used if any of the elements in the ...
Definition: ExprObjC.h:308
static bool classof(const Stmt *T)
Definition: ExprObjC.h:84
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
Definition: ExprObjC.h:90
bool isObjectReceiver() const
Definition: ExprObjC.h:810
LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocStart() const LLVM_READONLY, "Use getBeginLoc instead")
Definition: ExprObjC.h:922
SourceLocation getReceiverLocation() const
Definition: ExprObjC.h:800
LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocStart() const LLVM_READONLY, "Use getBeginLoc instead")
Definition: ExprObjC.h:1487
SourceLocation getBridgeKeywordLoc() const
The location of the bridge keyword.
Definition: ExprObjC.h:1727
ObjCProtocolExpr(QualType T, ObjCProtocolDecl *protocol, SourceLocation at, SourceLocation protoLoc, SourceLocation rp)
Definition: ExprObjC.h:538
const Expr * getSubExpr() const
Definition: ExprObjC.h:1648
bool isArraySubscriptRefExpr() const
Definition: ExprObjC.h:950
#define true
Definition: stdbool.h:32
static bool classof(const Stmt *T)
Definition: ExprObjC.h:264
An l-value expression is a reference to an object with independent storage.
Definition: Specifiers.h:114
const Expr * getBase() const
Definition: ExprObjC.h:791
A trivial tuple used to represent a source range.
ObjCMethodDecl * getMethodDecl()
Definition: ExprObjC.h:1398
SourceLocation getEndLoc() const LLVM_READONLY
Definition: ExprObjC.h:464
SourceLocation getRightLoc() const
Definition: ExprObjC.h:1452
The receiver is a superclass.
Definition: ExprObjC.h:1146
bool isInstanceMessage() const
Determine whether this is an instance message to either a computed object or to super.
Definition: ExprObjC.h:1283
SourceLocation getBegin() const
static bool classof(const Stmt *T)
Definition: ExprObjC.h:1797
void setArg(unsigned Arg, Expr *ArgExpr)
setArg - Set the specified argument.
Definition: ExprObjC.h:1440
void setBase(Expr *E)
Definition: ExprObjC.h:1558
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: ExprObjC.h:627
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: ExprObjC.h:74
const Expr * getSubExpr() const
Definition: ExprObjC.h:152
LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocStart() const LLVM_READONLY, "Use getBeginLoc instead")
Definition: ExprObjC.h:817
QualType getType() const
Return the type wrapped by this type source info.
Definition: Decl.h:97
static OMPLinearClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr *> VL, ArrayRef< Expr *> PL, ArrayRef< Expr *> IL, Expr *Step, Expr *CalcStep, Stmt *PreInit, Expr *PostUpdate)
Creates clause with a list of variables VL and a linear step Step.
LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocEnd() const LLVM_READONLY, "Use getEndLoc instead")
Definition: ExprObjC.h:630
child_range children()
Definition: ExprObjC.h:567
TypeSourceInfo * getClassReceiverTypeInfo() const
Returns a type-source information of a class message send, or nullptr if the message is not a class m...
Definition: ExprObjC.h:1323