| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | #ifndef LLVM_CLANG_AST_EXPROBJC_H |
| 14 | #define LLVM_CLANG_AST_EXPROBJC_H |
| 15 | |
| 16 | #include "clang/AST/Decl.h" |
| 17 | #include "clang/AST/DeclObjC.h" |
| 18 | #include "clang/AST/Expr.h" |
| 19 | #include "clang/AST/OperationKinds.h" |
| 20 | #include "clang/AST/SelectorLocationsKind.h" |
| 21 | #include "clang/AST/Stmt.h" |
| 22 | #include "clang/AST/Type.h" |
| 23 | #include "clang/Basic/IdentifierTable.h" |
| 24 | #include "clang/Basic/LLVM.h" |
| 25 | #include "clang/Basic/SourceLocation.h" |
| 26 | #include "clang/Basic/Specifiers.h" |
| 27 | #include "llvm/ADT/ArrayRef.h" |
| 28 | #include "llvm/ADT/None.h" |
| 29 | #include "llvm/ADT/Optional.h" |
| 30 | #include "llvm/ADT/PointerIntPair.h" |
| 31 | #include "llvm/ADT/PointerUnion.h" |
| 32 | #include "llvm/ADT/StringRef.h" |
| 33 | #include "llvm/ADT/iterator_range.h" |
| 34 | #include "llvm/Support/Casting.h" |
| 35 | #include "llvm/Support/Compiler.h" |
| 36 | #include "llvm/Support/TrailingObjects.h" |
| 37 | #include "llvm/Support/VersionTuple.h" |
| 38 | #include "llvm/Support/type_traits.h" |
| 39 | #include <cassert> |
| 40 | #include <cstddef> |
| 41 | #include <cstdint> |
| 42 | |
| 43 | namespace clang { |
| 44 | |
| 45 | class ASTContext; |
| 46 | class CXXBaseSpecifier; |
| 47 | |
| 48 | |
| 49 | |
| 50 | class ObjCStringLiteral : public Expr { |
| 51 | Stmt *String; |
| 52 | SourceLocation AtLoc; |
| 53 | |
| 54 | public: |
| 55 | ObjCStringLiteral(StringLiteral *SL, QualType T, SourceLocation L) |
| 56 | : Expr(ObjCStringLiteralClass, T, VK_RValue, OK_Ordinary, false, false, |
| 57 | false, false), |
| 58 | String(SL), AtLoc(L) {} |
| 59 | explicit ObjCStringLiteral(EmptyShell Empty) |
| 60 | : Expr(ObjCStringLiteralClass, Empty) {} |
| 61 | |
| 62 | StringLiteral *getString() { return cast<StringLiteral>(String); } |
| 63 | const StringLiteral *getString() const { return cast<StringLiteral>(String); } |
| 64 | void setString(StringLiteral *S) { String = S; } |
| 65 | |
| 66 | SourceLocation getAtLoc() const { return AtLoc; } |
| 67 | void setAtLoc(SourceLocation L) { AtLoc = L; } |
| 68 | |
| 69 | SourceLocation getBeginLoc() const LLVM_READONLY { return AtLoc; } |
| 70 | SourceLocation getEndLoc() const LLVM_READONLY { return String->getEndLoc(); } |
| 71 | |
| 72 | |
| 73 | child_range children() { return child_range(&String, &String+1); } |
| 74 | |
| 75 | static bool classof(const Stmt *T) { |
| 76 | return T->getStmtClass() == ObjCStringLiteralClass; |
| 77 | } |
| 78 | }; |
| 79 | |
| 80 | |
| 81 | class ObjCBoolLiteralExpr : public Expr { |
| 82 | bool Value; |
| 83 | SourceLocation Loc; |
| 84 | |
| 85 | public: |
| 86 | ObjCBoolLiteralExpr(bool val, QualType Ty, SourceLocation l) |
| 87 | : Expr(ObjCBoolLiteralExprClass, Ty, VK_RValue, OK_Ordinary, false, false, |
| 88 | false, false), |
| 89 | Value(val), Loc(l) {} |
| 90 | explicit ObjCBoolLiteralExpr(EmptyShell Empty) |
| 91 | : Expr(ObjCBoolLiteralExprClass, Empty) {} |
| 92 | |
| 93 | bool getValue() const { return Value; } |
| 94 | void setValue(bool V) { Value = V; } |
| 95 | |
| 96 | SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; } |
| 97 | SourceLocation getEndLoc() const LLVM_READONLY { return Loc; } |
| 98 | |
| 99 | SourceLocation getLocation() const { return Loc; } |
| 100 | void setLocation(SourceLocation L) { Loc = L; } |
| 101 | |
| 102 | |
| 103 | child_range children() { |
| 104 | return child_range(child_iterator(), child_iterator()); |
| 105 | } |
| 106 | |
| 107 | static bool classof(const Stmt *T) { |
| 108 | return T->getStmtClass() == ObjCBoolLiteralExprClass; |
| 109 | } |
| 110 | }; |
| 111 | |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | class ObjCBoxedExpr : public Expr { |
| 117 | Stmt *SubExpr; |
| 118 | ObjCMethodDecl *BoxingMethod; |
| 119 | SourceRange Range; |
| 120 | |
| 121 | public: |
| 122 | friend class ASTStmtReader; |
| 123 | |
| 124 | ObjCBoxedExpr(Expr *E, QualType T, ObjCMethodDecl *method, |
| 125 | SourceRange R) |
| 126 | : Expr(ObjCBoxedExprClass, T, VK_RValue, OK_Ordinary, |
| 127 | E->isTypeDependent(), E->isValueDependent(), |
| 128 | E->isInstantiationDependent(), |
| 129 | E->containsUnexpandedParameterPack()), |
| 130 | SubExpr(E), BoxingMethod(method), Range(R) {} |
| 131 | explicit ObjCBoxedExpr(EmptyShell Empty) |
| 132 | : Expr(ObjCBoxedExprClass, Empty) {} |
| 133 | |
| 134 | Expr *getSubExpr() { return cast<Expr>(SubExpr); } |
| 135 | const Expr *getSubExpr() const { return cast<Expr>(SubExpr); } |
| 136 | |
| 137 | ObjCMethodDecl *getBoxingMethod() const { |
| 138 | return BoxingMethod; |
| 139 | } |
| 140 | |
| 141 | |
| 142 | |
| 143 | bool isExpressibleAsConstantInitializer() const { |
| 144 | return !BoxingMethod && SubExpr; |
| 145 | } |
| 146 | |
| 147 | SourceLocation getAtLoc() const { return Range.getBegin(); } |
| 148 | |
| 149 | SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); } |
| 150 | SourceLocation getEndLoc() const LLVM_READONLY { return Range.getEnd(); } |
| 151 | |
| 152 | SourceRange getSourceRange() const LLVM_READONLY { |
| 153 | return Range; |
| 154 | } |
| 155 | |
| 156 | |
| 157 | child_range children() { return child_range(&SubExpr, &SubExpr+1); } |
| 158 | |
| 159 | using const_arg_iterator = ConstExprIterator; |
| 160 | |
| 161 | const_arg_iterator arg_begin() const { |
| 162 | return reinterpret_cast<Stmt const * const*>(&SubExpr); |
| 163 | } |
| 164 | |
| 165 | const_arg_iterator arg_end() const { |
| 166 | return reinterpret_cast<Stmt const * const*>(&SubExpr + 1); |
| 167 | } |
| 168 | |
| 169 | static bool classof(const Stmt *T) { |
| 170 | return T->getStmtClass() == ObjCBoxedExprClass; |
| 171 | } |
| 172 | }; |
| 173 | |
| 174 | |
| 175 | |
| 176 | class ObjCArrayLiteral final |
| 177 | : public Expr, |
| 178 | private llvm::TrailingObjects<ObjCArrayLiteral, Expr *> { |
| 179 | unsigned NumElements; |
| 180 | SourceRange Range; |
| 181 | ObjCMethodDecl *ArrayWithObjectsMethod; |
| 182 | |
| 183 | ObjCArrayLiteral(ArrayRef<Expr *> Elements, |
| 184 | QualType T, ObjCMethodDecl * Method, |
| 185 | SourceRange SR); |
| 186 | |
| 187 | explicit ObjCArrayLiteral(EmptyShell Empty, unsigned NumElements) |
| 188 | : Expr(ObjCArrayLiteralClass, Empty), NumElements(NumElements) {} |
| 189 | |
| 190 | public: |
| 191 | friend class ASTStmtReader; |
| 192 | friend TrailingObjects; |
| 193 | |
| 194 | static ObjCArrayLiteral *Create(const ASTContext &C, |
| 195 | ArrayRef<Expr *> Elements, |
| 196 | QualType T, ObjCMethodDecl * Method, |
| 197 | SourceRange SR); |
| 198 | |
| 199 | static ObjCArrayLiteral *CreateEmpty(const ASTContext &C, |
| 200 | unsigned NumElements); |
| 201 | |
| 202 | SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); } |
| 203 | SourceLocation getEndLoc() const LLVM_READONLY { return Range.getEnd(); } |
| 204 | SourceRange getSourceRange() const LLVM_READONLY { return Range; } |
| 205 | |
| 206 | |
| 207 | Expr **getElements() { return getTrailingObjects<Expr *>(); } |
| 208 | |
| 209 | |
| 210 | const Expr * const *getElements() const { |
| 211 | return getTrailingObjects<Expr *>(); |
| 212 | } |
| 213 | |
| 214 | |
| 215 | unsigned getNumElements() const { return NumElements; } |
| 216 | |
| 217 | |
| 218 | Expr *getElement(unsigned Index) { |
| 219 | (0) . __assert_fail ("(Index < NumElements) && \"Arg access out of range!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprObjC.h", 219, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert((Index < NumElements) && "Arg access out of range!"); |
| 220 | return getElements()[Index]; |
| 221 | } |
| 222 | const Expr *getElement(unsigned Index) const { |
| 223 | (0) . __assert_fail ("(Index < NumElements) && \"Arg access out of range!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprObjC.h", 223, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert((Index < NumElements) && "Arg access out of range!"); |
| 224 | return getElements()[Index]; |
| 225 | } |
| 226 | |
| 227 | ObjCMethodDecl *getArrayWithObjectsMethod() const { |
| 228 | return ArrayWithObjectsMethod; |
| 229 | } |
| 230 | |
| 231 | |
| 232 | child_range children() { |
| 233 | return child_range(reinterpret_cast<Stmt **>(getElements()), |
| 234 | reinterpret_cast<Stmt **>(getElements()) + NumElements); |
| 235 | } |
| 236 | |
| 237 | static bool classof(const Stmt *T) { |
| 238 | return T->getStmtClass() == ObjCArrayLiteralClass; |
| 239 | } |
| 240 | }; |
| 241 | |
| 242 | |
| 243 | |
| 244 | struct ObjCDictionaryElement { |
| 245 | |
| 246 | Expr *Key; |
| 247 | |
| 248 | |
| 249 | Expr *Value; |
| 250 | |
| 251 | |
| 252 | SourceLocation EllipsisLoc; |
| 253 | |
| 254 | |
| 255 | |
| 256 | Optional<unsigned> NumExpansions; |
| 257 | |
| 258 | |
| 259 | bool isPackExpansion() const { return EllipsisLoc.isValid(); } |
| 260 | }; |
| 261 | |
| 262 | } |
| 263 | |
| 264 | namespace clang { |
| 265 | |
| 266 | |
| 267 | struct ObjCDictionaryLiteral_KeyValuePair { |
| 268 | Expr *Key; |
| 269 | Expr *Value; |
| 270 | }; |
| 271 | |
| 272 | |
| 273 | |
| 274 | |
| 275 | struct ObjCDictionaryLiteral_ExpansionData { |
| 276 | |
| 277 | |
| 278 | SourceLocation EllipsisLoc; |
| 279 | |
| 280 | |
| 281 | |
| 282 | unsigned NumExpansionsPlusOne; |
| 283 | }; |
| 284 | |
| 285 | |
| 286 | |
| 287 | class ObjCDictionaryLiteral final |
| 288 | : public Expr, |
| 289 | private llvm::TrailingObjects<ObjCDictionaryLiteral, |
| 290 | ObjCDictionaryLiteral_KeyValuePair, |
| 291 | ObjCDictionaryLiteral_ExpansionData> { |
| 292 | |
| 293 | unsigned NumElements : 31; |
| 294 | |
| 295 | |
| 296 | |
| 297 | |
| 298 | |
| 299 | |
| 300 | |
| 301 | |
| 302 | unsigned HasPackExpansions : 1; |
| 303 | |
| 304 | SourceRange Range; |
| 305 | ObjCMethodDecl *DictWithObjectsMethod; |
| 306 | |
| 307 | using KeyValuePair = ObjCDictionaryLiteral_KeyValuePair; |
| 308 | using ExpansionData = ObjCDictionaryLiteral_ExpansionData; |
| 309 | |
| 310 | ObjCDictionaryLiteral(ArrayRef<ObjCDictionaryElement> VK, |
| 311 | bool HasPackExpansions, |
| 312 | QualType T, ObjCMethodDecl *method, |
| 313 | SourceRange SR); |
| 314 | |
| 315 | explicit ObjCDictionaryLiteral(EmptyShell Empty, unsigned NumElements, |
| 316 | bool HasPackExpansions) |
| 317 | : Expr(ObjCDictionaryLiteralClass, Empty), NumElements(NumElements), |
| 318 | HasPackExpansions(HasPackExpansions) {} |
| 319 | |
| 320 | size_t numTrailingObjects(OverloadToken<KeyValuePair>) const { |
| 321 | return NumElements; |
| 322 | } |
| 323 | |
| 324 | public: |
| 325 | friend class ASTStmtReader; |
| 326 | friend class ASTStmtWriter; |
| 327 | friend TrailingObjects; |
| 328 | |
| 329 | static ObjCDictionaryLiteral *Create(const ASTContext &C, |
| 330 | ArrayRef<ObjCDictionaryElement> VK, |
| 331 | bool HasPackExpansions, |
| 332 | QualType T, ObjCMethodDecl *method, |
| 333 | SourceRange SR); |
| 334 | |
| 335 | static ObjCDictionaryLiteral *CreateEmpty(const ASTContext &C, |
| 336 | unsigned NumElements, |
| 337 | bool HasPackExpansions); |
| 338 | |
| 339 | |
| 340 | |
| 341 | unsigned getNumElements() const { return NumElements; } |
| 342 | |
| 343 | ObjCDictionaryElement getKeyValueElement(unsigned Index) const { |
| 344 | (0) . __assert_fail ("(Index < NumElements) && \"Arg access out of range!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprObjC.h", 344, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert((Index < NumElements) && "Arg access out of range!"); |
| 345 | const KeyValuePair &KV = getTrailingObjects<KeyValuePair>()[Index]; |
| 346 | ObjCDictionaryElement Result = { KV.Key, KV.Value, SourceLocation(), None }; |
| 347 | if (HasPackExpansions) { |
| 348 | const ExpansionData &Expansion = |
| 349 | getTrailingObjects<ExpansionData>()[Index]; |
| 350 | Result.EllipsisLoc = Expansion.EllipsisLoc; |
| 351 | if (Expansion.NumExpansionsPlusOne > 0) |
| 352 | Result.NumExpansions = Expansion.NumExpansionsPlusOne - 1; |
| 353 | } |
| 354 | return Result; |
| 355 | } |
| 356 | |
| 357 | ObjCMethodDecl *getDictWithObjectsMethod() const { |
| 358 | return DictWithObjectsMethod; |
| 359 | } |
| 360 | |
| 361 | SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); } |
| 362 | SourceLocation getEndLoc() const LLVM_READONLY { return Range.getEnd(); } |
| 363 | SourceRange getSourceRange() const LLVM_READONLY { return Range; } |
| 364 | |
| 365 | |
| 366 | child_range children() { |
| 367 | |
| 368 | |
| 369 | static_assert(sizeof(KeyValuePair) == sizeof(Stmt *) * 2, |
| 370 | "KeyValuePair is expected size"); |
| 371 | return child_range( |
| 372 | reinterpret_cast<Stmt **>(getTrailingObjects<KeyValuePair>()), |
| 373 | reinterpret_cast<Stmt **>(getTrailingObjects<KeyValuePair>()) + |
| 374 | NumElements * 2); |
| 375 | } |
| 376 | |
| 377 | static bool classof(const Stmt *T) { |
| 378 | return T->getStmtClass() == ObjCDictionaryLiteralClass; |
| 379 | } |
| 380 | }; |
| 381 | |
| 382 | |
| 383 | |
| 384 | |
| 385 | class ObjCEncodeExpr : public Expr { |
| 386 | TypeSourceInfo *EncodedType; |
| 387 | SourceLocation AtLoc, RParenLoc; |
| 388 | |
| 389 | public: |
| 390 | ObjCEncodeExpr(QualType T, TypeSourceInfo *EncodedType, |
| 391 | SourceLocation at, SourceLocation rp) |
| 392 | : Expr(ObjCEncodeExprClass, T, VK_LValue, OK_Ordinary, |
| 393 | EncodedType->getType()->isDependentType(), |
| 394 | EncodedType->getType()->isDependentType(), |
| 395 | EncodedType->getType()->isInstantiationDependentType(), |
| 396 | EncodedType->getType()->containsUnexpandedParameterPack()), |
| 397 | EncodedType(EncodedType), AtLoc(at), RParenLoc(rp) {} |
| 398 | |
| 399 | explicit ObjCEncodeExpr(EmptyShell Empty) : Expr(ObjCEncodeExprClass, Empty){} |
| 400 | |
| 401 | SourceLocation getAtLoc() const { return AtLoc; } |
| 402 | void setAtLoc(SourceLocation L) { AtLoc = L; } |
| 403 | SourceLocation getRParenLoc() const { return RParenLoc; } |
| 404 | void setRParenLoc(SourceLocation L) { RParenLoc = L; } |
| 405 | |
| 406 | QualType getEncodedType() const { return EncodedType->getType(); } |
| 407 | |
| 408 | TypeSourceInfo *getEncodedTypeSourceInfo() const { return EncodedType; } |
| 409 | |
| 410 | void setEncodedTypeSourceInfo(TypeSourceInfo *EncType) { |
| 411 | EncodedType = EncType; |
| 412 | } |
| 413 | |
| 414 | SourceLocation getBeginLoc() const LLVM_READONLY { return AtLoc; } |
| 415 | SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; } |
| 416 | |
| 417 | |
| 418 | child_range children() { |
| 419 | return child_range(child_iterator(), child_iterator()); |
| 420 | } |
| 421 | |
| 422 | static bool classof(const Stmt *T) { |
| 423 | return T->getStmtClass() == ObjCEncodeExprClass; |
| 424 | } |
| 425 | }; |
| 426 | |
| 427 | |
| 428 | class ObjCSelectorExpr : public Expr { |
| 429 | Selector SelName; |
| 430 | SourceLocation AtLoc, RParenLoc; |
| 431 | |
| 432 | public: |
| 433 | ObjCSelectorExpr(QualType T, Selector selInfo, |
| 434 | SourceLocation at, SourceLocation rp) |
| 435 | : Expr(ObjCSelectorExprClass, T, VK_RValue, OK_Ordinary, false, false, |
| 436 | false, false), |
| 437 | SelName(selInfo), AtLoc(at), RParenLoc(rp) {} |
| 438 | explicit ObjCSelectorExpr(EmptyShell Empty) |
| 439 | : Expr(ObjCSelectorExprClass, Empty) {} |
| 440 | |
| 441 | Selector getSelector() const { return SelName; } |
| 442 | void setSelector(Selector S) { SelName = S; } |
| 443 | |
| 444 | SourceLocation getAtLoc() const { return AtLoc; } |
| 445 | SourceLocation getRParenLoc() const { return RParenLoc; } |
| 446 | void setAtLoc(SourceLocation L) { AtLoc = L; } |
| 447 | void setRParenLoc(SourceLocation L) { RParenLoc = L; } |
| 448 | |
| 449 | SourceLocation getBeginLoc() const LLVM_READONLY { return AtLoc; } |
| 450 | SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; } |
| 451 | |
| 452 | |
| 453 | unsigned getNumArgs() const { return SelName.getNumArgs(); } |
| 454 | |
| 455 | |
| 456 | child_range children() { |
| 457 | return child_range(child_iterator(), child_iterator()); |
| 458 | } |
| 459 | |
| 460 | static bool classof(const Stmt *T) { |
| 461 | return T->getStmtClass() == ObjCSelectorExprClass; |
| 462 | } |
| 463 | }; |
| 464 | |
| 465 | |
| 466 | |
| 467 | |
| 468 | |
| 469 | |
| 470 | |
| 471 | |
| 472 | |
| 473 | class ObjCProtocolExpr : public Expr { |
| 474 | ObjCProtocolDecl *TheProtocol; |
| 475 | SourceLocation AtLoc, ProtoLoc, RParenLoc; |
| 476 | |
| 477 | public: |
| 478 | friend class ASTStmtReader; |
| 479 | friend class ASTStmtWriter; |
| 480 | |
| 481 | ObjCProtocolExpr(QualType T, ObjCProtocolDecl *protocol, |
| 482 | SourceLocation at, SourceLocation protoLoc, SourceLocation rp) |
| 483 | : Expr(ObjCProtocolExprClass, T, VK_RValue, OK_Ordinary, false, false, |
| 484 | false, false), |
| 485 | TheProtocol(protocol), AtLoc(at), ProtoLoc(protoLoc), RParenLoc(rp) {} |
| 486 | explicit ObjCProtocolExpr(EmptyShell Empty) |
| 487 | : Expr(ObjCProtocolExprClass, Empty) {} |
| 488 | |
| 489 | ObjCProtocolDecl *getProtocol() const { return TheProtocol; } |
| 490 | void setProtocol(ObjCProtocolDecl *P) { TheProtocol = P; } |
| 491 | |
| 492 | SourceLocation getProtocolIdLoc() const { return ProtoLoc; } |
| 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 | SourceLocation getBeginLoc() const LLVM_READONLY { return AtLoc; } |
| 499 | SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; } |
| 500 | |
| 501 | |
| 502 | child_range children() { |
| 503 | return child_range(child_iterator(), child_iterator()); |
| 504 | } |
| 505 | |
| 506 | static bool classof(const Stmt *T) { |
| 507 | return T->getStmtClass() == ObjCProtocolExprClass; |
| 508 | } |
| 509 | }; |
| 510 | |
| 511 | |
| 512 | class ObjCIvarRefExpr : public Expr { |
| 513 | ObjCIvarDecl *D; |
| 514 | Stmt *Base; |
| 515 | SourceLocation Loc; |
| 516 | |
| 517 | |
| 518 | SourceLocation OpLoc; |
| 519 | |
| 520 | |
| 521 | bool IsArrow : 1; |
| 522 | |
| 523 | |
| 524 | bool IsFreeIvar : 1; |
| 525 | |
| 526 | public: |
| 527 | ObjCIvarRefExpr(ObjCIvarDecl *d, QualType t, |
| 528 | SourceLocation l, SourceLocation oploc, |
| 529 | Expr *base, |
| 530 | bool arrow = false, bool freeIvar = false) |
| 531 | : Expr(ObjCIvarRefExprClass, t, VK_LValue, |
| 532 | d->isBitField() ? OK_BitField : OK_Ordinary, |
| 533 | , base->isValueDependent(), |
| 534 | base->isInstantiationDependent(), |
| 535 | base->containsUnexpandedParameterPack()), |
| 536 | D(d), Base(base), Loc(l), OpLoc(oploc), IsArrow(arrow), |
| 537 | IsFreeIvar(freeIvar) {} |
| 538 | |
| 539 | explicit ObjCIvarRefExpr(EmptyShell Empty) |
| 540 | : Expr(ObjCIvarRefExprClass, Empty) {} |
| 541 | |
| 542 | ObjCIvarDecl *getDecl() { return D; } |
| 543 | const ObjCIvarDecl *getDecl() const { return D; } |
| 544 | void setDecl(ObjCIvarDecl *d) { D = d; } |
| 545 | |
| 546 | const Expr *getBase() const { return cast<Expr>(Base); } |
| 547 | Expr *getBase() { return cast<Expr>(Base); } |
| 548 | void setBase(Expr * base) { Base = base; } |
| 549 | |
| 550 | bool isArrow() const { return IsArrow; } |
| 551 | bool isFreeIvar() const { return IsFreeIvar; } |
| 552 | void setIsArrow(bool A) { IsArrow = A; } |
| 553 | void setIsFreeIvar(bool A) { IsFreeIvar = A; } |
| 554 | |
| 555 | SourceLocation getLocation() const { return Loc; } |
| 556 | void setLocation(SourceLocation L) { Loc = L; } |
| 557 | |
| 558 | SourceLocation getBeginLoc() const LLVM_READONLY { |
| 559 | return isFreeIvar() ? Loc : getBase()->getBeginLoc(); |
| 560 | } |
| 561 | SourceLocation getEndLoc() const LLVM_READONLY { return Loc; } |
| 562 | |
| 563 | SourceLocation getOpLoc() const { return OpLoc; } |
| 564 | void setOpLoc(SourceLocation L) { OpLoc = L; } |
| 565 | |
| 566 | |
| 567 | child_range children() { return child_range(&Base, &Base+1); } |
| 568 | |
| 569 | static bool classof(const Stmt *T) { |
| 570 | return T->getStmtClass() == ObjCIvarRefExprClass; |
| 571 | } |
| 572 | }; |
| 573 | |
| 574 | |
| 575 | |
| 576 | class ObjCPropertyRefExpr : public Expr { |
| 577 | private: |
| 578 | |
| 579 | |
| 580 | |
| 581 | |
| 582 | llvm::PointerIntPair<NamedDecl *, 1, bool> PropertyOrGetter; |
| 583 | |
| 584 | |
| 585 | |
| 586 | |
| 587 | enum MethodRefFlags { |
| 588 | MethodRef_None = 0, |
| 589 | MethodRef_Getter = 0x1, |
| 590 | MethodRef_Setter = 0x2 |
| 591 | }; |
| 592 | |
| 593 | |
| 594 | llvm::PointerIntPair<ObjCMethodDecl *, 2, unsigned> SetterAndMethodRefFlags; |
| 595 | |
| 596 | |
| 597 | |
| 598 | |
| 599 | |
| 600 | |
| 601 | SourceLocation IdLoc; |
| 602 | |
| 603 | |
| 604 | |
| 605 | |
| 606 | SourceLocation ReceiverLoc; |
| 607 | llvm::PointerUnion3<Stmt *, const Type *, ObjCInterfaceDecl *> Receiver; |
| 608 | |
| 609 | public: |
| 610 | ObjCPropertyRefExpr(ObjCPropertyDecl *PD, QualType t, |
| 611 | ExprValueKind VK, ExprObjectKind OK, |
| 612 | SourceLocation l, Expr *base) |
| 613 | : Expr(ObjCPropertyRefExprClass, t, VK, OK, |
| 614 | , base->isValueDependent(), |
| 615 | base->isInstantiationDependent(), |
| 616 | base->containsUnexpandedParameterPack()), |
| 617 | PropertyOrGetter(PD, false), IdLoc(l), Receiver(base) { |
| 618 | isSpecificPlaceholderType(BuiltinType..PseudoObject)", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprObjC.h", 618, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(t->isSpecificPlaceholderType(BuiltinType::PseudoObject)); |
| 619 | } |
| 620 | |
| 621 | ObjCPropertyRefExpr(ObjCPropertyDecl *PD, QualType t, |
| 622 | ExprValueKind VK, ExprObjectKind OK, |
| 623 | SourceLocation l, SourceLocation sl, QualType st) |
| 624 | : Expr(ObjCPropertyRefExprClass, t, VK, OK, |
| 625 | , false, st->isInstantiationDependentType(), |
| 626 | st->containsUnexpandedParameterPack()), |
| 627 | PropertyOrGetter(PD, false), IdLoc(l), ReceiverLoc(sl), |
| 628 | Receiver(st.getTypePtr()) { |
| 629 | isSpecificPlaceholderType(BuiltinType..PseudoObject)", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprObjC.h", 629, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(t->isSpecificPlaceholderType(BuiltinType::PseudoObject)); |
| 630 | } |
| 631 | |
| 632 | ObjCPropertyRefExpr(ObjCMethodDecl *Getter, ObjCMethodDecl *Setter, |
| 633 | QualType T, ExprValueKind VK, ExprObjectKind OK, |
| 634 | SourceLocation IdLoc, Expr *Base) |
| 635 | : Expr(ObjCPropertyRefExprClass, T, VK, OK, false, |
| 636 | Base->isValueDependent(), Base->isInstantiationDependent(), |
| 637 | Base->containsUnexpandedParameterPack()), |
| 638 | PropertyOrGetter(Getter, true), SetterAndMethodRefFlags(Setter, 0), |
| 639 | IdLoc(IdLoc), Receiver(Base) { |
| 640 | isSpecificPlaceholderType(BuiltinType..PseudoObject)", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprObjC.h", 640, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(T->isSpecificPlaceholderType(BuiltinType::PseudoObject)); |
| 641 | } |
| 642 | |
| 643 | ObjCPropertyRefExpr(ObjCMethodDecl *Getter, ObjCMethodDecl *Setter, |
| 644 | QualType T, ExprValueKind VK, ExprObjectKind OK, |
| 645 | SourceLocation IdLoc, |
| 646 | SourceLocation SuperLoc, QualType SuperTy) |
| 647 | : Expr(ObjCPropertyRefExprClass, T, VK, OK, false, false, false, false), |
| 648 | PropertyOrGetter(Getter, true), SetterAndMethodRefFlags(Setter, 0), |
| 649 | IdLoc(IdLoc), ReceiverLoc(SuperLoc), Receiver(SuperTy.getTypePtr()) { |
| 650 | isSpecificPlaceholderType(BuiltinType..PseudoObject)", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprObjC.h", 650, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(T->isSpecificPlaceholderType(BuiltinType::PseudoObject)); |
| 651 | } |
| 652 | |
| 653 | ObjCPropertyRefExpr(ObjCMethodDecl *Getter, ObjCMethodDecl *Setter, |
| 654 | QualType T, ExprValueKind VK, ExprObjectKind OK, |
| 655 | SourceLocation IdLoc, |
| 656 | SourceLocation ReceiverLoc, ObjCInterfaceDecl *Receiver) |
| 657 | : Expr(ObjCPropertyRefExprClass, T, VK, OK, false, false, false, false), |
| 658 | PropertyOrGetter(Getter, true), SetterAndMethodRefFlags(Setter, 0), |
| 659 | IdLoc(IdLoc), ReceiverLoc(ReceiverLoc), Receiver(Receiver) { |
| 660 | isSpecificPlaceholderType(BuiltinType..PseudoObject)", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprObjC.h", 660, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(T->isSpecificPlaceholderType(BuiltinType::PseudoObject)); |
| 661 | } |
| 662 | |
| 663 | explicit ObjCPropertyRefExpr(EmptyShell Empty) |
| 664 | : Expr(ObjCPropertyRefExprClass, Empty) {} |
| 665 | |
| 666 | bool isImplicitProperty() const { return PropertyOrGetter.getInt(); } |
| 667 | bool isExplicitProperty() const { return !PropertyOrGetter.getInt(); } |
| 668 | |
| 669 | ObjCPropertyDecl *getExplicitProperty() const { |
| 670 | assert(!isImplicitProperty()); |
| 671 | return cast<ObjCPropertyDecl>(PropertyOrGetter.getPointer()); |
| 672 | } |
| 673 | |
| 674 | ObjCMethodDecl *getImplicitPropertyGetter() const { |
| 675 | assert(isImplicitProperty()); |
| 676 | return cast_or_null<ObjCMethodDecl>(PropertyOrGetter.getPointer()); |
| 677 | } |
| 678 | |
| 679 | ObjCMethodDecl *getImplicitPropertySetter() const { |
| 680 | assert(isImplicitProperty()); |
| 681 | return SetterAndMethodRefFlags.getPointer(); |
| 682 | } |
| 683 | |
| 684 | Selector getGetterSelector() const { |
| 685 | if (isImplicitProperty()) |
| 686 | return getImplicitPropertyGetter()->getSelector(); |
| 687 | return getExplicitProperty()->getGetterName(); |
| 688 | } |
| 689 | |
| 690 | Selector getSetterSelector() const { |
| 691 | if (isImplicitProperty()) |
| 692 | return getImplicitPropertySetter()->getSelector(); |
| 693 | return getExplicitProperty()->getSetterName(); |
| 694 | } |
| 695 | |
| 696 | |
| 697 | |
| 698 | |
| 699 | bool isMessagingGetter() const { |
| 700 | return SetterAndMethodRefFlags.getInt() & MethodRef_Getter; |
| 701 | } |
| 702 | |
| 703 | |
| 704 | |
| 705 | |
| 706 | bool isMessagingSetter() const { |
| 707 | return SetterAndMethodRefFlags.getInt() & MethodRef_Setter; |
| 708 | } |
| 709 | |
| 710 | void setIsMessagingGetter(bool val = true) { |
| 711 | setMethodRefFlag(MethodRef_Getter, val); |
| 712 | } |
| 713 | |
| 714 | void setIsMessagingSetter(bool val = true) { |
| 715 | setMethodRefFlag(MethodRef_Setter, val); |
| 716 | } |
| 717 | |
| 718 | const Expr *getBase() const { |
| 719 | return cast<Expr>(Receiver.get<Stmt*>()); |
| 720 | } |
| 721 | Expr *getBase() { |
| 722 | return cast<Expr>(Receiver.get<Stmt*>()); |
| 723 | } |
| 724 | |
| 725 | SourceLocation getLocation() const { return IdLoc; } |
| 726 | |
| 727 | SourceLocation getReceiverLocation() const { return ReceiverLoc; } |
| 728 | |
| 729 | QualType getSuperReceiverType() const { |
| 730 | return QualType(Receiver.get<const Type*>(), 0); |
| 731 | } |
| 732 | |
| 733 | ObjCInterfaceDecl *getClassReceiver() const { |
| 734 | return Receiver.get<ObjCInterfaceDecl*>(); |
| 735 | } |
| 736 | |
| 737 | bool isObjectReceiver() const { return Receiver.is<Stmt*>(); } |
| 738 | bool isSuperReceiver() const { return Receiver.is<const Type*>(); } |
| 739 | bool isClassReceiver() const { return Receiver.is<ObjCInterfaceDecl*>(); } |
| 740 | |
| 741 | |
| 742 | QualType getReceiverType(const ASTContext &ctx) const; |
| 743 | |
| 744 | SourceLocation getBeginLoc() const LLVM_READONLY { |
| 745 | return isObjectReceiver() ? getBase()->getBeginLoc() |
| 746 | : getReceiverLocation(); |
| 747 | } |
| 748 | |
| 749 | SourceLocation getEndLoc() const LLVM_READONLY { return IdLoc; } |
| 750 | |
| 751 | |
| 752 | child_range children() { |
| 753 | if (Receiver.is<Stmt*>()) { |
| 754 | Stmt **begin = reinterpret_cast<Stmt**>(&Receiver); |
| 755 | return child_range(begin, begin+1); |
| 756 | } |
| 757 | return child_range(child_iterator(), child_iterator()); |
| 758 | } |
| 759 | |
| 760 | static bool classof(const Stmt *T) { |
| 761 | return T->getStmtClass() == ObjCPropertyRefExprClass; |
| 762 | } |
| 763 | |
| 764 | private: |
| 765 | friend class ASTStmtReader; |
| 766 | friend class ASTStmtWriter; |
| 767 | |
| 768 | void setExplicitProperty(ObjCPropertyDecl *D, unsigned methRefFlags) { |
| 769 | PropertyOrGetter.setPointer(D); |
| 770 | PropertyOrGetter.setInt(false); |
| 771 | SetterAndMethodRefFlags.setPointer(nullptr); |
| 772 | SetterAndMethodRefFlags.setInt(methRefFlags); |
| 773 | } |
| 774 | |
| 775 | void setImplicitProperty(ObjCMethodDecl *Getter, ObjCMethodDecl *Setter, |
| 776 | unsigned methRefFlags) { |
| 777 | PropertyOrGetter.setPointer(Getter); |
| 778 | PropertyOrGetter.setInt(true); |
| 779 | SetterAndMethodRefFlags.setPointer(Setter); |
| 780 | SetterAndMethodRefFlags.setInt(methRefFlags); |
| 781 | } |
| 782 | |
| 783 | void setBase(Expr *Base) { Receiver = Base; } |
| 784 | void setSuperReceiver(QualType T) { Receiver = T.getTypePtr(); } |
| 785 | void setClassReceiver(ObjCInterfaceDecl *D) { Receiver = D; } |
| 786 | |
| 787 | void setLocation(SourceLocation L) { IdLoc = L; } |
| 788 | void setReceiverLocation(SourceLocation Loc) { ReceiverLoc = Loc; } |
| 789 | |
| 790 | void setMethodRefFlag(MethodRefFlags flag, bool val) { |
| 791 | unsigned f = SetterAndMethodRefFlags.getInt(); |
| 792 | if (val) |
| 793 | f |= flag; |
| 794 | else |
| 795 | f &= ~flag; |
| 796 | SetterAndMethodRefFlags.setInt(f); |
| 797 | } |
| 798 | }; |
| 799 | |
| 800 | |
| 801 | |
| 802 | class ObjCSubscriptRefExpr : public Expr { |
| 803 | |
| 804 | SourceLocation RBracket; |
| 805 | |
| 806 | |
| 807 | |
| 808 | |
| 809 | enum { BASE, KEY, END_EXPR }; |
| 810 | Stmt* SubExprs[END_EXPR]; |
| 811 | |
| 812 | ObjCMethodDecl *GetAtIndexMethodDecl; |
| 813 | |
| 814 | |
| 815 | |
| 816 | ObjCMethodDecl *SetAtIndexMethodDecl; |
| 817 | |
| 818 | public: |
| 819 | ObjCSubscriptRefExpr(Expr *base, Expr *key, QualType T, |
| 820 | ExprValueKind VK, ExprObjectKind OK, |
| 821 | ObjCMethodDecl *getMethod, |
| 822 | ObjCMethodDecl *setMethod, SourceLocation RB) |
| 823 | : Expr(ObjCSubscriptRefExprClass, T, VK, OK, |
| 824 | base->isTypeDependent() || key->isTypeDependent(), |
| 825 | base->isValueDependent() || key->isValueDependent(), |
| 826 | (base->isInstantiationDependent() || |
| 827 | key->isInstantiationDependent()), |
| 828 | (base->containsUnexpandedParameterPack() || |
| 829 | key->containsUnexpandedParameterPack())), |
| 830 | RBracket(RB), GetAtIndexMethodDecl(getMethod), |
| 831 | SetAtIndexMethodDecl(setMethod) { |
| 832 | SubExprs[BASE] = base; SubExprs[KEY] = key; |
| 833 | } |
| 834 | |
| 835 | explicit ObjCSubscriptRefExpr(EmptyShell Empty) |
| 836 | : Expr(ObjCSubscriptRefExprClass, Empty) {} |
| 837 | |
| 838 | SourceLocation getRBracket() const { return RBracket; } |
| 839 | void setRBracket(SourceLocation RB) { RBracket = RB; } |
| 840 | |
| 841 | SourceLocation getBeginLoc() const LLVM_READONLY { |
| 842 | return SubExprs[BASE]->getBeginLoc(); |
| 843 | } |
| 844 | |
| 845 | SourceLocation getEndLoc() const LLVM_READONLY { return RBracket; } |
| 846 | |
| 847 | Expr *getBaseExpr() const { return cast<Expr>(SubExprs[BASE]); } |
| 848 | void setBaseExpr(Stmt *S) { SubExprs[BASE] = S; } |
| 849 | |
| 850 | Expr *getKeyExpr() const { return cast<Expr>(SubExprs[KEY]); } |
| 851 | void setKeyExpr(Stmt *S) { SubExprs[KEY] = S; } |
| 852 | |
| 853 | ObjCMethodDecl *getAtIndexMethodDecl() const { |
| 854 | return GetAtIndexMethodDecl; |
| 855 | } |
| 856 | |
| 857 | ObjCMethodDecl *setAtIndexMethodDecl() const { |
| 858 | return SetAtIndexMethodDecl; |
| 859 | } |
| 860 | |
| 861 | bool isArraySubscriptRefExpr() const { |
| 862 | return getKeyExpr()->getType()->isIntegralOrEnumerationType(); |
| 863 | } |
| 864 | |
| 865 | child_range children() { |
| 866 | return child_range(SubExprs, SubExprs+END_EXPR); |
| 867 | } |
| 868 | |
| 869 | static bool classof(const Stmt *T) { |
| 870 | return T->getStmtClass() == ObjCSubscriptRefExprClass; |
| 871 | } |
| 872 | |
| 873 | private: |
| 874 | friend class ASTStmtReader; |
| 875 | }; |
| 876 | |
| 877 | |
| 878 | |
| 879 | |
| 880 | |
| 881 | |
| 882 | |
| 883 | |
| 884 | |
| 885 | |
| 886 | |
| 887 | |
| 888 | |
| 889 | |
| 890 | |
| 891 | |
| 892 | |
| 893 | |
| 894 | |
| 895 | |
| 896 | |
| 897 | |
| 898 | |
| 899 | |
| 900 | |
| 901 | |
| 902 | |
| 903 | class ObjCMessageExpr final |
| 904 | : public Expr, |
| 905 | private llvm::TrailingObjects<ObjCMessageExpr, void *, SourceLocation> { |
| 906 | |
| 907 | |
| 908 | |
| 909 | uintptr_t SelectorOrMethod = 0; |
| 910 | |
| 911 | enum { NumArgsBitWidth = 16 }; |
| 912 | |
| 913 | |
| 914 | |
| 915 | unsigned NumArgs : NumArgsBitWidth; |
| 916 | |
| 917 | |
| 918 | |
| 919 | |
| 920 | |
| 921 | unsigned Kind : 8; |
| 922 | |
| 923 | |
| 924 | |
| 925 | |
| 926 | |
| 927 | |
| 928 | unsigned HasMethod : 1; |
| 929 | |
| 930 | |
| 931 | |
| 932 | unsigned IsDelegateInitCall : 1; |
| 933 | |
| 934 | |
| 935 | |
| 936 | unsigned IsImplicit : 1; |
| 937 | |
| 938 | |
| 939 | |
| 940 | unsigned SelLocsKind : 2; |
| 941 | |
| 942 | |
| 943 | |
| 944 | SourceLocation SuperLoc; |
| 945 | |
| 946 | |
| 947 | |
| 948 | SourceLocation LBracLoc, RBracLoc; |
| 949 | |
| 950 | ObjCMessageExpr(EmptyShell Empty, unsigned NumArgs) |
| 951 | : Expr(ObjCMessageExprClass, Empty), Kind(0), HasMethod(false), |
| 952 | IsDelegateInitCall(false), IsImplicit(false), SelLocsKind(0) { |
| 953 | setNumArgs(NumArgs); |
| 954 | } |
| 955 | |
| 956 | ObjCMessageExpr(QualType T, ExprValueKind VK, |
| 957 | SourceLocation LBracLoc, |
| 958 | SourceLocation SuperLoc, |
| 959 | bool IsInstanceSuper, |
| 960 | QualType SuperType, |
| 961 | Selector Sel, |
| 962 | ArrayRef<SourceLocation> SelLocs, |
| 963 | SelectorLocationsKind SelLocsK, |
| 964 | ObjCMethodDecl *Method, |
| 965 | ArrayRef<Expr *> Args, |
| 966 | SourceLocation RBracLoc, |
| 967 | bool isImplicit); |
| 968 | ObjCMessageExpr(QualType T, ExprValueKind VK, |
| 969 | SourceLocation LBracLoc, |
| 970 | TypeSourceInfo *Receiver, |
| 971 | Selector Sel, |
| 972 | ArrayRef<SourceLocation> SelLocs, |
| 973 | SelectorLocationsKind SelLocsK, |
| 974 | ObjCMethodDecl *Method, |
| 975 | ArrayRef<Expr *> Args, |
| 976 | SourceLocation RBracLoc, |
| 977 | bool isImplicit); |
| 978 | ObjCMessageExpr(QualType T, ExprValueKind VK, |
| 979 | SourceLocation LBracLoc, |
| 980 | Expr *Receiver, |
| 981 | Selector Sel, |
| 982 | ArrayRef<SourceLocation> SelLocs, |
| 983 | SelectorLocationsKind SelLocsK, |
| 984 | ObjCMethodDecl *Method, |
| 985 | ArrayRef<Expr *> Args, |
| 986 | SourceLocation RBracLoc, |
| 987 | bool isImplicit); |
| 988 | |
| 989 | size_t numTrailingObjects(OverloadToken<void *>) const { return NumArgs + 1; } |
| 990 | |
| 991 | void setNumArgs(unsigned Num) { |
| 992 | (0) . __assert_fail ("(Num >> NumArgsBitWidth) == 0 && \"Num of args is out of range!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprObjC.h", 992, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert((Num >> NumArgsBitWidth) == 0 && "Num of args is out of range!"); |
| 993 | NumArgs = Num; |
| 994 | } |
| 995 | |
| 996 | void initArgsAndSelLocs(ArrayRef<Expr *> Args, |
| 997 | ArrayRef<SourceLocation> SelLocs, |
| 998 | SelectorLocationsKind SelLocsK); |
| 999 | |
| 1000 | |
| 1001 | void *getReceiverPointer() const { return *getTrailingObjects<void *>(); } |
| 1002 | |
| 1003 | |
| 1004 | void setReceiverPointer(void *Value) { |
| 1005 | *getTrailingObjects<void *>() = Value; |
| 1006 | } |
| 1007 | |
| 1008 | SelectorLocationsKind getSelLocsKind() const { |
| 1009 | return (SelectorLocationsKind)SelLocsKind; |
| 1010 | } |
| 1011 | |
| 1012 | bool hasStandardSelLocs() const { |
| 1013 | return getSelLocsKind() != SelLoc_NonStandard; |
| 1014 | } |
| 1015 | |
| 1016 | |
| 1017 | |
| 1018 | SourceLocation *getStoredSelLocs() { |
| 1019 | return getTrailingObjects<SourceLocation>(); |
| 1020 | } |
| 1021 | const SourceLocation *getStoredSelLocs() const { |
| 1022 | return getTrailingObjects<SourceLocation>(); |
| 1023 | } |
| 1024 | |
| 1025 | |
| 1026 | |
| 1027 | unsigned getNumStoredSelLocs() const { |
| 1028 | if (hasStandardSelLocs()) |
| 1029 | return 0; |
| 1030 | return getNumSelectorLocs(); |
| 1031 | } |
| 1032 | |
| 1033 | static ObjCMessageExpr *alloc(const ASTContext &C, |
| 1034 | ArrayRef<Expr *> Args, |
| 1035 | SourceLocation RBraceLoc, |
| 1036 | ArrayRef<SourceLocation> SelLocs, |
| 1037 | Selector Sel, |
| 1038 | SelectorLocationsKind &SelLocsK); |
| 1039 | static ObjCMessageExpr *alloc(const ASTContext &C, |
| 1040 | unsigned NumArgs, |
| 1041 | unsigned NumStoredSelLocs); |
| 1042 | |
| 1043 | public: |
| 1044 | friend class ASTStmtReader; |
| 1045 | friend class ASTStmtWriter; |
| 1046 | friend TrailingObjects; |
| 1047 | |
| 1048 | |
| 1049 | enum ReceiverKind { |
| 1050 | |
| 1051 | Class = 0, |
| 1052 | |
| 1053 | |
| 1054 | Instance, |
| 1055 | |
| 1056 | |
| 1057 | SuperClass, |
| 1058 | |
| 1059 | |
| 1060 | SuperInstance |
| 1061 | }; |
| 1062 | |
| 1063 | |
| 1064 | |
| 1065 | |
| 1066 | |
| 1067 | |
| 1068 | |
| 1069 | |
| 1070 | |
| 1071 | |
| 1072 | |
| 1073 | |
| 1074 | |
| 1075 | |
| 1076 | |
| 1077 | |
| 1078 | |
| 1079 | |
| 1080 | |
| 1081 | |
| 1082 | |
| 1083 | |
| 1084 | |
| 1085 | |
| 1086 | |
| 1087 | |
| 1088 | static ObjCMessageExpr *Create(const ASTContext &Context, QualType T, |
| 1089 | ExprValueKind VK, |
| 1090 | SourceLocation LBracLoc, |
| 1091 | SourceLocation SuperLoc, |
| 1092 | bool IsInstanceSuper, |
| 1093 | QualType SuperType, |
| 1094 | Selector Sel, |
| 1095 | ArrayRef<SourceLocation> SelLocs, |
| 1096 | ObjCMethodDecl *Method, |
| 1097 | ArrayRef<Expr *> Args, |
| 1098 | SourceLocation RBracLoc, |
| 1099 | bool isImplicit); |
| 1100 | |
| 1101 | |
| 1102 | |
| 1103 | |
| 1104 | |
| 1105 | |
| 1106 | |
| 1107 | |
| 1108 | |
| 1109 | |
| 1110 | |
| 1111 | |
| 1112 | |
| 1113 | |
| 1114 | |
| 1115 | |
| 1116 | |
| 1117 | |
| 1118 | |
| 1119 | |
| 1120 | |
| 1121 | |
| 1122 | |
| 1123 | |
| 1124 | static ObjCMessageExpr *Create(const ASTContext &Context, QualType T, |
| 1125 | ExprValueKind VK, |
| 1126 | SourceLocation LBracLoc, |
| 1127 | TypeSourceInfo *Receiver, |
| 1128 | Selector Sel, |
| 1129 | ArrayRef<SourceLocation> SelLocs, |
| 1130 | ObjCMethodDecl *Method, |
| 1131 | ArrayRef<Expr *> Args, |
| 1132 | SourceLocation RBracLoc, |
| 1133 | bool isImplicit); |
| 1134 | |
| 1135 | |
| 1136 | |
| 1137 | |
| 1138 | |
| 1139 | |
| 1140 | |
| 1141 | |
| 1142 | |
| 1143 | |
| 1144 | |
| 1145 | |
| 1146 | |
| 1147 | |
| 1148 | |
| 1149 | |
| 1150 | |
| 1151 | |
| 1152 | |
| 1153 | |
| 1154 | |
| 1155 | |
| 1156 | |
| 1157 | |
| 1158 | static ObjCMessageExpr *Create(const ASTContext &Context, QualType T, |
| 1159 | ExprValueKind VK, |
| 1160 | SourceLocation LBracLoc, |
| 1161 | Expr *Receiver, |
| 1162 | Selector Sel, |
| 1163 | ArrayRef<SourceLocation> SeLocs, |
| 1164 | ObjCMethodDecl *Method, |
| 1165 | ArrayRef<Expr *> Args, |
| 1166 | SourceLocation RBracLoc, |
| 1167 | bool isImplicit); |
| 1168 | |
| 1169 | |
| 1170 | |
| 1171 | |
| 1172 | |
| 1173 | |
| 1174 | |
| 1175 | |
| 1176 | static ObjCMessageExpr *CreateEmpty(const ASTContext &Context, |
| 1177 | unsigned NumArgs, |
| 1178 | unsigned NumStoredSelLocs); |
| 1179 | |
| 1180 | |
| 1181 | |
| 1182 | |
| 1183 | bool isImplicit() const { return IsImplicit; } |
| 1184 | |
| 1185 | |
| 1186 | |
| 1187 | ReceiverKind getReceiverKind() const { return (ReceiverKind)Kind; } |
| 1188 | |
| 1189 | |
| 1190 | |
| 1191 | |
| 1192 | |
| 1193 | |
| 1194 | QualType getCallReturnType(ASTContext &Ctx) const; |
| 1195 | |
| 1196 | |
| 1197 | SourceRange getReceiverRange() const; |
| 1198 | |
| 1199 | |
| 1200 | |
| 1201 | bool isInstanceMessage() const { |
| 1202 | return getReceiverKind() == Instance || getReceiverKind() == SuperInstance; |
| 1203 | } |
| 1204 | |
| 1205 | |
| 1206 | |
| 1207 | bool isClassMessage() const { |
| 1208 | return getReceiverKind() == Class || getReceiverKind() == SuperClass; |
| 1209 | } |
| 1210 | |
| 1211 | |
| 1212 | |
| 1213 | Expr *getInstanceReceiver() { |
| 1214 | if (getReceiverKind() == Instance) |
| 1215 | return static_cast<Expr *>(getReceiverPointer()); |
| 1216 | |
| 1217 | return nullptr; |
| 1218 | } |
| 1219 | const Expr *getInstanceReceiver() const { |
| 1220 | return const_cast<ObjCMessageExpr*>(this)->getInstanceReceiver(); |
| 1221 | } |
| 1222 | |
| 1223 | |
| 1224 | |
| 1225 | void setInstanceReceiver(Expr *rec) { |
| 1226 | Kind = Instance; |
| 1227 | setReceiverPointer(rec); |
| 1228 | } |
| 1229 | |
| 1230 | |
| 1231 | |
| 1232 | QualType getClassReceiver() const { |
| 1233 | if (TypeSourceInfo *TSInfo = getClassReceiverTypeInfo()) |
| 1234 | return TSInfo->getType(); |
| 1235 | |
| 1236 | return {}; |
| 1237 | } |
| 1238 | |
| 1239 | |
| 1240 | |
| 1241 | TypeSourceInfo *getClassReceiverTypeInfo() const { |
| 1242 | if (getReceiverKind() == Class) |
| 1243 | return reinterpret_cast<TypeSourceInfo *>(getReceiverPointer()); |
| 1244 | return nullptr; |
| 1245 | } |
| 1246 | |
| 1247 | void setClassReceiver(TypeSourceInfo *TSInfo) { |
| 1248 | Kind = Class; |
| 1249 | setReceiverPointer(TSInfo); |
| 1250 | } |
| 1251 | |
| 1252 | |
| 1253 | |
| 1254 | SourceLocation getSuperLoc() const { |
| 1255 | if (getReceiverKind() == SuperInstance || getReceiverKind() == SuperClass) |
| 1256 | return SuperLoc; |
| 1257 | |
| 1258 | return SourceLocation(); |
| 1259 | } |
| 1260 | |
| 1261 | |
| 1262 | |
| 1263 | |
| 1264 | |
| 1265 | |
| 1266 | |
| 1267 | |
| 1268 | |
| 1269 | |
| 1270 | QualType getReceiverType() const; |
| 1271 | |
| 1272 | |
| 1273 | |
| 1274 | |
| 1275 | |
| 1276 | |
| 1277 | |
| 1278 | |
| 1279 | |
| 1280 | |
| 1281 | |
| 1282 | ObjCInterfaceDecl *getReceiverInterface() const; |
| 1283 | |
| 1284 | |
| 1285 | |
| 1286 | |
| 1287 | |
| 1288 | |
| 1289 | QualType getSuperType() const { |
| 1290 | if (getReceiverKind() == SuperInstance || getReceiverKind() == SuperClass) |
| 1291 | return QualType::getFromOpaquePtr(getReceiverPointer()); |
| 1292 | |
| 1293 | return QualType(); |
| 1294 | } |
| 1295 | |
| 1296 | void setSuper(SourceLocation Loc, QualType T, bool IsInstanceSuper) { |
| 1297 | Kind = IsInstanceSuper? SuperInstance : SuperClass; |
| 1298 | SuperLoc = Loc; |
| 1299 | setReceiverPointer(T.getAsOpaquePtr()); |
| 1300 | } |
| 1301 | |
| 1302 | Selector getSelector() const; |
| 1303 | |
| 1304 | void setSelector(Selector S) { |
| 1305 | HasMethod = false; |
| 1306 | SelectorOrMethod = reinterpret_cast<uintptr_t>(S.getAsOpaquePtr()); |
| 1307 | } |
| 1308 | |
| 1309 | const ObjCMethodDecl *getMethodDecl() const { |
| 1310 | if (HasMethod) |
| 1311 | return reinterpret_cast<const ObjCMethodDecl *>(SelectorOrMethod); |
| 1312 | |
| 1313 | return nullptr; |
| 1314 | } |
| 1315 | |
| 1316 | ObjCMethodDecl *getMethodDecl() { |
| 1317 | if (HasMethod) |
| 1318 | return reinterpret_cast<ObjCMethodDecl *>(SelectorOrMethod); |
| 1319 | |
| 1320 | return nullptr; |
| 1321 | } |
| 1322 | |
| 1323 | void setMethodDecl(ObjCMethodDecl *MD) { |
| 1324 | HasMethod = true; |
| 1325 | SelectorOrMethod = reinterpret_cast<uintptr_t>(MD); |
| 1326 | } |
| 1327 | |
| 1328 | ObjCMethodFamily getMethodFamily() const { |
| 1329 | if (HasMethod) return getMethodDecl()->getMethodFamily(); |
| 1330 | return getSelector().getMethodFamily(); |
| 1331 | } |
| 1332 | |
| 1333 | |
| 1334 | |
| 1335 | unsigned getNumArgs() const { return NumArgs; } |
| 1336 | |
| 1337 | |
| 1338 | |
| 1339 | Expr **getArgs() { |
| 1340 | return reinterpret_cast<Expr **>(getTrailingObjects<void *>() + 1); |
| 1341 | } |
| 1342 | const Expr * const *getArgs() const { |
| 1343 | return reinterpret_cast<const Expr *const *>(getTrailingObjects<void *>() + |
| 1344 | 1); |
| 1345 | } |
| 1346 | |
| 1347 | |
| 1348 | Expr *getArg(unsigned Arg) { |
| 1349 | (0) . __assert_fail ("Arg < NumArgs && \"Arg access out of range!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprObjC.h", 1349, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(Arg < NumArgs && "Arg access out of range!"); |
| 1350 | return getArgs()[Arg]; |
| 1351 | } |
| 1352 | const Expr *getArg(unsigned Arg) const { |
| 1353 | (0) . __assert_fail ("Arg < NumArgs && \"Arg access out of range!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprObjC.h", 1353, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(Arg < NumArgs && "Arg access out of range!"); |
| 1354 | return getArgs()[Arg]; |
| 1355 | } |
| 1356 | |
| 1357 | |
| 1358 | void setArg(unsigned Arg, Expr *ArgExpr) { |
| 1359 | (0) . __assert_fail ("Arg < NumArgs && \"Arg access out of range!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprObjC.h", 1359, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(Arg < NumArgs && "Arg access out of range!"); |
| 1360 | getArgs()[Arg] = ArgExpr; |
| 1361 | } |
| 1362 | |
| 1363 | |
| 1364 | |
| 1365 | |
| 1366 | bool isDelegateInitCall() const { return IsDelegateInitCall; } |
| 1367 | void setDelegateInitCall(bool isDelegate) { IsDelegateInitCall = isDelegate; } |
| 1368 | |
| 1369 | SourceLocation getLeftLoc() const { return LBracLoc; } |
| 1370 | SourceLocation getRightLoc() const { return RBracLoc; } |
| 1371 | |
| 1372 | SourceLocation getSelectorStartLoc() const { |
| 1373 | if (isImplicit()) |
| 1374 | return getBeginLoc(); |
| 1375 | return getSelectorLoc(0); |
| 1376 | } |
| 1377 | |
| 1378 | SourceLocation getSelectorLoc(unsigned Index) const { |
| 1379 | (0) . __assert_fail ("Index < getNumSelectorLocs() && \"Index out of range!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprObjC.h", 1379, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(Index < getNumSelectorLocs() && "Index out of range!"); |
| 1380 | if (hasStandardSelLocs()) |
| 1381 | return getStandardSelectorLoc(Index, getSelector(), |
| 1382 | getSelLocsKind() == SelLoc_StandardWithSpace, |
| 1383 | llvm::makeArrayRef(const_cast<Expr**>(getArgs()), |
| 1384 | getNumArgs()), |
| 1385 | RBracLoc); |
| 1386 | return getStoredSelLocs()[Index]; |
| 1387 | } |
| 1388 | |
| 1389 | void getSelectorLocs(SmallVectorImpl<SourceLocation> &SelLocs) const; |
| 1390 | |
| 1391 | unsigned getNumSelectorLocs() const { |
| 1392 | if (isImplicit()) |
| 1393 | return 0; |
| 1394 | Selector Sel = getSelector(); |
| 1395 | if (Sel.isUnarySelector()) |
| 1396 | return 1; |
| 1397 | return Sel.getNumArgs(); |
| 1398 | } |
| 1399 | |
| 1400 | void setSourceRange(SourceRange R) { |
| 1401 | LBracLoc = R.getBegin(); |
| 1402 | RBracLoc = R.getEnd(); |
| 1403 | } |
| 1404 | |
| 1405 | SourceLocation getBeginLoc() const LLVM_READONLY { return LBracLoc; } |
| 1406 | SourceLocation getEndLoc() const LLVM_READONLY { return RBracLoc; } |
| 1407 | |
| 1408 | |
| 1409 | child_range children(); |
| 1410 | |
| 1411 | using arg_iterator = ExprIterator; |
| 1412 | using const_arg_iterator = ConstExprIterator; |
| 1413 | |
| 1414 | llvm::iterator_range<arg_iterator> arguments() { |
| 1415 | return llvm::make_range(arg_begin(), arg_end()); |
| 1416 | } |
| 1417 | |
| 1418 | llvm::iterator_range<const_arg_iterator> arguments() const { |
| 1419 | return llvm::make_range(arg_begin(), arg_end()); |
| 1420 | } |
| 1421 | |
| 1422 | arg_iterator arg_begin() { return reinterpret_cast<Stmt **>(getArgs()); } |
| 1423 | |
| 1424 | arg_iterator arg_end() { |
| 1425 | return reinterpret_cast<Stmt **>(getArgs() + NumArgs); |
| 1426 | } |
| 1427 | |
| 1428 | const_arg_iterator arg_begin() const { |
| 1429 | return reinterpret_cast<Stmt const * const*>(getArgs()); |
| 1430 | } |
| 1431 | |
| 1432 | const_arg_iterator arg_end() const { |
| 1433 | return reinterpret_cast<Stmt const * const*>(getArgs() + NumArgs); |
| 1434 | } |
| 1435 | |
| 1436 | static bool classof(const Stmt *T) { |
| 1437 | return T->getStmtClass() == ObjCMessageExprClass; |
| 1438 | } |
| 1439 | }; |
| 1440 | |
| 1441 | |
| 1442 | |
| 1443 | class ObjCIsaExpr : public Expr { |
| 1444 | |
| 1445 | Stmt *Base; |
| 1446 | |
| 1447 | |
| 1448 | SourceLocation IsaMemberLoc; |
| 1449 | |
| 1450 | |
| 1451 | SourceLocation OpLoc; |
| 1452 | |
| 1453 | |
| 1454 | bool IsArrow; |
| 1455 | |
| 1456 | public: |
| 1457 | ObjCIsaExpr(Expr *base, bool isarrow, SourceLocation l, SourceLocation oploc, |
| 1458 | QualType ty) |
| 1459 | : Expr(ObjCIsaExprClass, ty, VK_LValue, OK_Ordinary, |
| 1460 | , base->isValueDependent(), |
| 1461 | base->isInstantiationDependent(), |
| 1462 | ), |
| 1463 | Base(base), IsaMemberLoc(l), OpLoc(oploc), IsArrow(isarrow) {} |
| 1464 | |
| 1465 | |
| 1466 | explicit ObjCIsaExpr(EmptyShell Empty) : Expr(ObjCIsaExprClass, Empty) {} |
| 1467 | |
| 1468 | void setBase(Expr *E) { Base = E; } |
| 1469 | Expr *getBase() const { return cast<Expr>(Base); } |
| 1470 | |
| 1471 | bool isArrow() const { return IsArrow; } |
| 1472 | void setArrow(bool A) { IsArrow = A; } |
| 1473 | |
| 1474 | |
| 1475 | |
| 1476 | SourceLocation getIsaMemberLoc() const { return IsaMemberLoc; } |
| 1477 | void setIsaMemberLoc(SourceLocation L) { IsaMemberLoc = L; } |
| 1478 | |
| 1479 | SourceLocation getOpLoc() const { return OpLoc; } |
| 1480 | void setOpLoc(SourceLocation L) { OpLoc = L; } |
| 1481 | |
| 1482 | SourceLocation getBeginLoc() const LLVM_READONLY { |
| 1483 | return getBase()->getBeginLoc(); |
| 1484 | } |
| 1485 | |
| 1486 | SourceLocation getBaseLocEnd() const LLVM_READONLY { |
| 1487 | return getBase()->getEndLoc(); |
| 1488 | } |
| 1489 | |
| 1490 | SourceLocation getEndLoc() const LLVM_READONLY { return IsaMemberLoc; } |
| 1491 | |
| 1492 | SourceLocation getExprLoc() const LLVM_READONLY { return IsaMemberLoc; } |
| 1493 | |
| 1494 | |
| 1495 | child_range children() { return child_range(&Base, &Base+1); } |
| 1496 | |
| 1497 | static bool classof(const Stmt *T) { |
| 1498 | return T->getStmtClass() == ObjCIsaExprClass; |
| 1499 | } |
| 1500 | }; |
| 1501 | |
| 1502 | |
| 1503 | |
| 1504 | |
| 1505 | |
| 1506 | |
| 1507 | |
| 1508 | |
| 1509 | |
| 1510 | |
| 1511 | |
| 1512 | |
| 1513 | |
| 1514 | |
| 1515 | |
| 1516 | |
| 1517 | |
| 1518 | |
| 1519 | |
| 1520 | |
| 1521 | |
| 1522 | |
| 1523 | |
| 1524 | class ObjCIndirectCopyRestoreExpr : public Expr { |
| 1525 | friend class ASTReader; |
| 1526 | friend class ASTStmtReader; |
| 1527 | |
| 1528 | Stmt *Operand; |
| 1529 | |
| 1530 | |
| 1531 | |
| 1532 | explicit ObjCIndirectCopyRestoreExpr(EmptyShell Empty) |
| 1533 | : Expr(ObjCIndirectCopyRestoreExprClass, Empty) {} |
| 1534 | |
| 1535 | void setShouldCopy(bool shouldCopy) { |
| 1536 | ObjCIndirectCopyRestoreExprBits.ShouldCopy = shouldCopy; |
| 1537 | } |
| 1538 | |
| 1539 | public: |
| 1540 | ObjCIndirectCopyRestoreExpr(Expr *operand, QualType type, bool shouldCopy) |
| 1541 | : Expr(ObjCIndirectCopyRestoreExprClass, type, VK_LValue, OK_Ordinary, |
| 1542 | operand->isTypeDependent(), operand->isValueDependent(), |
| 1543 | operand->isInstantiationDependent(), |
| 1544 | operand->containsUnexpandedParameterPack()), |
| 1545 | Operand(operand) { |
| 1546 | setShouldCopy(shouldCopy); |
| 1547 | } |
| 1548 | |
| 1549 | Expr *getSubExpr() { return cast<Expr>(Operand); } |
| 1550 | const Expr *getSubExpr() const { return cast<Expr>(Operand); } |
| 1551 | |
| 1552 | |
| 1553 | |
| 1554 | bool shouldCopy() const { return ObjCIndirectCopyRestoreExprBits.ShouldCopy; } |
| 1555 | |
| 1556 | child_range children() { return child_range(&Operand, &Operand+1); } |
| 1557 | |
| 1558 | |
| 1559 | SourceLocation getBeginLoc() const LLVM_READONLY { |
| 1560 | return Operand->getBeginLoc(); |
| 1561 | } |
| 1562 | SourceLocation getEndLoc() const LLVM_READONLY { |
| 1563 | return Operand->getEndLoc(); |
| 1564 | } |
| 1565 | |
| 1566 | SourceLocation getExprLoc() const LLVM_READONLY { |
| 1567 | return getSubExpr()->getExprLoc(); |
| 1568 | } |
| 1569 | |
| 1570 | static bool classof(const Stmt *s) { |
| 1571 | return s->getStmtClass() == ObjCIndirectCopyRestoreExprClass; |
| 1572 | } |
| 1573 | }; |
| 1574 | |
| 1575 | |
| 1576 | |
| 1577 | |
| 1578 | |
| 1579 | |
| 1580 | |
| 1581 | class ObjCBridgedCastExpr final |
| 1582 | : public ExplicitCastExpr, |
| 1583 | private llvm::TrailingObjects<ObjCBridgedCastExpr, CXXBaseSpecifier *> { |
| 1584 | friend class ASTStmtReader; |
| 1585 | friend class ASTStmtWriter; |
| 1586 | friend class CastExpr; |
| 1587 | friend TrailingObjects; |
| 1588 | |
| 1589 | SourceLocation LParenLoc; |
| 1590 | SourceLocation BridgeKeywordLoc; |
| 1591 | unsigned Kind : 2; |
| 1592 | |
| 1593 | public: |
| 1594 | ObjCBridgedCastExpr(SourceLocation LParenLoc, ObjCBridgeCastKind Kind, |
| 1595 | CastKind CK, SourceLocation BridgeKeywordLoc, |
| 1596 | TypeSourceInfo *TSInfo, Expr *Operand) |
| 1597 | : ExplicitCastExpr(ObjCBridgedCastExprClass, TSInfo->getType(), VK_RValue, |
| 1598 | CK, Operand, 0, TSInfo), |
| 1599 | LParenLoc(LParenLoc), BridgeKeywordLoc(BridgeKeywordLoc), Kind(Kind) {} |
| 1600 | |
| 1601 | |
| 1602 | explicit ObjCBridgedCastExpr(EmptyShell Shell) |
| 1603 | : ExplicitCastExpr(ObjCBridgedCastExprClass, Shell, 0) {} |
| 1604 | |
| 1605 | SourceLocation getLParenLoc() const { return LParenLoc; } |
| 1606 | |
| 1607 | |
| 1608 | ObjCBridgeCastKind getBridgeKind() const { |
| 1609 | return static_cast<ObjCBridgeCastKind>(Kind); |
| 1610 | } |
| 1611 | |
| 1612 | |
| 1613 | StringRef getBridgeKindName() const; |
| 1614 | |
| 1615 | |
| 1616 | SourceLocation getBridgeKeywordLoc() const { return BridgeKeywordLoc; } |
| 1617 | |
| 1618 | SourceLocation getBeginLoc() const LLVM_READONLY { return LParenLoc; } |
| 1619 | |
| 1620 | SourceLocation getEndLoc() const LLVM_READONLY { |
| 1621 | return getSubExpr()->getEndLoc(); |
| 1622 | } |
| 1623 | |
| 1624 | static bool classof(const Stmt *T) { |
| 1625 | return T->getStmtClass() == ObjCBridgedCastExprClass; |
| 1626 | } |
| 1627 | }; |
| 1628 | |
| 1629 | |
| 1630 | |
| 1631 | |
| 1632 | |
| 1633 | |
| 1634 | |
| 1635 | |
| 1636 | |
| 1637 | |
| 1638 | |
| 1639 | |
| 1640 | |
| 1641 | |
| 1642 | class ObjCAvailabilityCheckExpr : public Expr { |
| 1643 | friend class ASTStmtReader; |
| 1644 | |
| 1645 | VersionTuple VersionToCheck; |
| 1646 | SourceLocation AtLoc, RParen; |
| 1647 | |
| 1648 | public: |
| 1649 | ObjCAvailabilityCheckExpr(VersionTuple VersionToCheck, SourceLocation AtLoc, |
| 1650 | SourceLocation RParen, QualType Ty) |
| 1651 | : Expr(ObjCAvailabilityCheckExprClass, Ty, VK_RValue, OK_Ordinary, false, |
| 1652 | false, false, false), |
| 1653 | VersionToCheck(VersionToCheck), AtLoc(AtLoc), RParen(RParen) {} |
| 1654 | |
| 1655 | explicit ObjCAvailabilityCheckExpr(EmptyShell Shell) |
| 1656 | : Expr(ObjCAvailabilityCheckExprClass, Shell) {} |
| 1657 | |
| 1658 | SourceLocation getBeginLoc() const { return AtLoc; } |
| 1659 | SourceLocation getEndLoc() const { return RParen; } |
| 1660 | SourceRange getSourceRange() const { return {AtLoc, RParen}; } |
| 1661 | |
| 1662 | |
| 1663 | bool hasVersion() const { return !VersionToCheck.empty(); } |
| 1664 | VersionTuple getVersion() { return VersionToCheck; } |
| 1665 | |
| 1666 | child_range children() { |
| 1667 | return child_range(child_iterator(), child_iterator()); |
| 1668 | } |
| 1669 | |
| 1670 | static bool classof(const Stmt *T) { |
| 1671 | return T->getStmtClass() == ObjCAvailabilityCheckExprClass; |
| 1672 | } |
| 1673 | }; |
| 1674 | |
| 1675 | } |
| 1676 | |
| 1677 | #endif |
| 1678 | |