| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | #ifndef LLVM_CLANG_AST_EXPRCXX_H |
| 15 | #define LLVM_CLANG_AST_EXPRCXX_H |
| 16 | |
| 17 | #include "clang/AST/Decl.h" |
| 18 | #include "clang/AST/DeclBase.h" |
| 19 | #include "clang/AST/DeclCXX.h" |
| 20 | #include "clang/AST/DeclarationName.h" |
| 21 | #include "clang/AST/Expr.h" |
| 22 | #include "clang/AST/NestedNameSpecifier.h" |
| 23 | #include "clang/AST/OperationKinds.h" |
| 24 | #include "clang/AST/Stmt.h" |
| 25 | #include "clang/AST/TemplateBase.h" |
| 26 | #include "clang/AST/Type.h" |
| 27 | #include "clang/AST/UnresolvedSet.h" |
| 28 | #include "clang/Basic/ExceptionSpecificationType.h" |
| 29 | #include "clang/Basic/ExpressionTraits.h" |
| 30 | #include "clang/Basic/LLVM.h" |
| 31 | #include "clang/Basic/Lambda.h" |
| 32 | #include "clang/Basic/LangOptions.h" |
| 33 | #include "clang/Basic/OperatorKinds.h" |
| 34 | #include "clang/Basic/SourceLocation.h" |
| 35 | #include "clang/Basic/Specifiers.h" |
| 36 | #include "clang/Basic/TypeTraits.h" |
| 37 | #include "llvm/ADT/ArrayRef.h" |
| 38 | #include "llvm/ADT/None.h" |
| 39 | #include "llvm/ADT/Optional.h" |
| 40 | #include "llvm/ADT/PointerUnion.h" |
| 41 | #include "llvm/ADT/StringRef.h" |
| 42 | #include "llvm/ADT/iterator_range.h" |
| 43 | #include "llvm/Support/Casting.h" |
| 44 | #include "llvm/Support/Compiler.h" |
| 45 | #include "llvm/Support/TrailingObjects.h" |
| 46 | #include <cassert> |
| 47 | #include <cstddef> |
| 48 | #include <cstdint> |
| 49 | #include <memory> |
| 50 | |
| 51 | namespace clang { |
| 52 | |
| 53 | class ASTContext; |
| 54 | class DeclAccessPair; |
| 55 | class IdentifierInfo; |
| 56 | class LambdaCapture; |
| 57 | class NonTypeTemplateParmDecl; |
| 58 | class TemplateParameterList; |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | class CXXOperatorCallExpr final : public CallExpr { |
| 78 | friend class ASTStmtReader; |
| 79 | friend class ASTStmtWriter; |
| 80 | |
| 81 | SourceRange Range; |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | SourceRange getSourceRangeImpl() const LLVM_READONLY; |
| 87 | |
| 88 | CXXOperatorCallExpr(OverloadedOperatorKind OpKind, Expr *Fn, |
| 89 | ArrayRef<Expr *> Args, QualType Ty, ExprValueKind VK, |
| 90 | SourceLocation OperatorLoc, FPOptions FPFeatures, |
| 91 | ADLCallKind UsesADL); |
| 92 | |
| 93 | CXXOperatorCallExpr(unsigned NumArgs, EmptyShell Empty); |
| 94 | |
| 95 | public: |
| 96 | static CXXOperatorCallExpr * |
| 97 | Create(const ASTContext &Ctx, OverloadedOperatorKind OpKind, Expr *Fn, |
| 98 | ArrayRef<Expr *> Args, QualType Ty, ExprValueKind VK, |
| 99 | SourceLocation OperatorLoc, FPOptions FPFeatures, |
| 100 | ADLCallKind UsesADL = NotADL); |
| 101 | |
| 102 | static CXXOperatorCallExpr *CreateEmpty(const ASTContext &Ctx, |
| 103 | unsigned NumArgs, EmptyShell Empty); |
| 104 | |
| 105 | |
| 106 | OverloadedOperatorKind getOperator() const { |
| 107 | return static_cast<OverloadedOperatorKind>( |
| 108 | CXXOperatorCallExprBits.OperatorKind); |
| 109 | } |
| 110 | |
| 111 | static bool isAssignmentOp(OverloadedOperatorKind Opc) { |
| 112 | return Opc == OO_Equal || Opc == OO_StarEqual || Opc == OO_SlashEqual || |
| 113 | Opc == OO_PercentEqual || Opc == OO_PlusEqual || |
| 114 | Opc == OO_MinusEqual || Opc == OO_LessLessEqual || |
| 115 | Opc == OO_GreaterGreaterEqual || Opc == OO_AmpEqual || |
| 116 | Opc == OO_CaretEqual || Opc == OO_PipeEqual; |
| 117 | } |
| 118 | bool isAssignmentOp() const { return isAssignmentOp(getOperator()); } |
| 119 | |
| 120 | |
| 121 | bool isInfixBinaryOp() const; |
| 122 | |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | SourceLocation getOperatorLoc() const { return getRParenLoc(); } |
| 129 | |
| 130 | SourceLocation getExprLoc() const LLVM_READONLY { |
| 131 | OverloadedOperatorKind Operator = getOperator(); |
| 132 | return (Operator < OO_Plus || Operator >= OO_Arrow || |
| 133 | Operator == OO_PlusPlus || Operator == OO_MinusMinus) |
| 134 | ? getBeginLoc() |
| 135 | : getOperatorLoc(); |
| 136 | } |
| 137 | |
| 138 | SourceLocation getBeginLoc() const { return Range.getBegin(); } |
| 139 | SourceLocation getEndLoc() const { return Range.getEnd(); } |
| 140 | SourceRange getSourceRange() const { return Range; } |
| 141 | |
| 142 | static bool classof(const Stmt *T) { |
| 143 | return T->getStmtClass() == CXXOperatorCallExprClass; |
| 144 | } |
| 145 | |
| 146 | |
| 147 | |
| 148 | void setFPFeatures(FPOptions F) { |
| 149 | CXXOperatorCallExprBits.FPFeatures = F.getInt(); |
| 150 | } |
| 151 | FPOptions getFPFeatures() const { |
| 152 | return FPOptions(CXXOperatorCallExprBits.FPFeatures); |
| 153 | } |
| 154 | |
| 155 | |
| 156 | |
| 157 | bool isFPContractableWithinStatement() const { |
| 158 | return getFPFeatures().allowFPContractWithinStatement(); |
| 159 | } |
| 160 | }; |
| 161 | |
| 162 | |
| 163 | |
| 164 | |
| 165 | |
| 166 | |
| 167 | |
| 168 | |
| 169 | |
| 170 | class CXXMemberCallExpr final : public CallExpr { |
| 171 | |
| 172 | |
| 173 | |
| 174 | CXXMemberCallExpr(Expr *Fn, ArrayRef<Expr *> Args, QualType Ty, |
| 175 | ExprValueKind VK, SourceLocation RP, unsigned MinNumArgs); |
| 176 | |
| 177 | CXXMemberCallExpr(unsigned NumArgs, EmptyShell Empty); |
| 178 | |
| 179 | public: |
| 180 | static CXXMemberCallExpr *Create(const ASTContext &Ctx, Expr *Fn, |
| 181 | ArrayRef<Expr *> Args, QualType Ty, |
| 182 | ExprValueKind VK, SourceLocation RP, |
| 183 | unsigned MinNumArgs = 0); |
| 184 | |
| 185 | static CXXMemberCallExpr *CreateEmpty(const ASTContext &Ctx, unsigned NumArgs, |
| 186 | EmptyShell Empty); |
| 187 | |
| 188 | |
| 189 | |
| 190 | |
| 191 | Expr *getImplicitObjectArgument() const; |
| 192 | |
| 193 | |
| 194 | CXXMethodDecl *getMethodDecl() const; |
| 195 | |
| 196 | |
| 197 | |
| 198 | |
| 199 | |
| 200 | |
| 201 | |
| 202 | CXXRecordDecl *getRecordDecl() const; |
| 203 | |
| 204 | SourceLocation getExprLoc() const LLVM_READONLY { |
| 205 | SourceLocation CLoc = getCallee()->getExprLoc(); |
| 206 | if (CLoc.isValid()) |
| 207 | return CLoc; |
| 208 | |
| 209 | return getBeginLoc(); |
| 210 | } |
| 211 | |
| 212 | static bool classof(const Stmt *T) { |
| 213 | return T->getStmtClass() == CXXMemberCallExprClass; |
| 214 | } |
| 215 | }; |
| 216 | |
| 217 | |
| 218 | class CUDAKernelCallExpr final : public CallExpr { |
| 219 | enum { CONFIG, END_PREARG }; |
| 220 | |
| 221 | |
| 222 | |
| 223 | |
| 224 | CUDAKernelCallExpr(Expr *Fn, CallExpr *Config, ArrayRef<Expr *> Args, |
| 225 | QualType Ty, ExprValueKind VK, SourceLocation RP, |
| 226 | unsigned MinNumArgs); |
| 227 | |
| 228 | CUDAKernelCallExpr(unsigned NumArgs, EmptyShell Empty); |
| 229 | |
| 230 | public: |
| 231 | static CUDAKernelCallExpr *Create(const ASTContext &Ctx, Expr *Fn, |
| 232 | CallExpr *Config, ArrayRef<Expr *> Args, |
| 233 | QualType Ty, ExprValueKind VK, |
| 234 | SourceLocation RP, unsigned MinNumArgs = 0); |
| 235 | |
| 236 | static CUDAKernelCallExpr *CreateEmpty(const ASTContext &Ctx, |
| 237 | unsigned NumArgs, EmptyShell Empty); |
| 238 | |
| 239 | const CallExpr *getConfig() const { |
| 240 | return cast_or_null<CallExpr>(getPreArg(CONFIG)); |
| 241 | } |
| 242 | CallExpr *getConfig() { return cast_or_null<CallExpr>(getPreArg(CONFIG)); } |
| 243 | |
| 244 | |
| 245 | |
| 246 | |
| 247 | |
| 248 | void setConfig(CallExpr *E) { |
| 249 | (0) . __assert_fail ("!getConfig() && \"Cannot call setConfig if config is not null\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprCXX.h", 250, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(!getConfig() && |
| 250 | (0) . __assert_fail ("!getConfig() && \"Cannot call setConfig if config is not null\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprCXX.h", 250, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "Cannot call setConfig if config is not null"); |
| 251 | setPreArg(CONFIG, E); |
| 252 | setInstantiationDependent(isInstantiationDependent() || |
| 253 | E->isInstantiationDependent()); |
| 254 | setContainsUnexpandedParameterPack(containsUnexpandedParameterPack() || |
| 255 | E->containsUnexpandedParameterPack()); |
| 256 | } |
| 257 | |
| 258 | static bool classof(const Stmt *T) { |
| 259 | return T->getStmtClass() == CUDAKernelCallExprClass; |
| 260 | } |
| 261 | }; |
| 262 | |
| 263 | |
| 264 | |
| 265 | |
| 266 | |
| 267 | |
| 268 | |
| 269 | class CXXNamedCastExpr : public ExplicitCastExpr { |
| 270 | private: |
| 271 | |
| 272 | SourceLocation Loc; |
| 273 | |
| 274 | |
| 275 | SourceLocation RParenLoc; |
| 276 | |
| 277 | |
| 278 | SourceRange AngleBrackets; |
| 279 | |
| 280 | protected: |
| 281 | friend class ASTStmtReader; |
| 282 | |
| 283 | CXXNamedCastExpr(StmtClass SC, QualType ty, ExprValueKind VK, |
| 284 | CastKind kind, Expr *op, unsigned PathSize, |
| 285 | TypeSourceInfo *writtenTy, SourceLocation l, |
| 286 | SourceLocation RParenLoc, |
| 287 | SourceRange AngleBrackets) |
| 288 | : ExplicitCastExpr(SC, ty, VK, kind, op, PathSize, writtenTy), Loc(l), |
| 289 | RParenLoc(RParenLoc), AngleBrackets(AngleBrackets) {} |
| 290 | |
| 291 | explicit CXXNamedCastExpr(StmtClass SC, EmptyShell Shell, unsigned PathSize) |
| 292 | : ExplicitCastExpr(SC, Shell, PathSize) {} |
| 293 | |
| 294 | public: |
| 295 | const char *getCastName() const; |
| 296 | |
| 297 | |
| 298 | |
| 299 | SourceLocation getOperatorLoc() const { return Loc; } |
| 300 | |
| 301 | |
| 302 | SourceLocation getRParenLoc() const { return RParenLoc; } |
| 303 | |
| 304 | SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; } |
| 305 | SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; } |
| 306 | SourceRange getAngleBrackets() const LLVM_READONLY { return AngleBrackets; } |
| 307 | |
| 308 | static bool classof(const Stmt *T) { |
| 309 | switch (T->getStmtClass()) { |
| 310 | case CXXStaticCastExprClass: |
| 311 | case CXXDynamicCastExprClass: |
| 312 | case CXXReinterpretCastExprClass: |
| 313 | case CXXConstCastExprClass: |
| 314 | return true; |
| 315 | default: |
| 316 | return false; |
| 317 | } |
| 318 | } |
| 319 | }; |
| 320 | |
| 321 | |
| 322 | |
| 323 | |
| 324 | |
| 325 | class CXXStaticCastExpr final |
| 326 | : public CXXNamedCastExpr, |
| 327 | private llvm::TrailingObjects<CXXStaticCastExpr, CXXBaseSpecifier *> { |
| 328 | CXXStaticCastExpr(QualType ty, ExprValueKind vk, CastKind kind, Expr *op, |
| 329 | unsigned pathSize, TypeSourceInfo *writtenTy, |
| 330 | SourceLocation l, SourceLocation RParenLoc, |
| 331 | SourceRange AngleBrackets) |
| 332 | : CXXNamedCastExpr(CXXStaticCastExprClass, ty, vk, kind, op, pathSize, |
| 333 | writtenTy, l, RParenLoc, AngleBrackets) {} |
| 334 | |
| 335 | explicit CXXStaticCastExpr(EmptyShell Empty, unsigned PathSize) |
| 336 | : CXXNamedCastExpr(CXXStaticCastExprClass, Empty, PathSize) {} |
| 337 | |
| 338 | public: |
| 339 | friend class CastExpr; |
| 340 | friend TrailingObjects; |
| 341 | |
| 342 | static CXXStaticCastExpr *Create(const ASTContext &Context, QualType T, |
| 343 | ExprValueKind VK, CastKind K, Expr *Op, |
| 344 | const CXXCastPath *Path, |
| 345 | TypeSourceInfo *Written, SourceLocation L, |
| 346 | SourceLocation RParenLoc, |
| 347 | SourceRange AngleBrackets); |
| 348 | static CXXStaticCastExpr *CreateEmpty(const ASTContext &Context, |
| 349 | unsigned PathSize); |
| 350 | |
| 351 | static bool classof(const Stmt *T) { |
| 352 | return T->getStmtClass() == CXXStaticCastExprClass; |
| 353 | } |
| 354 | }; |
| 355 | |
| 356 | |
| 357 | |
| 358 | |
| 359 | |
| 360 | |
| 361 | class CXXDynamicCastExpr final |
| 362 | : public CXXNamedCastExpr, |
| 363 | private llvm::TrailingObjects<CXXDynamicCastExpr, CXXBaseSpecifier *> { |
| 364 | CXXDynamicCastExpr(QualType ty, ExprValueKind VK, CastKind kind, |
| 365 | Expr *op, unsigned pathSize, TypeSourceInfo *writtenTy, |
| 366 | SourceLocation l, SourceLocation RParenLoc, |
| 367 | SourceRange AngleBrackets) |
| 368 | : CXXNamedCastExpr(CXXDynamicCastExprClass, ty, VK, kind, op, pathSize, |
| 369 | writtenTy, l, RParenLoc, AngleBrackets) {} |
| 370 | |
| 371 | explicit CXXDynamicCastExpr(EmptyShell Empty, unsigned pathSize) |
| 372 | : CXXNamedCastExpr(CXXDynamicCastExprClass, Empty, pathSize) {} |
| 373 | |
| 374 | public: |
| 375 | friend class CastExpr; |
| 376 | friend TrailingObjects; |
| 377 | |
| 378 | static CXXDynamicCastExpr *Create(const ASTContext &Context, QualType T, |
| 379 | ExprValueKind VK, CastKind Kind, Expr *Op, |
| 380 | const CXXCastPath *Path, |
| 381 | TypeSourceInfo *Written, SourceLocation L, |
| 382 | SourceLocation RParenLoc, |
| 383 | SourceRange AngleBrackets); |
| 384 | |
| 385 | static CXXDynamicCastExpr *CreateEmpty(const ASTContext &Context, |
| 386 | unsigned pathSize); |
| 387 | |
| 388 | bool isAlwaysNull() const; |
| 389 | |
| 390 | static bool classof(const Stmt *T) { |
| 391 | return T->getStmtClass() == CXXDynamicCastExprClass; |
| 392 | } |
| 393 | }; |
| 394 | |
| 395 | |
| 396 | |
| 397 | |
| 398 | |
| 399 | |
| 400 | |
| 401 | |
| 402 | |
| 403 | class CXXReinterpretCastExpr final |
| 404 | : public CXXNamedCastExpr, |
| 405 | private llvm::TrailingObjects<CXXReinterpretCastExpr, |
| 406 | CXXBaseSpecifier *> { |
| 407 | CXXReinterpretCastExpr(QualType ty, ExprValueKind vk, CastKind kind, |
| 408 | Expr *op, unsigned pathSize, |
| 409 | TypeSourceInfo *writtenTy, SourceLocation l, |
| 410 | SourceLocation RParenLoc, |
| 411 | SourceRange AngleBrackets) |
| 412 | : CXXNamedCastExpr(CXXReinterpretCastExprClass, ty, vk, kind, op, |
| 413 | pathSize, writtenTy, l, RParenLoc, AngleBrackets) {} |
| 414 | |
| 415 | CXXReinterpretCastExpr(EmptyShell Empty, unsigned pathSize) |
| 416 | : CXXNamedCastExpr(CXXReinterpretCastExprClass, Empty, pathSize) {} |
| 417 | |
| 418 | public: |
| 419 | friend class CastExpr; |
| 420 | friend TrailingObjects; |
| 421 | |
| 422 | static CXXReinterpretCastExpr *Create(const ASTContext &Context, QualType T, |
| 423 | ExprValueKind VK, CastKind Kind, |
| 424 | Expr *Op, const CXXCastPath *Path, |
| 425 | TypeSourceInfo *WrittenTy, SourceLocation L, |
| 426 | SourceLocation RParenLoc, |
| 427 | SourceRange AngleBrackets); |
| 428 | static CXXReinterpretCastExpr *CreateEmpty(const ASTContext &Context, |
| 429 | unsigned pathSize); |
| 430 | |
| 431 | static bool classof(const Stmt *T) { |
| 432 | return T->getStmtClass() == CXXReinterpretCastExprClass; |
| 433 | } |
| 434 | }; |
| 435 | |
| 436 | |
| 437 | |
| 438 | |
| 439 | |
| 440 | |
| 441 | |
| 442 | |
| 443 | class CXXConstCastExpr final |
| 444 | : public CXXNamedCastExpr, |
| 445 | private llvm::TrailingObjects<CXXConstCastExpr, CXXBaseSpecifier *> { |
| 446 | CXXConstCastExpr(QualType ty, ExprValueKind VK, Expr *op, |
| 447 | TypeSourceInfo *writtenTy, SourceLocation l, |
| 448 | SourceLocation RParenLoc, SourceRange AngleBrackets) |
| 449 | : CXXNamedCastExpr(CXXConstCastExprClass, ty, VK, CK_NoOp, op, |
| 450 | 0, writtenTy, l, RParenLoc, AngleBrackets) {} |
| 451 | |
| 452 | explicit CXXConstCastExpr(EmptyShell Empty) |
| 453 | : CXXNamedCastExpr(CXXConstCastExprClass, Empty, 0) {} |
| 454 | |
| 455 | public: |
| 456 | friend class CastExpr; |
| 457 | friend TrailingObjects; |
| 458 | |
| 459 | static CXXConstCastExpr *Create(const ASTContext &Context, QualType T, |
| 460 | ExprValueKind VK, Expr *Op, |
| 461 | TypeSourceInfo *WrittenTy, SourceLocation L, |
| 462 | SourceLocation RParenLoc, |
| 463 | SourceRange AngleBrackets); |
| 464 | static CXXConstCastExpr *CreateEmpty(const ASTContext &Context); |
| 465 | |
| 466 | static bool classof(const Stmt *T) { |
| 467 | return T->getStmtClass() == CXXConstCastExprClass; |
| 468 | } |
| 469 | }; |
| 470 | |
| 471 | |
| 472 | |
| 473 | |
| 474 | |
| 475 | |
| 476 | |
| 477 | |
| 478 | |
| 479 | |
| 480 | class UserDefinedLiteral final : public CallExpr { |
| 481 | friend class ASTStmtReader; |
| 482 | friend class ASTStmtWriter; |
| 483 | |
| 484 | |
| 485 | SourceLocation UDSuffixLoc; |
| 486 | |
| 487 | |
| 488 | |
| 489 | |
| 490 | UserDefinedLiteral(Expr *Fn, ArrayRef<Expr *> Args, QualType Ty, |
| 491 | ExprValueKind VK, SourceLocation LitEndLoc, |
| 492 | SourceLocation SuffixLoc); |
| 493 | |
| 494 | UserDefinedLiteral(unsigned NumArgs, EmptyShell Empty); |
| 495 | |
| 496 | public: |
| 497 | static UserDefinedLiteral *Create(const ASTContext &Ctx, Expr *Fn, |
| 498 | ArrayRef<Expr *> Args, QualType Ty, |
| 499 | ExprValueKind VK, SourceLocation LitEndLoc, |
| 500 | SourceLocation SuffixLoc); |
| 501 | |
| 502 | static UserDefinedLiteral *CreateEmpty(const ASTContext &Ctx, |
| 503 | unsigned NumArgs, EmptyShell Empty); |
| 504 | |
| 505 | |
| 506 | enum LiteralOperatorKind { |
| 507 | |
| 508 | LOK_Raw, |
| 509 | |
| 510 | |
| 511 | LOK_Template, |
| 512 | |
| 513 | |
| 514 | LOK_Integer, |
| 515 | |
| 516 | |
| 517 | LOK_Floating, |
| 518 | |
| 519 | |
| 520 | LOK_String, |
| 521 | |
| 522 | |
| 523 | LOK_Character |
| 524 | }; |
| 525 | |
| 526 | |
| 527 | |
| 528 | LiteralOperatorKind getLiteralOperatorKind() const; |
| 529 | |
| 530 | |
| 531 | |
| 532 | |
| 533 | Expr *getCookedLiteral(); |
| 534 | const Expr *getCookedLiteral() const { |
| 535 | return const_cast<UserDefinedLiteral*>(this)->getCookedLiteral(); |
| 536 | } |
| 537 | |
| 538 | SourceLocation getBeginLoc() const { |
| 539 | if (getLiteralOperatorKind() == LOK_Template) |
| 540 | return getRParenLoc(); |
| 541 | return getArg(0)->getBeginLoc(); |
| 542 | } |
| 543 | |
| 544 | SourceLocation getEndLoc() const { return getRParenLoc(); } |
| 545 | |
| 546 | |
| 547 | |
| 548 | |
| 549 | |
| 550 | SourceLocation getUDSuffixLoc() const { return UDSuffixLoc; } |
| 551 | |
| 552 | |
| 553 | const IdentifierInfo *getUDSuffix() const; |
| 554 | |
| 555 | static bool classof(const Stmt *S) { |
| 556 | return S->getStmtClass() == UserDefinedLiteralClass; |
| 557 | } |
| 558 | }; |
| 559 | |
| 560 | |
| 561 | class CXXBoolLiteralExpr : public Expr { |
| 562 | public: |
| 563 | CXXBoolLiteralExpr(bool Val, QualType Ty, SourceLocation Loc) |
| 564 | : Expr(CXXBoolLiteralExprClass, Ty, VK_RValue, OK_Ordinary, false, false, |
| 565 | false, false) { |
| 566 | CXXBoolLiteralExprBits.Value = Val; |
| 567 | CXXBoolLiteralExprBits.Loc = Loc; |
| 568 | } |
| 569 | |
| 570 | explicit CXXBoolLiteralExpr(EmptyShell Empty) |
| 571 | : Expr(CXXBoolLiteralExprClass, Empty) {} |
| 572 | |
| 573 | bool getValue() const { return CXXBoolLiteralExprBits.Value; } |
| 574 | void setValue(bool V) { CXXBoolLiteralExprBits.Value = V; } |
| 575 | |
| 576 | SourceLocation getBeginLoc() const { return getLocation(); } |
| 577 | SourceLocation getEndLoc() const { return getLocation(); } |
| 578 | |
| 579 | SourceLocation getLocation() const { return CXXBoolLiteralExprBits.Loc; } |
| 580 | void setLocation(SourceLocation L) { CXXBoolLiteralExprBits.Loc = L; } |
| 581 | |
| 582 | static bool classof(const Stmt *T) { |
| 583 | return T->getStmtClass() == CXXBoolLiteralExprClass; |
| 584 | } |
| 585 | |
| 586 | |
| 587 | child_range children() { |
| 588 | return child_range(child_iterator(), child_iterator()); |
| 589 | } |
| 590 | }; |
| 591 | |
| 592 | |
| 593 | |
| 594 | |
| 595 | class CXXNullPtrLiteralExpr : public Expr { |
| 596 | public: |
| 597 | CXXNullPtrLiteralExpr(QualType Ty, SourceLocation Loc) |
| 598 | : Expr(CXXNullPtrLiteralExprClass, Ty, VK_RValue, OK_Ordinary, false, |
| 599 | false, false, false) { |
| 600 | CXXNullPtrLiteralExprBits.Loc = Loc; |
| 601 | } |
| 602 | |
| 603 | explicit CXXNullPtrLiteralExpr(EmptyShell Empty) |
| 604 | : Expr(CXXNullPtrLiteralExprClass, Empty) {} |
| 605 | |
| 606 | SourceLocation getBeginLoc() const { return getLocation(); } |
| 607 | SourceLocation getEndLoc() const { return getLocation(); } |
| 608 | |
| 609 | SourceLocation getLocation() const { return CXXNullPtrLiteralExprBits.Loc; } |
| 610 | void setLocation(SourceLocation L) { CXXNullPtrLiteralExprBits.Loc = L; } |
| 611 | |
| 612 | static bool classof(const Stmt *T) { |
| 613 | return T->getStmtClass() == CXXNullPtrLiteralExprClass; |
| 614 | } |
| 615 | |
| 616 | child_range children() { |
| 617 | return child_range(child_iterator(), child_iterator()); |
| 618 | } |
| 619 | }; |
| 620 | |
| 621 | |
| 622 | |
| 623 | class CXXStdInitializerListExpr : public Expr { |
| 624 | Stmt *SubExpr = nullptr; |
| 625 | |
| 626 | CXXStdInitializerListExpr(EmptyShell Empty) |
| 627 | : Expr(CXXStdInitializerListExprClass, Empty) {} |
| 628 | |
| 629 | public: |
| 630 | friend class ASTReader; |
| 631 | friend class ASTStmtReader; |
| 632 | |
| 633 | CXXStdInitializerListExpr(QualType Ty, Expr *SubExpr) |
| 634 | : Expr(CXXStdInitializerListExprClass, Ty, VK_RValue, OK_Ordinary, |
| 635 | Ty->isDependentType(), SubExpr->isValueDependent(), |
| 636 | SubExpr->isInstantiationDependent(), |
| 637 | SubExpr->containsUnexpandedParameterPack()), |
| 638 | SubExpr(SubExpr) {} |
| 639 | |
| 640 | Expr *getSubExpr() { return static_cast<Expr*>(SubExpr); } |
| 641 | const Expr *getSubExpr() const { return static_cast<const Expr*>(SubExpr); } |
| 642 | |
| 643 | SourceLocation getBeginLoc() const LLVM_READONLY { |
| 644 | return SubExpr->getBeginLoc(); |
| 645 | } |
| 646 | |
| 647 | SourceLocation getEndLoc() const LLVM_READONLY { |
| 648 | return SubExpr->getEndLoc(); |
| 649 | } |
| 650 | |
| 651 | |
| 652 | SourceRange getSourceRange() const LLVM_READONLY { |
| 653 | return SubExpr->getSourceRange(); |
| 654 | } |
| 655 | |
| 656 | static bool classof(const Stmt *S) { |
| 657 | return S->getStmtClass() == CXXStdInitializerListExprClass; |
| 658 | } |
| 659 | |
| 660 | child_range children() { return child_range(&SubExpr, &SubExpr + 1); } |
| 661 | }; |
| 662 | |
| 663 | |
| 664 | |
| 665 | |
| 666 | |
| 667 | |
| 668 | class CXXTypeidExpr : public Expr { |
| 669 | private: |
| 670 | llvm::PointerUnion<Stmt *, TypeSourceInfo *> Operand; |
| 671 | SourceRange Range; |
| 672 | |
| 673 | public: |
| 674 | CXXTypeidExpr(QualType Ty, TypeSourceInfo *Operand, SourceRange R) |
| 675 | : Expr(CXXTypeidExprClass, Ty, VK_LValue, OK_Ordinary, |
| 676 | |
| 677 | false, |
| 678 | |
| 679 | |
| 680 | Operand->getType()->isDependentType(), |
| 681 | Operand->getType()->isInstantiationDependentType(), |
| 682 | Operand->getType()->containsUnexpandedParameterPack()), |
| 683 | Operand(Operand), Range(R) {} |
| 684 | |
| 685 | CXXTypeidExpr(QualType Ty, Expr *Operand, SourceRange R) |
| 686 | : Expr(CXXTypeidExprClass, Ty, VK_LValue, OK_Ordinary, |
| 687 | |
| 688 | false, |
| 689 | |
| 690 | |
| 691 | Operand->isTypeDependent() || Operand->isValueDependent(), |
| 692 | Operand->isInstantiationDependent(), |
| 693 | Operand->containsUnexpandedParameterPack()), |
| 694 | Operand(Operand), Range(R) {} |
| 695 | |
| 696 | CXXTypeidExpr(EmptyShell Empty, bool isExpr) |
| 697 | : Expr(CXXTypeidExprClass, Empty) { |
| 698 | if (isExpr) |
| 699 | Operand = (Expr*)nullptr; |
| 700 | else |
| 701 | Operand = (TypeSourceInfo*)nullptr; |
| 702 | } |
| 703 | |
| 704 | |
| 705 | |
| 706 | bool isPotentiallyEvaluated() const; |
| 707 | |
| 708 | bool isTypeOperand() const { return Operand.is<TypeSourceInfo *>(); } |
| 709 | |
| 710 | |
| 711 | |
| 712 | QualType getTypeOperand(ASTContext &Context) const; |
| 713 | |
| 714 | |
| 715 | TypeSourceInfo *getTypeOperandSourceInfo() const { |
| 716 | (0) . __assert_fail ("isTypeOperand() && \"Cannot call getTypeOperand for typeid(expr)\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprCXX.h", 716, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isTypeOperand() && "Cannot call getTypeOperand for typeid(expr)"); |
| 717 | return Operand.get<TypeSourceInfo *>(); |
| 718 | } |
| 719 | |
| 720 | void setTypeOperandSourceInfo(TypeSourceInfo *TSI) { |
| 721 | (0) . __assert_fail ("isTypeOperand() && \"Cannot call getTypeOperand for typeid(expr)\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprCXX.h", 721, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isTypeOperand() && "Cannot call getTypeOperand for typeid(expr)"); |
| 722 | Operand = TSI; |
| 723 | } |
| 724 | |
| 725 | Expr *getExprOperand() const { |
| 726 | (0) . __assert_fail ("!isTypeOperand() && \"Cannot call getExprOperand for typeid(type)\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprCXX.h", 726, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(!isTypeOperand() && "Cannot call getExprOperand for typeid(type)"); |
| 727 | return static_cast<Expr*>(Operand.get<Stmt *>()); |
| 728 | } |
| 729 | |
| 730 | void setExprOperand(Expr *E) { |
| 731 | (0) . __assert_fail ("!isTypeOperand() && \"Cannot call getExprOperand for typeid(type)\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprCXX.h", 731, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(!isTypeOperand() && "Cannot call getExprOperand for typeid(type)"); |
| 732 | Operand = E; |
| 733 | } |
| 734 | |
| 735 | SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); } |
| 736 | SourceLocation getEndLoc() const LLVM_READONLY { return Range.getEnd(); } |
| 737 | SourceRange getSourceRange() const LLVM_READONLY { return Range; } |
| 738 | void setSourceRange(SourceRange R) { Range = R; } |
| 739 | |
| 740 | static bool classof(const Stmt *T) { |
| 741 | return T->getStmtClass() == CXXTypeidExprClass; |
| 742 | } |
| 743 | |
| 744 | |
| 745 | child_range children() { |
| 746 | if (isTypeOperand()) |
| 747 | return child_range(child_iterator(), child_iterator()); |
| 748 | auto **begin = reinterpret_cast<Stmt **>(&Operand); |
| 749 | return child_range(begin, begin + 1); |
| 750 | } |
| 751 | }; |
| 752 | |
| 753 | |
| 754 | |
| 755 | |
| 756 | |
| 757 | |
| 758 | class MSPropertyRefExpr : public Expr { |
| 759 | Expr *BaseExpr; |
| 760 | MSPropertyDecl *TheDecl; |
| 761 | SourceLocation MemberLoc; |
| 762 | bool IsArrow; |
| 763 | NestedNameSpecifierLoc QualifierLoc; |
| 764 | |
| 765 | public: |
| 766 | friend class ASTStmtReader; |
| 767 | |
| 768 | MSPropertyRefExpr(Expr *baseExpr, MSPropertyDecl *decl, bool isArrow, |
| 769 | QualType ty, ExprValueKind VK, |
| 770 | NestedNameSpecifierLoc qualifierLoc, |
| 771 | SourceLocation nameLoc) |
| 772 | : Expr(MSPropertyRefExprClass, ty, VK, OK_Ordinary, |
| 773 | false, baseExpr->isValueDependent(), |
| 774 | baseExpr->isInstantiationDependent(), |
| 775 | baseExpr->containsUnexpandedParameterPack()), |
| 776 | BaseExpr(baseExpr), TheDecl(decl), |
| 777 | MemberLoc(nameLoc), IsArrow(isArrow), |
| 778 | QualifierLoc(qualifierLoc) {} |
| 779 | |
| 780 | MSPropertyRefExpr(EmptyShell Empty) : Expr(MSPropertyRefExprClass, Empty) {} |
| 781 | |
| 782 | SourceRange getSourceRange() const LLVM_READONLY { |
| 783 | return SourceRange(getBeginLoc(), getEndLoc()); |
| 784 | } |
| 785 | |
| 786 | bool isImplicitAccess() const { |
| 787 | return getBaseExpr() && getBaseExpr()->isImplicitCXXThis(); |
| 788 | } |
| 789 | |
| 790 | SourceLocation getBeginLoc() const { |
| 791 | if (!isImplicitAccess()) |
| 792 | return BaseExpr->getBeginLoc(); |
| 793 | else if (QualifierLoc) |
| 794 | return QualifierLoc.getBeginLoc(); |
| 795 | else |
| 796 | return MemberLoc; |
| 797 | } |
| 798 | |
| 799 | SourceLocation getEndLoc() const { return getMemberLoc(); } |
| 800 | |
| 801 | child_range children() { |
| 802 | return child_range((Stmt**)&BaseExpr, (Stmt**)&BaseExpr + 1); |
| 803 | } |
| 804 | |
| 805 | static bool classof(const Stmt *T) { |
| 806 | return T->getStmtClass() == MSPropertyRefExprClass; |
| 807 | } |
| 808 | |
| 809 | Expr *getBaseExpr() const { return BaseExpr; } |
| 810 | MSPropertyDecl *getPropertyDecl() const { return TheDecl; } |
| 811 | bool isArrow() const { return IsArrow; } |
| 812 | SourceLocation getMemberLoc() const { return MemberLoc; } |
| 813 | NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; } |
| 814 | }; |
| 815 | |
| 816 | |
| 817 | |
| 818 | |
| 819 | |
| 820 | |
| 821 | |
| 822 | |
| 823 | |
| 824 | |
| 825 | |
| 826 | |
| 827 | class MSPropertySubscriptExpr : public Expr { |
| 828 | friend class ASTStmtReader; |
| 829 | |
| 830 | enum { BASE_EXPR, IDX_EXPR, NUM_SUBEXPRS = 2 }; |
| 831 | |
| 832 | Stmt *SubExprs[NUM_SUBEXPRS]; |
| 833 | SourceLocation RBracketLoc; |
| 834 | |
| 835 | void setBase(Expr *Base) { SubExprs[BASE_EXPR] = Base; } |
| 836 | void setIdx(Expr *Idx) { SubExprs[IDX_EXPR] = Idx; } |
| 837 | |
| 838 | public: |
| 839 | MSPropertySubscriptExpr(Expr *Base, Expr *Idx, QualType Ty, ExprValueKind VK, |
| 840 | ExprObjectKind OK, SourceLocation RBracketLoc) |
| 841 | : Expr(MSPropertySubscriptExprClass, Ty, VK, OK, Idx->isTypeDependent(), |
| 842 | Idx->isValueDependent(), Idx->isInstantiationDependent(), |
| 843 | Idx->containsUnexpandedParameterPack()), |
| 844 | RBracketLoc(RBracketLoc) { |
| 845 | SubExprs[BASE_EXPR] = Base; |
| 846 | SubExprs[IDX_EXPR] = Idx; |
| 847 | } |
| 848 | |
| 849 | |
| 850 | explicit MSPropertySubscriptExpr(EmptyShell Shell) |
| 851 | : Expr(MSPropertySubscriptExprClass, Shell) {} |
| 852 | |
| 853 | Expr *getBase() { return cast<Expr>(SubExprs[BASE_EXPR]); } |
| 854 | const Expr *getBase() const { return cast<Expr>(SubExprs[BASE_EXPR]); } |
| 855 | |
| 856 | Expr *getIdx() { return cast<Expr>(SubExprs[IDX_EXPR]); } |
| 857 | const Expr *getIdx() const { return cast<Expr>(SubExprs[IDX_EXPR]); } |
| 858 | |
| 859 | SourceLocation getBeginLoc() const LLVM_READONLY { |
| 860 | return getBase()->getBeginLoc(); |
| 861 | } |
| 862 | |
| 863 | SourceLocation getEndLoc() const LLVM_READONLY { return RBracketLoc; } |
| 864 | |
| 865 | SourceLocation getRBracketLoc() const { return RBracketLoc; } |
| 866 | void setRBracketLoc(SourceLocation L) { RBracketLoc = L; } |
| 867 | |
| 868 | SourceLocation getExprLoc() const LLVM_READONLY { |
| 869 | return getBase()->getExprLoc(); |
| 870 | } |
| 871 | |
| 872 | static bool classof(const Stmt *T) { |
| 873 | return T->getStmtClass() == MSPropertySubscriptExprClass; |
| 874 | } |
| 875 | |
| 876 | |
| 877 | child_range children() { |
| 878 | return child_range(&SubExprs[0], &SubExprs[0] + NUM_SUBEXPRS); |
| 879 | } |
| 880 | }; |
| 881 | |
| 882 | |
| 883 | |
| 884 | |
| 885 | |
| 886 | class CXXUuidofExpr : public Expr { |
| 887 | private: |
| 888 | llvm::PointerUnion<Stmt *, TypeSourceInfo *> Operand; |
| 889 | StringRef UuidStr; |
| 890 | SourceRange Range; |
| 891 | |
| 892 | public: |
| 893 | CXXUuidofExpr(QualType Ty, TypeSourceInfo *Operand, StringRef UuidStr, |
| 894 | SourceRange R) |
| 895 | : Expr(CXXUuidofExprClass, Ty, VK_LValue, OK_Ordinary, false, |
| 896 | Operand->getType()->isDependentType(), |
| 897 | Operand->getType()->isInstantiationDependentType(), |
| 898 | Operand->getType()->containsUnexpandedParameterPack()), |
| 899 | Operand(Operand), UuidStr(UuidStr), Range(R) {} |
| 900 | |
| 901 | CXXUuidofExpr(QualType Ty, Expr *Operand, StringRef UuidStr, SourceRange R) |
| 902 | : Expr(CXXUuidofExprClass, Ty, VK_LValue, OK_Ordinary, false, |
| 903 | Operand->isTypeDependent(), Operand->isInstantiationDependent(), |
| 904 | Operand->containsUnexpandedParameterPack()), |
| 905 | Operand(Operand), UuidStr(UuidStr), Range(R) {} |
| 906 | |
| 907 | CXXUuidofExpr(EmptyShell Empty, bool isExpr) |
| 908 | : Expr(CXXUuidofExprClass, Empty) { |
| 909 | if (isExpr) |
| 910 | Operand = (Expr*)nullptr; |
| 911 | else |
| 912 | Operand = (TypeSourceInfo*)nullptr; |
| 913 | } |
| 914 | |
| 915 | bool isTypeOperand() const { return Operand.is<TypeSourceInfo *>(); } |
| 916 | |
| 917 | |
| 918 | |
| 919 | QualType getTypeOperand(ASTContext &Context) const; |
| 920 | |
| 921 | |
| 922 | TypeSourceInfo *getTypeOperandSourceInfo() const { |
| 923 | (0) . __assert_fail ("isTypeOperand() && \"Cannot call getTypeOperand for __uuidof(expr)\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprCXX.h", 923, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isTypeOperand() && "Cannot call getTypeOperand for __uuidof(expr)"); |
| 924 | return Operand.get<TypeSourceInfo *>(); |
| 925 | } |
| 926 | |
| 927 | void setTypeOperandSourceInfo(TypeSourceInfo *TSI) { |
| 928 | (0) . __assert_fail ("isTypeOperand() && \"Cannot call getTypeOperand for __uuidof(expr)\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprCXX.h", 928, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isTypeOperand() && "Cannot call getTypeOperand for __uuidof(expr)"); |
| 929 | Operand = TSI; |
| 930 | } |
| 931 | |
| 932 | Expr *getExprOperand() const { |
| 933 | (0) . __assert_fail ("!isTypeOperand() && \"Cannot call getExprOperand for __uuidof(type)\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprCXX.h", 933, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(!isTypeOperand() && "Cannot call getExprOperand for __uuidof(type)"); |
| 934 | return static_cast<Expr*>(Operand.get<Stmt *>()); |
| 935 | } |
| 936 | |
| 937 | void setExprOperand(Expr *E) { |
| 938 | (0) . __assert_fail ("!isTypeOperand() && \"Cannot call getExprOperand for __uuidof(type)\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprCXX.h", 938, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(!isTypeOperand() && "Cannot call getExprOperand for __uuidof(type)"); |
| 939 | Operand = E; |
| 940 | } |
| 941 | |
| 942 | void setUuidStr(StringRef US) { UuidStr = US; } |
| 943 | StringRef getUuidStr() const { return UuidStr; } |
| 944 | |
| 945 | SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); } |
| 946 | SourceLocation getEndLoc() const LLVM_READONLY { return Range.getEnd(); } |
| 947 | SourceRange getSourceRange() const LLVM_READONLY { return Range; } |
| 948 | void setSourceRange(SourceRange R) { Range = R; } |
| 949 | |
| 950 | static bool classof(const Stmt *T) { |
| 951 | return T->getStmtClass() == CXXUuidofExprClass; |
| 952 | } |
| 953 | |
| 954 | |
| 955 | child_range children() { |
| 956 | if (isTypeOperand()) |
| 957 | return child_range(child_iterator(), child_iterator()); |
| 958 | auto **begin = reinterpret_cast<Stmt **>(&Operand); |
| 959 | return child_range(begin, begin + 1); |
| 960 | } |
| 961 | }; |
| 962 | |
| 963 | |
| 964 | |
| 965 | |
| 966 | |
| 967 | |
| 968 | |
| 969 | |
| 970 | |
| 971 | |
| 972 | |
| 973 | |
| 974 | |
| 975 | class CXXThisExpr : public Expr { |
| 976 | public: |
| 977 | CXXThisExpr(SourceLocation L, QualType Ty, bool IsImplicit) |
| 978 | : Expr(CXXThisExprClass, Ty, VK_RValue, OK_Ordinary, |
| 979 | |
| 980 | |
| 981 | Ty->isDependentType(), Ty->isDependentType(), |
| 982 | Ty->isInstantiationDependentType(), |
| 983 | ) { |
| 984 | CXXThisExprBits.IsImplicit = IsImplicit; |
| 985 | CXXThisExprBits.Loc = L; |
| 986 | } |
| 987 | |
| 988 | CXXThisExpr(EmptyShell Empty) : Expr(CXXThisExprClass, Empty) {} |
| 989 | |
| 990 | SourceLocation getLocation() const { return CXXThisExprBits.Loc; } |
| 991 | void setLocation(SourceLocation L) { CXXThisExprBits.Loc = L; } |
| 992 | |
| 993 | SourceLocation getBeginLoc() const { return getLocation(); } |
| 994 | SourceLocation getEndLoc() const { return getLocation(); } |
| 995 | |
| 996 | bool isImplicit() const { return CXXThisExprBits.IsImplicit; } |
| 997 | void setImplicit(bool I) { CXXThisExprBits.IsImplicit = I; } |
| 998 | |
| 999 | static bool classof(const Stmt *T) { |
| 1000 | return T->getStmtClass() == CXXThisExprClass; |
| 1001 | } |
| 1002 | |
| 1003 | |
| 1004 | child_range children() { |
| 1005 | return child_range(child_iterator(), child_iterator()); |
| 1006 | } |
| 1007 | }; |
| 1008 | |
| 1009 | |
| 1010 | |
| 1011 | |
| 1012 | |
| 1013 | |
| 1014 | class CXXThrowExpr : public Expr { |
| 1015 | friend class ASTStmtReader; |
| 1016 | |
| 1017 | |
| 1018 | Stmt *Operand; |
| 1019 | |
| 1020 | public: |
| 1021 | |
| 1022 | |
| 1023 | |
| 1024 | |
| 1025 | CXXThrowExpr(Expr *Operand, QualType Ty, SourceLocation Loc, |
| 1026 | bool IsThrownVariableInScope) |
| 1027 | : Expr(CXXThrowExprClass, Ty, VK_RValue, OK_Ordinary, false, false, |
| 1028 | Operand && Operand->isInstantiationDependent(), |
| 1029 | Operand && Operand->containsUnexpandedParameterPack()), |
| 1030 | Operand(Operand) { |
| 1031 | CXXThrowExprBits.ThrowLoc = Loc; |
| 1032 | CXXThrowExprBits.IsThrownVariableInScope = IsThrownVariableInScope; |
| 1033 | } |
| 1034 | CXXThrowExpr(EmptyShell Empty) : Expr(CXXThrowExprClass, Empty) {} |
| 1035 | |
| 1036 | const Expr *getSubExpr() const { return cast_or_null<Expr>(Operand); } |
| 1037 | Expr *getSubExpr() { return cast_or_null<Expr>(Operand); } |
| 1038 | |
| 1039 | SourceLocation getThrowLoc() const { return CXXThrowExprBits.ThrowLoc; } |
| 1040 | |
| 1041 | |
| 1042 | |
| 1043 | |
| 1044 | |
| 1045 | |
| 1046 | bool isThrownVariableInScope() const { |
| 1047 | return CXXThrowExprBits.IsThrownVariableInScope; |
| 1048 | } |
| 1049 | |
| 1050 | SourceLocation getBeginLoc() const { return getThrowLoc(); } |
| 1051 | SourceLocation getEndLoc() const LLVM_READONLY { |
| 1052 | if (!getSubExpr()) |
| 1053 | return getThrowLoc(); |
| 1054 | return getSubExpr()->getEndLoc(); |
| 1055 | } |
| 1056 | |
| 1057 | static bool classof(const Stmt *T) { |
| 1058 | return T->getStmtClass() == CXXThrowExprClass; |
| 1059 | } |
| 1060 | |
| 1061 | |
| 1062 | child_range children() { |
| 1063 | return child_range(&Operand, Operand ? &Operand + 1 : &Operand); |
| 1064 | } |
| 1065 | }; |
| 1066 | |
| 1067 | |
| 1068 | |
| 1069 | |
| 1070 | |
| 1071 | |
| 1072 | class CXXDefaultArgExpr final : public Expr { |
| 1073 | friend class ASTStmtReader; |
| 1074 | |
| 1075 | |
| 1076 | ParmVarDecl *Param; |
| 1077 | |
| 1078 | CXXDefaultArgExpr(StmtClass SC, SourceLocation Loc, ParmVarDecl *Param) |
| 1079 | : Expr(SC, |
| 1080 | Param->hasUnparsedDefaultArg() |
| 1081 | ? Param->getType().getNonReferenceType() |
| 1082 | : Param->getDefaultArg()->getType(), |
| 1083 | Param->getDefaultArg()->getValueKind(), |
| 1084 | Param->getDefaultArg()->getObjectKind(), false, false, false, |
| 1085 | false), |
| 1086 | Param(Param) { |
| 1087 | CXXDefaultArgExprBits.Loc = Loc; |
| 1088 | } |
| 1089 | |
| 1090 | public: |
| 1091 | CXXDefaultArgExpr(EmptyShell Empty) : Expr(CXXDefaultArgExprClass, Empty) {} |
| 1092 | |
| 1093 | |
| 1094 | |
| 1095 | static CXXDefaultArgExpr *Create(const ASTContext &C, SourceLocation Loc, |
| 1096 | ParmVarDecl *Param) { |
| 1097 | return new (C) CXXDefaultArgExpr(CXXDefaultArgExprClass, Loc, Param); |
| 1098 | } |
| 1099 | |
| 1100 | |
| 1101 | const ParmVarDecl *getParam() const { return Param; } |
| 1102 | ParmVarDecl *getParam() { return Param; } |
| 1103 | |
| 1104 | |
| 1105 | const Expr *getExpr() const { return getParam()->getDefaultArg(); } |
| 1106 | Expr *getExpr() { return getParam()->getDefaultArg(); } |
| 1107 | |
| 1108 | |
| 1109 | SourceLocation getUsedLocation() const { return CXXDefaultArgExprBits.Loc; } |
| 1110 | |
| 1111 | |
| 1112 | |
| 1113 | SourceLocation getBeginLoc() const { return SourceLocation(); } |
| 1114 | SourceLocation getEndLoc() const { return SourceLocation(); } |
| 1115 | |
| 1116 | SourceLocation getExprLoc() const { return getUsedLocation(); } |
| 1117 | |
| 1118 | static bool classof(const Stmt *T) { |
| 1119 | return T->getStmtClass() == CXXDefaultArgExprClass; |
| 1120 | } |
| 1121 | |
| 1122 | |
| 1123 | child_range children() { |
| 1124 | return child_range(child_iterator(), child_iterator()); |
| 1125 | } |
| 1126 | }; |
| 1127 | |
| 1128 | |
| 1129 | |
| 1130 | |
| 1131 | |
| 1132 | |
| 1133 | |
| 1134 | |
| 1135 | |
| 1136 | class CXXDefaultInitExpr : public Expr { |
| 1137 | friend class ASTReader; |
| 1138 | friend class ASTStmtReader; |
| 1139 | |
| 1140 | |
| 1141 | FieldDecl *Field; |
| 1142 | |
| 1143 | CXXDefaultInitExpr(const ASTContext &Ctx, SourceLocation Loc, |
| 1144 | FieldDecl *Field, QualType Ty); |
| 1145 | |
| 1146 | CXXDefaultInitExpr(EmptyShell Empty) : Expr(CXXDefaultInitExprClass, Empty) {} |
| 1147 | |
| 1148 | public: |
| 1149 | |
| 1150 | |
| 1151 | static CXXDefaultInitExpr *Create(const ASTContext &Ctx, SourceLocation Loc, |
| 1152 | FieldDecl *Field) { |
| 1153 | return new (Ctx) CXXDefaultInitExpr(Ctx, Loc, Field, Field->getType()); |
| 1154 | } |
| 1155 | |
| 1156 | |
| 1157 | FieldDecl *getField() { return Field; } |
| 1158 | const FieldDecl *getField() const { return Field; } |
| 1159 | |
| 1160 | |
| 1161 | const Expr *getExpr() const { |
| 1162 | (0) . __assert_fail ("Field->getInClassInitializer() && \"initializer hasn't been parsed\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprCXX.h", 1162, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(Field->getInClassInitializer() && "initializer hasn't been parsed"); |
| 1163 | return Field->getInClassInitializer(); |
| 1164 | } |
| 1165 | Expr *getExpr() { |
| 1166 | (0) . __assert_fail ("Field->getInClassInitializer() && \"initializer hasn't been parsed\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprCXX.h", 1166, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(Field->getInClassInitializer() && "initializer hasn't been parsed"); |
| 1167 | return Field->getInClassInitializer(); |
| 1168 | } |
| 1169 | |
| 1170 | SourceLocation getBeginLoc() const { return CXXDefaultInitExprBits.Loc; } |
| 1171 | SourceLocation getEndLoc() const { return CXXDefaultInitExprBits.Loc; } |
| 1172 | |
| 1173 | static bool classof(const Stmt *T) { |
| 1174 | return T->getStmtClass() == CXXDefaultInitExprClass; |
| 1175 | } |
| 1176 | |
| 1177 | |
| 1178 | child_range children() { |
| 1179 | return child_range(child_iterator(), child_iterator()); |
| 1180 | } |
| 1181 | }; |
| 1182 | |
| 1183 | |
| 1184 | class CXXTemporary { |
| 1185 | |
| 1186 | const CXXDestructorDecl *Destructor; |
| 1187 | |
| 1188 | explicit CXXTemporary(const CXXDestructorDecl *destructor) |
| 1189 | : Destructor(destructor) {} |
| 1190 | |
| 1191 | public: |
| 1192 | static CXXTemporary *Create(const ASTContext &C, |
| 1193 | const CXXDestructorDecl *Destructor); |
| 1194 | |
| 1195 | const CXXDestructorDecl *getDestructor() const { return Destructor; } |
| 1196 | |
| 1197 | void setDestructor(const CXXDestructorDecl *Dtor) { |
| 1198 | Destructor = Dtor; |
| 1199 | } |
| 1200 | }; |
| 1201 | |
| 1202 | |
| 1203 | |
| 1204 | |
| 1205 | |
| 1206 | |
| 1207 | |
| 1208 | |
| 1209 | |
| 1210 | |
| 1211 | |
| 1212 | |
| 1213 | |
| 1214 | |
| 1215 | |
| 1216 | class CXXBindTemporaryExpr : public Expr { |
| 1217 | CXXTemporary *Temp = nullptr; |
| 1218 | Stmt *SubExpr = nullptr; |
| 1219 | |
| 1220 | CXXBindTemporaryExpr(CXXTemporary *temp, Expr* SubExpr) |
| 1221 | : Expr(CXXBindTemporaryExprClass, SubExpr->getType(), |
| 1222 | VK_RValue, OK_Ordinary, SubExpr->isTypeDependent(), |
| 1223 | SubExpr->isValueDependent(), |
| 1224 | SubExpr->isInstantiationDependent(), |
| 1225 | SubExpr->containsUnexpandedParameterPack()), |
| 1226 | Temp(temp), SubExpr(SubExpr) {} |
| 1227 | |
| 1228 | public: |
| 1229 | CXXBindTemporaryExpr(EmptyShell Empty) |
| 1230 | : Expr(CXXBindTemporaryExprClass, Empty) {} |
| 1231 | |
| 1232 | static CXXBindTemporaryExpr *Create(const ASTContext &C, CXXTemporary *Temp, |
| 1233 | Expr* SubExpr); |
| 1234 | |
| 1235 | CXXTemporary *getTemporary() { return Temp; } |
| 1236 | const CXXTemporary *getTemporary() const { return Temp; } |
| 1237 | void setTemporary(CXXTemporary *T) { Temp = T; } |
| 1238 | |
| 1239 | const Expr *getSubExpr() const { return cast<Expr>(SubExpr); } |
| 1240 | Expr *getSubExpr() { return cast<Expr>(SubExpr); } |
| 1241 | void setSubExpr(Expr *E) { SubExpr = E; } |
| 1242 | |
| 1243 | SourceLocation getBeginLoc() const LLVM_READONLY { |
| 1244 | return SubExpr->getBeginLoc(); |
| 1245 | } |
| 1246 | |
| 1247 | SourceLocation getEndLoc() const LLVM_READONLY { |
| 1248 | return SubExpr->getEndLoc(); |
| 1249 | } |
| 1250 | |
| 1251 | |
| 1252 | static bool classof(const Stmt *T) { |
| 1253 | return T->getStmtClass() == CXXBindTemporaryExprClass; |
| 1254 | } |
| 1255 | |
| 1256 | |
| 1257 | child_range children() { return child_range(&SubExpr, &SubExpr + 1); } |
| 1258 | }; |
| 1259 | |
| 1260 | |
| 1261 | class CXXConstructExpr : public Expr { |
| 1262 | friend class ASTStmtReader; |
| 1263 | |
| 1264 | public: |
| 1265 | enum ConstructionKind { |
| 1266 | CK_Complete, |
| 1267 | CK_NonVirtualBase, |
| 1268 | CK_VirtualBase, |
| 1269 | CK_Delegating |
| 1270 | }; |
| 1271 | |
| 1272 | private: |
| 1273 | |
| 1274 | CXXConstructorDecl *Constructor; |
| 1275 | |
| 1276 | SourceRange ParenOrBraceRange; |
| 1277 | |
| 1278 | |
| 1279 | unsigned NumArgs; |
| 1280 | |
| 1281 | |
| 1282 | |
| 1283 | |
| 1284 | |
| 1285 | |
| 1286 | |
| 1287 | |
| 1288 | |
| 1289 | |
| 1290 | |
| 1291 | |
| 1292 | |
| 1293 | |
| 1294 | |
| 1295 | |
| 1296 | |
| 1297 | inline Stmt **getTrailingArgs(); |
| 1298 | const Stmt *const *getTrailingArgs() const { |
| 1299 | return const_cast<CXXConstructExpr *>(this)->getTrailingArgs(); |
| 1300 | } |
| 1301 | |
| 1302 | protected: |
| 1303 | |
| 1304 | CXXConstructExpr(StmtClass SC, QualType Ty, SourceLocation Loc, |
| 1305 | CXXConstructorDecl *Ctor, bool Elidable, |
| 1306 | ArrayRef<Expr *> Args, bool HadMultipleCandidates, |
| 1307 | bool ListInitialization, bool StdInitListInitialization, |
| 1308 | bool ZeroInitialization, ConstructionKind ConstructKind, |
| 1309 | SourceRange ParenOrBraceRange); |
| 1310 | |
| 1311 | |
| 1312 | CXXConstructExpr(StmtClass SC, EmptyShell Empty, unsigned NumArgs); |
| 1313 | |
| 1314 | |
| 1315 | |
| 1316 | static unsigned sizeOfTrailingObjects(unsigned NumArgs) { |
| 1317 | return NumArgs * sizeof(Stmt *); |
| 1318 | } |
| 1319 | |
| 1320 | public: |
| 1321 | |
| 1322 | static CXXConstructExpr * |
| 1323 | Create(const ASTContext &Ctx, QualType Ty, SourceLocation Loc, |
| 1324 | CXXConstructorDecl *Ctor, bool Elidable, ArrayRef<Expr *> Args, |
| 1325 | bool HadMultipleCandidates, bool ListInitialization, |
| 1326 | bool StdInitListInitialization, bool ZeroInitialization, |
| 1327 | ConstructionKind ConstructKind, SourceRange ParenOrBraceRange); |
| 1328 | |
| 1329 | |
| 1330 | static CXXConstructExpr *CreateEmpty(const ASTContext &Ctx, unsigned NumArgs); |
| 1331 | |
| 1332 | |
| 1333 | CXXConstructorDecl *getConstructor() const { return Constructor; } |
| 1334 | |
| 1335 | SourceLocation getLocation() const { return CXXConstructExprBits.Loc; } |
| 1336 | void setLocation(SourceLocation Loc) { CXXConstructExprBits.Loc = Loc; } |
| 1337 | |
| 1338 | |
| 1339 | bool isElidable() const { return CXXConstructExprBits.Elidable; } |
| 1340 | void setElidable(bool E) { CXXConstructExprBits.Elidable = E; } |
| 1341 | |
| 1342 | |
| 1343 | |
| 1344 | bool hadMultipleCandidates() const { |
| 1345 | return CXXConstructExprBits.HadMultipleCandidates; |
| 1346 | } |
| 1347 | void setHadMultipleCandidates(bool V) { |
| 1348 | CXXConstructExprBits.HadMultipleCandidates = V; |
| 1349 | } |
| 1350 | |
| 1351 | |
| 1352 | bool isListInitialization() const { |
| 1353 | return CXXConstructExprBits.ListInitialization; |
| 1354 | } |
| 1355 | void setListInitialization(bool V) { |
| 1356 | CXXConstructExprBits.ListInitialization = V; |
| 1357 | } |
| 1358 | |
| 1359 | |
| 1360 | |
| 1361 | |
| 1362 | |
| 1363 | bool isStdInitListInitialization() const { |
| 1364 | return CXXConstructExprBits.StdInitListInitialization; |
| 1365 | } |
| 1366 | void setStdInitListInitialization(bool V) { |
| 1367 | CXXConstructExprBits.StdInitListInitialization = V; |
| 1368 | } |
| 1369 | |
| 1370 | |
| 1371 | |
| 1372 | bool requiresZeroInitialization() const { |
| 1373 | return CXXConstructExprBits.ZeroInitialization; |
| 1374 | } |
| 1375 | void setRequiresZeroInitialization(bool ZeroInit) { |
| 1376 | CXXConstructExprBits.ZeroInitialization = ZeroInit; |
| 1377 | } |
| 1378 | |
| 1379 | |
| 1380 | |
| 1381 | ConstructionKind getConstructionKind() const { |
| 1382 | return static_cast<ConstructionKind>(CXXConstructExprBits.ConstructionKind); |
| 1383 | } |
| 1384 | void setConstructionKind(ConstructionKind CK) { |
| 1385 | CXXConstructExprBits.ConstructionKind = CK; |
| 1386 | } |
| 1387 | |
| 1388 | using arg_iterator = ExprIterator; |
| 1389 | using const_arg_iterator = ConstExprIterator; |
| 1390 | using arg_range = llvm::iterator_range<arg_iterator>; |
| 1391 | using const_arg_range = llvm::iterator_range<const_arg_iterator>; |
| 1392 | |
| 1393 | arg_range arguments() { return arg_range(arg_begin(), arg_end()); } |
| 1394 | const_arg_range arguments() const { |
| 1395 | return const_arg_range(arg_begin(), arg_end()); |
| 1396 | } |
| 1397 | |
| 1398 | arg_iterator arg_begin() { return getTrailingArgs(); } |
| 1399 | arg_iterator arg_end() { return arg_begin() + getNumArgs(); } |
| 1400 | const_arg_iterator arg_begin() const { return getTrailingArgs(); } |
| 1401 | const_arg_iterator arg_end() const { return arg_begin() + getNumArgs(); } |
| 1402 | |
| 1403 | Expr **getArgs() { return reinterpret_cast<Expr **>(getTrailingArgs()); } |
| 1404 | const Expr *const *getArgs() const { |
| 1405 | return reinterpret_cast<const Expr *const *>(getTrailingArgs()); |
| 1406 | } |
| 1407 | |
| 1408 | |
| 1409 | unsigned getNumArgs() const { return NumArgs; } |
| 1410 | |
| 1411 | |
| 1412 | Expr *getArg(unsigned Arg) { |
| 1413 | (0) . __assert_fail ("Arg < getNumArgs() && \"Arg access out of range!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprCXX.h", 1413, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(Arg < getNumArgs() && "Arg access out of range!"); |
| 1414 | return getArgs()[Arg]; |
| 1415 | } |
| 1416 | const Expr *getArg(unsigned Arg) const { |
| 1417 | (0) . __assert_fail ("Arg < getNumArgs() && \"Arg access out of range!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprCXX.h", 1417, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(Arg < getNumArgs() && "Arg access out of range!"); |
| 1418 | return getArgs()[Arg]; |
| 1419 | } |
| 1420 | |
| 1421 | |
| 1422 | void setArg(unsigned Arg, Expr *ArgExpr) { |
| 1423 | (0) . __assert_fail ("Arg < getNumArgs() && \"Arg access out of range!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprCXX.h", 1423, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(Arg < getNumArgs() && "Arg access out of range!"); |
| 1424 | getArgs()[Arg] = ArgExpr; |
| 1425 | } |
| 1426 | |
| 1427 | SourceLocation getBeginLoc() const LLVM_READONLY; |
| 1428 | SourceLocation getEndLoc() const LLVM_READONLY; |
| 1429 | SourceRange getParenOrBraceRange() const { return ParenOrBraceRange; } |
| 1430 | void setParenOrBraceRange(SourceRange Range) { ParenOrBraceRange = Range; } |
| 1431 | |
| 1432 | static bool classof(const Stmt *T) { |
| 1433 | return T->getStmtClass() == CXXConstructExprClass || |
| 1434 | T->getStmtClass() == CXXTemporaryObjectExprClass; |
| 1435 | } |
| 1436 | |
| 1437 | |
| 1438 | child_range children() { |
| 1439 | return child_range(getTrailingArgs(), getTrailingArgs() + getNumArgs()); |
| 1440 | } |
| 1441 | }; |
| 1442 | |
| 1443 | |
| 1444 | |
| 1445 | |
| 1446 | |
| 1447 | class CXXInheritedCtorInitExpr : public Expr { |
| 1448 | private: |
| 1449 | CXXConstructorDecl *Constructor = nullptr; |
| 1450 | |
| 1451 | |
| 1452 | SourceLocation Loc; |
| 1453 | |
| 1454 | |
| 1455 | unsigned ConstructsVirtualBase : 1; |
| 1456 | |
| 1457 | |
| 1458 | |
| 1459 | unsigned InheritedFromVirtualBase : 1; |
| 1460 | |
| 1461 | public: |
| 1462 | friend class ASTStmtReader; |
| 1463 | |
| 1464 | |
| 1465 | CXXInheritedCtorInitExpr(SourceLocation Loc, QualType T, |
| 1466 | CXXConstructorDecl *Ctor, bool ConstructsVirtualBase, |
| 1467 | bool InheritedFromVirtualBase) |
| 1468 | : Expr(CXXInheritedCtorInitExprClass, T, VK_RValue, OK_Ordinary, false, |
| 1469 | false, false, false), |
| 1470 | Constructor(Ctor), Loc(Loc), |
| 1471 | ConstructsVirtualBase(ConstructsVirtualBase), |
| 1472 | InheritedFromVirtualBase(InheritedFromVirtualBase) { |
| 1473 | isDependentType()", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprCXX.h", 1473, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(!T->isDependentType()); |
| 1474 | } |
| 1475 | |
| 1476 | |
| 1477 | explicit CXXInheritedCtorInitExpr(EmptyShell Empty) |
| 1478 | : Expr(CXXInheritedCtorInitExprClass, Empty), |
| 1479 | ConstructsVirtualBase(false), InheritedFromVirtualBase(false) {} |
| 1480 | |
| 1481 | |
| 1482 | CXXConstructorDecl *getConstructor() const { return Constructor; } |
| 1483 | |
| 1484 | |
| 1485 | |
| 1486 | bool constructsVBase() const { return ConstructsVirtualBase; } |
| 1487 | CXXConstructExpr::ConstructionKind getConstructionKind() const { |
| 1488 | return ConstructsVirtualBase ? CXXConstructExpr::CK_VirtualBase |
| 1489 | : CXXConstructExpr::CK_NonVirtualBase; |
| 1490 | } |
| 1491 | |
| 1492 | |
| 1493 | |
| 1494 | |
| 1495 | |
| 1496 | bool inheritedFromVBase() const { return InheritedFromVirtualBase; } |
| 1497 | |
| 1498 | SourceLocation getLocation() const LLVM_READONLY { return Loc; } |
| 1499 | SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; } |
| 1500 | SourceLocation getEndLoc() const LLVM_READONLY { return Loc; } |
| 1501 | |
| 1502 | static bool classof(const Stmt *T) { |
| 1503 | return T->getStmtClass() == CXXInheritedCtorInitExprClass; |
| 1504 | } |
| 1505 | |
| 1506 | child_range children() { |
| 1507 | return child_range(child_iterator(), child_iterator()); |
| 1508 | } |
| 1509 | }; |
| 1510 | |
| 1511 | |
| 1512 | |
| 1513 | |
| 1514 | |
| 1515 | |
| 1516 | |
| 1517 | |
| 1518 | class CXXFunctionalCastExpr final |
| 1519 | : public ExplicitCastExpr, |
| 1520 | private llvm::TrailingObjects<CXXFunctionalCastExpr, CXXBaseSpecifier *> { |
| 1521 | SourceLocation LParenLoc; |
| 1522 | SourceLocation RParenLoc; |
| 1523 | |
| 1524 | CXXFunctionalCastExpr(QualType ty, ExprValueKind VK, |
| 1525 | TypeSourceInfo *writtenTy, |
| 1526 | CastKind kind, Expr *castExpr, unsigned pathSize, |
| 1527 | SourceLocation lParenLoc, SourceLocation rParenLoc) |
| 1528 | : ExplicitCastExpr(CXXFunctionalCastExprClass, ty, VK, kind, |
| 1529 | castExpr, pathSize, writtenTy), |
| 1530 | LParenLoc(lParenLoc), RParenLoc(rParenLoc) {} |
| 1531 | |
| 1532 | explicit CXXFunctionalCastExpr(EmptyShell Shell, unsigned PathSize) |
| 1533 | : ExplicitCastExpr(CXXFunctionalCastExprClass, Shell, PathSize) {} |
| 1534 | |
| 1535 | public: |
| 1536 | friend class CastExpr; |
| 1537 | friend TrailingObjects; |
| 1538 | |
| 1539 | static CXXFunctionalCastExpr *Create(const ASTContext &Context, QualType T, |
| 1540 | ExprValueKind VK, |
| 1541 | TypeSourceInfo *Written, |
| 1542 | CastKind Kind, Expr *Op, |
| 1543 | const CXXCastPath *Path, |
| 1544 | SourceLocation LPLoc, |
| 1545 | SourceLocation RPLoc); |
| 1546 | static CXXFunctionalCastExpr *CreateEmpty(const ASTContext &Context, |
| 1547 | unsigned PathSize); |
| 1548 | |
| 1549 | SourceLocation getLParenLoc() const { return LParenLoc; } |
| 1550 | void setLParenLoc(SourceLocation L) { LParenLoc = L; } |
| 1551 | SourceLocation getRParenLoc() const { return RParenLoc; } |
| 1552 | void setRParenLoc(SourceLocation L) { RParenLoc = L; } |
| 1553 | |
| 1554 | |
| 1555 | bool isListInitialization() const { return LParenLoc.isInvalid(); } |
| 1556 | |
| 1557 | SourceLocation getBeginLoc() const LLVM_READONLY; |
| 1558 | SourceLocation getEndLoc() const LLVM_READONLY; |
| 1559 | |
| 1560 | static bool classof(const Stmt *T) { |
| 1561 | return T->getStmtClass() == CXXFunctionalCastExprClass; |
| 1562 | } |
| 1563 | }; |
| 1564 | |
| 1565 | |
| 1566 | |
| 1567 | |
| 1568 | |
| 1569 | |
| 1570 | |
| 1571 | |
| 1572 | |
| 1573 | |
| 1574 | |
| 1575 | |
| 1576 | |
| 1577 | |
| 1578 | |
| 1579 | |
| 1580 | class CXXTemporaryObjectExpr final : public CXXConstructExpr { |
| 1581 | friend class ASTStmtReader; |
| 1582 | |
| 1583 | |
| 1584 | |
| 1585 | |
| 1586 | |
| 1587 | TypeSourceInfo *TSI; |
| 1588 | |
| 1589 | CXXTemporaryObjectExpr(CXXConstructorDecl *Cons, QualType Ty, |
| 1590 | TypeSourceInfo *TSI, ArrayRef<Expr *> Args, |
| 1591 | SourceRange ParenOrBraceRange, |
| 1592 | bool HadMultipleCandidates, bool ListInitialization, |
| 1593 | bool StdInitListInitialization, |
| 1594 | bool ZeroInitialization); |
| 1595 | |
| 1596 | CXXTemporaryObjectExpr(EmptyShell Empty, unsigned NumArgs); |
| 1597 | |
| 1598 | public: |
| 1599 | static CXXTemporaryObjectExpr * |
| 1600 | Create(const ASTContext &Ctx, CXXConstructorDecl *Cons, QualType Ty, |
| 1601 | TypeSourceInfo *TSI, ArrayRef<Expr *> Args, |
| 1602 | SourceRange ParenOrBraceRange, bool HadMultipleCandidates, |
| 1603 | bool ListInitialization, bool StdInitListInitialization, |
| 1604 | bool ZeroInitialization); |
| 1605 | |
| 1606 | static CXXTemporaryObjectExpr *CreateEmpty(const ASTContext &Ctx, |
| 1607 | unsigned NumArgs); |
| 1608 | |
| 1609 | TypeSourceInfo *getTypeSourceInfo() const { return TSI; } |
| 1610 | |
| 1611 | SourceLocation getBeginLoc() const LLVM_READONLY; |
| 1612 | SourceLocation getEndLoc() const LLVM_READONLY; |
| 1613 | |
| 1614 | static bool classof(const Stmt *T) { |
| 1615 | return T->getStmtClass() == CXXTemporaryObjectExprClass; |
| 1616 | } |
| 1617 | }; |
| 1618 | |
| 1619 | Stmt **CXXConstructExpr::getTrailingArgs() { |
| 1620 | if (auto *E = dyn_cast<CXXTemporaryObjectExpr>(this)) |
| 1621 | return reinterpret_cast<Stmt **>(E + 1); |
| 1622 | (0) . __assert_fail ("(getStmtClass() == CXXConstructExprClass) && \"Unexpected class deriving from CXXConstructExpr!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprCXX.h", 1623, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert((getStmtClass() == CXXConstructExprClass) && |
| 1623 | (0) . __assert_fail ("(getStmtClass() == CXXConstructExprClass) && \"Unexpected class deriving from CXXConstructExpr!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprCXX.h", 1623, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "Unexpected class deriving from CXXConstructExpr!"); |
| 1624 | return reinterpret_cast<Stmt **>(this + 1); |
| 1625 | } |
| 1626 | |
| 1627 | |
| 1628 | |
| 1629 | |
| 1630 | |
| 1631 | |
| 1632 | |
| 1633 | |
| 1634 | |
| 1635 | |
| 1636 | |
| 1637 | |
| 1638 | |
| 1639 | |
| 1640 | |
| 1641 | |
| 1642 | |
| 1643 | |
| 1644 | |
| 1645 | |
| 1646 | |
| 1647 | |
| 1648 | class LambdaExpr final : public Expr, |
| 1649 | private llvm::TrailingObjects<LambdaExpr, Stmt *> { |
| 1650 | |
| 1651 | SourceRange IntroducerRange; |
| 1652 | |
| 1653 | |
| 1654 | SourceLocation CaptureDefaultLoc; |
| 1655 | |
| 1656 | |
| 1657 | unsigned NumCaptures : 16; |
| 1658 | |
| 1659 | |
| 1660 | |
| 1661 | unsigned CaptureDefault : 2; |
| 1662 | |
| 1663 | |
| 1664 | |
| 1665 | unsigned ExplicitParams : 1; |
| 1666 | |
| 1667 | |
| 1668 | unsigned ExplicitResultType : 1; |
| 1669 | |
| 1670 | |
| 1671 | |
| 1672 | |
| 1673 | |
| 1674 | |
| 1675 | |
| 1676 | |
| 1677 | |
| 1678 | SourceLocation ClosingBrace; |
| 1679 | |
| 1680 | |
| 1681 | LambdaExpr(QualType T, SourceRange IntroducerRange, |
| 1682 | LambdaCaptureDefault CaptureDefault, |
| 1683 | SourceLocation CaptureDefaultLoc, ArrayRef<LambdaCapture> Captures, |
| 1684 | bool ExplicitParams, bool ExplicitResultType, |
| 1685 | ArrayRef<Expr *> CaptureInits, SourceLocation ClosingBrace, |
| 1686 | bool ContainsUnexpandedParameterPack); |
| 1687 | |
| 1688 | |
| 1689 | LambdaExpr(EmptyShell Empty, unsigned NumCaptures) |
| 1690 | : Expr(LambdaExprClass, Empty), NumCaptures(NumCaptures), |
| 1691 | CaptureDefault(LCD_None), ExplicitParams(false), |
| 1692 | ExplicitResultType(false) { |
| 1693 | getStoredStmts()[NumCaptures] = nullptr; |
| 1694 | } |
| 1695 | |
| 1696 | Stmt **getStoredStmts() { return getTrailingObjects<Stmt *>(); } |
| 1697 | |
| 1698 | Stmt *const *getStoredStmts() const { return getTrailingObjects<Stmt *>(); } |
| 1699 | |
| 1700 | public: |
| 1701 | friend class ASTStmtReader; |
| 1702 | friend class ASTStmtWriter; |
| 1703 | friend TrailingObjects; |
| 1704 | |
| 1705 | |
| 1706 | static LambdaExpr * |
| 1707 | Create(const ASTContext &C, CXXRecordDecl *Class, SourceRange IntroducerRange, |
| 1708 | LambdaCaptureDefault CaptureDefault, SourceLocation CaptureDefaultLoc, |
| 1709 | ArrayRef<LambdaCapture> Captures, bool ExplicitParams, |
| 1710 | bool ExplicitResultType, ArrayRef<Expr *> CaptureInits, |
| 1711 | SourceLocation ClosingBrace, bool ContainsUnexpandedParameterPack); |
| 1712 | |
| 1713 | |
| 1714 | |
| 1715 | static LambdaExpr *CreateDeserialized(const ASTContext &C, |
| 1716 | unsigned NumCaptures); |
| 1717 | |
| 1718 | |
| 1719 | LambdaCaptureDefault getCaptureDefault() const { |
| 1720 | return static_cast<LambdaCaptureDefault>(CaptureDefault); |
| 1721 | } |
| 1722 | |
| 1723 | |
| 1724 | SourceLocation getCaptureDefaultLoc() const { |
| 1725 | return CaptureDefaultLoc; |
| 1726 | } |
| 1727 | |
| 1728 | |
| 1729 | bool isInitCapture(const LambdaCapture *Capture) const; |
| 1730 | |
| 1731 | |
| 1732 | |
| 1733 | using capture_iterator = const LambdaCapture *; |
| 1734 | |
| 1735 | |
| 1736 | using capture_range = llvm::iterator_range<capture_iterator>; |
| 1737 | |
| 1738 | |
| 1739 | capture_range captures() const; |
| 1740 | |
| 1741 | |
| 1742 | capture_iterator capture_begin() const; |
| 1743 | |
| 1744 | |
| 1745 | |
| 1746 | capture_iterator capture_end() const; |
| 1747 | |
| 1748 | |
| 1749 | unsigned capture_size() const { return NumCaptures; } |
| 1750 | |
| 1751 | |
| 1752 | capture_range explicit_captures() const; |
| 1753 | |
| 1754 | |
| 1755 | |
| 1756 | capture_iterator explicit_capture_begin() const; |
| 1757 | |
| 1758 | |
| 1759 | |
| 1760 | capture_iterator explicit_capture_end() const; |
| 1761 | |
| 1762 | |
| 1763 | capture_range implicit_captures() const; |
| 1764 | |
| 1765 | |
| 1766 | |
| 1767 | capture_iterator implicit_capture_begin() const; |
| 1768 | |
| 1769 | |
| 1770 | |
| 1771 | capture_iterator implicit_capture_end() const; |
| 1772 | |
| 1773 | |
| 1774 | |
| 1775 | using capture_init_iterator = Expr **; |
| 1776 | |
| 1777 | |
| 1778 | |
| 1779 | using const_capture_init_iterator = Expr *const *; |
| 1780 | |
| 1781 | |
| 1782 | llvm::iterator_range<capture_init_iterator> capture_inits() { |
| 1783 | return llvm::make_range(capture_init_begin(), capture_init_end()); |
| 1784 | } |
| 1785 | |
| 1786 | |
| 1787 | llvm::iterator_range<const_capture_init_iterator> capture_inits() const { |
| 1788 | return llvm::make_range(capture_init_begin(), capture_init_end()); |
| 1789 | } |
| 1790 | |
| 1791 | |
| 1792 | |
| 1793 | capture_init_iterator capture_init_begin() { |
| 1794 | return reinterpret_cast<Expr **>(getStoredStmts()); |
| 1795 | } |
| 1796 | |
| 1797 | |
| 1798 | |
| 1799 | const_capture_init_iterator capture_init_begin() const { |
| 1800 | return reinterpret_cast<Expr *const *>(getStoredStmts()); |
| 1801 | } |
| 1802 | |
| 1803 | |
| 1804 | |
| 1805 | capture_init_iterator capture_init_end() { |
| 1806 | return capture_init_begin() + NumCaptures; |
| 1807 | } |
| 1808 | |
| 1809 | |
| 1810 | |
| 1811 | const_capture_init_iterator capture_init_end() const { |
| 1812 | return capture_init_begin() + NumCaptures; |
| 1813 | } |
| 1814 | |
| 1815 | |
| 1816 | |
| 1817 | |
| 1818 | SourceRange getIntroducerRange() const { return IntroducerRange; } |
| 1819 | |
| 1820 | |
| 1821 | |
| 1822 | |
| 1823 | |
| 1824 | |
| 1825 | CXXRecordDecl *getLambdaClass() const; |
| 1826 | |
| 1827 | |
| 1828 | |
| 1829 | CXXMethodDecl *getCallOperator() const; |
| 1830 | |
| 1831 | |
| 1832 | |
| 1833 | TemplateParameterList *getTemplateParameterList() const; |
| 1834 | |
| 1835 | |
| 1836 | bool isGenericLambda() const { return getTemplateParameterList(); } |
| 1837 | |
| 1838 | |
| 1839 | CompoundStmt *getBody() const; |
| 1840 | |
| 1841 | |
| 1842 | |
| 1843 | bool isMutable() const; |
| 1844 | |
| 1845 | |
| 1846 | |
| 1847 | bool hasExplicitParameters() const { return ExplicitParams; } |
| 1848 | |
| 1849 | |
| 1850 | bool hasExplicitResultType() const { return ExplicitResultType; } |
| 1851 | |
| 1852 | static bool classof(const Stmt *T) { |
| 1853 | return T->getStmtClass() == LambdaExprClass; |
| 1854 | } |
| 1855 | |
| 1856 | SourceLocation getBeginLoc() const LLVM_READONLY { |
| 1857 | return IntroducerRange.getBegin(); |
| 1858 | } |
| 1859 | |
| 1860 | SourceLocation getEndLoc() const LLVM_READONLY { return ClosingBrace; } |
| 1861 | |
| 1862 | child_range children() { |
| 1863 | |
| 1864 | return child_range(getStoredStmts(), getStoredStmts() + NumCaptures + 1); |
| 1865 | } |
| 1866 | }; |
| 1867 | |
| 1868 | |
| 1869 | |
| 1870 | class CXXScalarValueInitExpr : public Expr { |
| 1871 | friend class ASTStmtReader; |
| 1872 | |
| 1873 | TypeSourceInfo *TypeInfo; |
| 1874 | |
| 1875 | public: |
| 1876 | |
| 1877 | |
| 1878 | CXXScalarValueInitExpr(QualType Type, TypeSourceInfo *TypeInfo, |
| 1879 | SourceLocation RParenLoc) |
| 1880 | : Expr(CXXScalarValueInitExprClass, Type, VK_RValue, OK_Ordinary, false, |
| 1881 | false, Type->isInstantiationDependentType(), |
| 1882 | Type->containsUnexpandedParameterPack()), |
| 1883 | TypeInfo(TypeInfo) { |
| 1884 | CXXScalarValueInitExprBits.RParenLoc = RParenLoc; |
| 1885 | } |
| 1886 | |
| 1887 | explicit CXXScalarValueInitExpr(EmptyShell Shell) |
| 1888 | : Expr(CXXScalarValueInitExprClass, Shell) {} |
| 1889 | |
| 1890 | TypeSourceInfo *getTypeSourceInfo() const { |
| 1891 | return TypeInfo; |
| 1892 | } |
| 1893 | |
| 1894 | SourceLocation getRParenLoc() const { |
| 1895 | return CXXScalarValueInitExprBits.RParenLoc; |
| 1896 | } |
| 1897 | |
| 1898 | SourceLocation getBeginLoc() const LLVM_READONLY; |
| 1899 | SourceLocation getEndLoc() const { return getRParenLoc(); } |
| 1900 | |
| 1901 | static bool classof(const Stmt *T) { |
| 1902 | return T->getStmtClass() == CXXScalarValueInitExprClass; |
| 1903 | } |
| 1904 | |
| 1905 | |
| 1906 | child_range children() { |
| 1907 | return child_range(child_iterator(), child_iterator()); |
| 1908 | } |
| 1909 | }; |
| 1910 | |
| 1911 | |
| 1912 | |
| 1913 | class CXXNewExpr final |
| 1914 | : public Expr, |
| 1915 | private llvm::TrailingObjects<CXXNewExpr, Stmt *, SourceRange> { |
| 1916 | friend class ASTStmtReader; |
| 1917 | friend class ASTStmtWriter; |
| 1918 | friend TrailingObjects; |
| 1919 | |
| 1920 | |
| 1921 | FunctionDecl *OperatorNew; |
| 1922 | |
| 1923 | |
| 1924 | FunctionDecl *OperatorDelete; |
| 1925 | |
| 1926 | |
| 1927 | TypeSourceInfo *AllocatedTypeInfo; |
| 1928 | |
| 1929 | |
| 1930 | SourceRange Range; |
| 1931 | |
| 1932 | |
| 1933 | SourceRange DirectInitRange; |
| 1934 | |
| 1935 | |
| 1936 | |
| 1937 | |
| 1938 | |
| 1939 | |
| 1940 | |
| 1941 | |
| 1942 | |
| 1943 | |
| 1944 | |
| 1945 | |
| 1946 | |
| 1947 | |
| 1948 | |
| 1949 | |
| 1950 | unsigned arraySizeOffset() const { return 0; } |
| 1951 | unsigned initExprOffset() const { return arraySizeOffset() + isArray(); } |
| 1952 | unsigned placementNewArgsOffset() const { |
| 1953 | return initExprOffset() + hasInitializer(); |
| 1954 | } |
| 1955 | |
| 1956 | unsigned numTrailingObjects(OverloadToken<Stmt *>) const { |
| 1957 | return isArray() + hasInitializer() + getNumPlacementArgs(); |
| 1958 | } |
| 1959 | |
| 1960 | unsigned numTrailingObjects(OverloadToken<SourceRange>) const { |
| 1961 | return isParenTypeId(); |
| 1962 | } |
| 1963 | |
| 1964 | public: |
| 1965 | enum InitializationStyle { |
| 1966 | |
| 1967 | NoInit, |
| 1968 | |
| 1969 | |
| 1970 | CallInit, |
| 1971 | |
| 1972 | |
| 1973 | ListInit |
| 1974 | }; |
| 1975 | |
| 1976 | private: |
| 1977 | |
| 1978 | CXXNewExpr(bool IsGlobalNew, FunctionDecl *OperatorNew, |
| 1979 | FunctionDecl *OperatorDelete, bool ShouldPassAlignment, |
| 1980 | bool UsualArrayDeleteWantsSize, ArrayRef<Expr *> PlacementArgs, |
| 1981 | SourceRange TypeIdParens, Expr *ArraySize, |
| 1982 | InitializationStyle InitializationStyle, Expr *Initializer, |
| 1983 | QualType Ty, TypeSourceInfo *AllocatedTypeInfo, SourceRange Range, |
| 1984 | SourceRange DirectInitRange); |
| 1985 | |
| 1986 | |
| 1987 | CXXNewExpr(EmptyShell Empty, bool IsArray, unsigned NumPlacementArgs, |
| 1988 | bool IsParenTypeId); |
| 1989 | |
| 1990 | public: |
| 1991 | |
| 1992 | static CXXNewExpr * |
| 1993 | Create(const ASTContext &Ctx, bool IsGlobalNew, FunctionDecl *OperatorNew, |
| 1994 | FunctionDecl *OperatorDelete, bool ShouldPassAlignment, |
| 1995 | bool UsualArrayDeleteWantsSize, ArrayRef<Expr *> PlacementArgs, |
| 1996 | SourceRange TypeIdParens, Expr *ArraySize, |
| 1997 | InitializationStyle InitializationStyle, Expr *Initializer, |
| 1998 | QualType Ty, TypeSourceInfo *AllocatedTypeInfo, SourceRange Range, |
| 1999 | SourceRange DirectInitRange); |
| 2000 | |
| 2001 | |
| 2002 | static CXXNewExpr *CreateEmpty(const ASTContext &Ctx, bool IsArray, |
| 2003 | bool HasInit, unsigned NumPlacementArgs, |
| 2004 | bool IsParenTypeId); |
| 2005 | |
| 2006 | QualType getAllocatedType() const { |
| 2007 | isPointerType()", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprCXX.h", 2007, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(getType()->isPointerType()); |
| 2008 | return getType()->getAs<PointerType>()->getPointeeType(); |
| 2009 | } |
| 2010 | |
| 2011 | TypeSourceInfo *getAllocatedTypeSourceInfo() const { |
| 2012 | return AllocatedTypeInfo; |
| 2013 | } |
| 2014 | |
| 2015 | |
| 2016 | |
| 2017 | |
| 2018 | |
| 2019 | |
| 2020 | |
| 2021 | |
| 2022 | |
| 2023 | |
| 2024 | |
| 2025 | |
| 2026 | |
| 2027 | |
| 2028 | |
| 2029 | |
| 2030 | bool shouldNullCheckAllocation() const; |
| 2031 | |
| 2032 | FunctionDecl *getOperatorNew() const { return OperatorNew; } |
| 2033 | void setOperatorNew(FunctionDecl *D) { OperatorNew = D; } |
| 2034 | FunctionDecl *getOperatorDelete() const { return OperatorDelete; } |
| 2035 | void setOperatorDelete(FunctionDecl *D) { OperatorDelete = D; } |
| 2036 | |
| 2037 | bool isArray() const { return CXXNewExprBits.IsArray; } |
| 2038 | |
| 2039 | Expr *getArraySize() { |
| 2040 | return isArray() |
| 2041 | ? cast<Expr>(getTrailingObjects<Stmt *>()[arraySizeOffset()]) |
| 2042 | : nullptr; |
| 2043 | } |
| 2044 | const Expr *getArraySize() const { |
| 2045 | return isArray() |
| 2046 | ? cast<Expr>(getTrailingObjects<Stmt *>()[arraySizeOffset()]) |
| 2047 | : nullptr; |
| 2048 | } |
| 2049 | |
| 2050 | unsigned getNumPlacementArgs() const { |
| 2051 | return CXXNewExprBits.NumPlacementArgs; |
| 2052 | } |
| 2053 | |
| 2054 | Expr **getPlacementArgs() { |
| 2055 | return reinterpret_cast<Expr **>(getTrailingObjects<Stmt *>() + |
| 2056 | placementNewArgsOffset()); |
| 2057 | } |
| 2058 | |
| 2059 | Expr *getPlacementArg(unsigned I) { |
| 2060 | (0) . __assert_fail ("(I < getNumPlacementArgs()) && \"Index out of range!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprCXX.h", 2060, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert((I < getNumPlacementArgs()) && "Index out of range!"); |
| 2061 | return getPlacementArgs()[I]; |
| 2062 | } |
| 2063 | const Expr *getPlacementArg(unsigned I) const { |
| 2064 | return const_cast<CXXNewExpr *>(this)->getPlacementArg(I); |
| 2065 | } |
| 2066 | |
| 2067 | bool isParenTypeId() const { return CXXNewExprBits.IsParenTypeId; } |
| 2068 | SourceRange getTypeIdParens() const { |
| 2069 | return isParenTypeId() ? getTrailingObjects<SourceRange>()[0] |
| 2070 | : SourceRange(); |
| 2071 | } |
| 2072 | |
| 2073 | bool isGlobalNew() const { return CXXNewExprBits.IsGlobalNew; } |
| 2074 | |
| 2075 | |
| 2076 | bool hasInitializer() const { |
| 2077 | return CXXNewExprBits.StoredInitializationStyle > 0; |
| 2078 | } |
| 2079 | |
| 2080 | |
| 2081 | InitializationStyle getInitializationStyle() const { |
| 2082 | if (CXXNewExprBits.StoredInitializationStyle == 0) |
| 2083 | return NoInit; |
| 2084 | return static_cast<InitializationStyle>( |
| 2085 | CXXNewExprBits.StoredInitializationStyle - 1); |
| 2086 | } |
| 2087 | |
| 2088 | |
| 2089 | Expr *getInitializer() { |
| 2090 | return hasInitializer() |
| 2091 | ? cast<Expr>(getTrailingObjects<Stmt *>()[initExprOffset()]) |
| 2092 | : nullptr; |
| 2093 | } |
| 2094 | const Expr *getInitializer() const { |
| 2095 | return hasInitializer() |
| 2096 | ? cast<Expr>(getTrailingObjects<Stmt *>()[initExprOffset()]) |
| 2097 | : nullptr; |
| 2098 | } |
| 2099 | |
| 2100 | |
| 2101 | const CXXConstructExpr *getConstructExpr() const { |
| 2102 | return dyn_cast_or_null<CXXConstructExpr>(getInitializer()); |
| 2103 | } |
| 2104 | |
| 2105 | |
| 2106 | |
| 2107 | bool passAlignment() const { return CXXNewExprBits.ShouldPassAlignment; } |
| 2108 | |
| 2109 | |
| 2110 | |
| 2111 | |
| 2112 | bool doesUsualArrayDeleteWantSize() const { |
| 2113 | return CXXNewExprBits.UsualArrayDeleteWantsSize; |
| 2114 | } |
| 2115 | |
| 2116 | using arg_iterator = ExprIterator; |
| 2117 | using const_arg_iterator = ConstExprIterator; |
| 2118 | |
| 2119 | llvm::iterator_range<arg_iterator> placement_arguments() { |
| 2120 | return llvm::make_range(placement_arg_begin(), placement_arg_end()); |
| 2121 | } |
| 2122 | |
| 2123 | llvm::iterator_range<const_arg_iterator> placement_arguments() const { |
| 2124 | return llvm::make_range(placement_arg_begin(), placement_arg_end()); |
| 2125 | } |
| 2126 | |
| 2127 | arg_iterator placement_arg_begin() { |
| 2128 | return getTrailingObjects<Stmt *>() + placementNewArgsOffset(); |
| 2129 | } |
| 2130 | arg_iterator placement_arg_end() { |
| 2131 | return placement_arg_begin() + getNumPlacementArgs(); |
| 2132 | } |
| 2133 | const_arg_iterator placement_arg_begin() const { |
| 2134 | return getTrailingObjects<Stmt *>() + placementNewArgsOffset(); |
| 2135 | } |
| 2136 | const_arg_iterator placement_arg_end() const { |
| 2137 | return placement_arg_begin() + getNumPlacementArgs(); |
| 2138 | } |
| 2139 | |
| 2140 | using raw_arg_iterator = Stmt **; |
| 2141 | |
| 2142 | raw_arg_iterator raw_arg_begin() { return getTrailingObjects<Stmt *>(); } |
| 2143 | raw_arg_iterator raw_arg_end() { |
| 2144 | return raw_arg_begin() + numTrailingObjects(OverloadToken<Stmt *>()); |
| 2145 | } |
| 2146 | const_arg_iterator raw_arg_begin() const { |
| 2147 | return getTrailingObjects<Stmt *>(); |
| 2148 | } |
| 2149 | const_arg_iterator raw_arg_end() const { |
| 2150 | return raw_arg_begin() + numTrailingObjects(OverloadToken<Stmt *>()); |
| 2151 | } |
| 2152 | |
| 2153 | SourceLocation getBeginLoc() const { return Range.getBegin(); } |
| 2154 | SourceLocation getEndLoc() const { return Range.getEnd(); } |
| 2155 | |
| 2156 | SourceRange getDirectInitRange() const { return DirectInitRange; } |
| 2157 | SourceRange getSourceRange() const { return Range; } |
| 2158 | |
| 2159 | static bool classof(const Stmt *T) { |
| 2160 | return T->getStmtClass() == CXXNewExprClass; |
| 2161 | } |
| 2162 | |
| 2163 | |
| 2164 | child_range children() { return child_range(raw_arg_begin(), raw_arg_end()); } |
| 2165 | }; |
| 2166 | |
| 2167 | |
| 2168 | |
| 2169 | class CXXDeleteExpr : public Expr { |
| 2170 | friend class ASTStmtReader; |
| 2171 | |
| 2172 | |
| 2173 | FunctionDecl *OperatorDelete = nullptr; |
| 2174 | |
| 2175 | |
| 2176 | Stmt *Argument = nullptr; |
| 2177 | |
| 2178 | public: |
| 2179 | CXXDeleteExpr(QualType Ty, bool GlobalDelete, bool ArrayForm, |
| 2180 | bool ArrayFormAsWritten, bool UsualArrayDeleteWantsSize, |
| 2181 | FunctionDecl *OperatorDelete, Expr *Arg, SourceLocation Loc) |
| 2182 | : Expr(CXXDeleteExprClass, Ty, VK_RValue, OK_Ordinary, false, false, |
| 2183 | Arg->isInstantiationDependent(), |
| 2184 | Arg->containsUnexpandedParameterPack()), |
| 2185 | OperatorDelete(OperatorDelete), Argument(Arg) { |
| 2186 | CXXDeleteExprBits.GlobalDelete = GlobalDelete; |
| 2187 | CXXDeleteExprBits.ArrayForm = ArrayForm; |
| 2188 | CXXDeleteExprBits.ArrayFormAsWritten = ArrayFormAsWritten; |
| 2189 | CXXDeleteExprBits.UsualArrayDeleteWantsSize = UsualArrayDeleteWantsSize; |
| 2190 | CXXDeleteExprBits.Loc = Loc; |
| 2191 | } |
| 2192 | |
| 2193 | explicit CXXDeleteExpr(EmptyShell Shell) : Expr(CXXDeleteExprClass, Shell) {} |
| 2194 | |
| 2195 | bool isGlobalDelete() const { return CXXDeleteExprBits.GlobalDelete; } |
| 2196 | bool isArrayForm() const { return CXXDeleteExprBits.ArrayForm; } |
| 2197 | bool isArrayFormAsWritten() const { |
| 2198 | return CXXDeleteExprBits.ArrayFormAsWritten; |
| 2199 | } |
| 2200 | |
| 2201 | |
| 2202 | |
| 2203 | |
| 2204 | |
| 2205 | bool doesUsualArrayDeleteWantSize() const { |
| 2206 | return CXXDeleteExprBits.UsualArrayDeleteWantsSize; |
| 2207 | } |
| 2208 | |
| 2209 | FunctionDecl *getOperatorDelete() const { return OperatorDelete; } |
| 2210 | |
| 2211 | Expr *getArgument() { return cast<Expr>(Argument); } |
| 2212 | const Expr *getArgument() const { return cast<Expr>(Argument); } |
| 2213 | |
| 2214 | |
| 2215 | |
| 2216 | |
| 2217 | |
| 2218 | QualType getDestroyedType() const; |
| 2219 | |
| 2220 | SourceLocation getBeginLoc() const { return CXXDeleteExprBits.Loc; } |
| 2221 | SourceLocation getEndLoc() const LLVM_READONLY { |
| 2222 | return Argument->getEndLoc(); |
| 2223 | } |
| 2224 | |
| 2225 | static bool classof(const Stmt *T) { |
| 2226 | return T->getStmtClass() == CXXDeleteExprClass; |
| 2227 | } |
| 2228 | |
| 2229 | |
| 2230 | child_range children() { return child_range(&Argument, &Argument + 1); } |
| 2231 | }; |
| 2232 | |
| 2233 | |
| 2234 | class PseudoDestructorTypeStorage { |
| 2235 | |
| 2236 | |
| 2237 | llvm::PointerUnion<TypeSourceInfo *, IdentifierInfo *> Type; |
| 2238 | |
| 2239 | |
| 2240 | SourceLocation Location; |
| 2241 | |
| 2242 | public: |
| 2243 | PseudoDestructorTypeStorage() = default; |
| 2244 | |
| 2245 | PseudoDestructorTypeStorage(IdentifierInfo *II, SourceLocation Loc) |
| 2246 | : Type(II), Location(Loc) {} |
| 2247 | |
| 2248 | PseudoDestructorTypeStorage(TypeSourceInfo *Info); |
| 2249 | |
| 2250 | TypeSourceInfo *getTypeSourceInfo() const { |
| 2251 | return Type.dyn_cast<TypeSourceInfo *>(); |
| 2252 | } |
| 2253 | |
| 2254 | IdentifierInfo *getIdentifier() const { |
| 2255 | return Type.dyn_cast<IdentifierInfo *>(); |
| 2256 | } |
| 2257 | |
| 2258 | SourceLocation getLocation() const { return Location; } |
| 2259 | }; |
| 2260 | |
| 2261 | |
| 2262 | |
| 2263 | |
| 2264 | |
| 2265 | |
| 2266 | |
| 2267 | |
| 2268 | |
| 2269 | |
| 2270 | |
| 2271 | |
| 2272 | |
| 2273 | |
| 2274 | |
| 2275 | |
| 2276 | |
| 2277 | |
| 2278 | |
| 2279 | |
| 2280 | |
| 2281 | |
| 2282 | |
| 2283 | |
| 2284 | |
| 2285 | class CXXPseudoDestructorExpr : public Expr { |
| 2286 | friend class ASTStmtReader; |
| 2287 | |
| 2288 | |
| 2289 | Stmt *Base = nullptr; |
| 2290 | |
| 2291 | |
| 2292 | |
| 2293 | bool IsArrow : 1; |
| 2294 | |
| 2295 | |
| 2296 | SourceLocation OperatorLoc; |
| 2297 | |
| 2298 | |
| 2299 | NestedNameSpecifierLoc QualifierLoc; |
| 2300 | |
| 2301 | |
| 2302 | |
| 2303 | TypeSourceInfo *ScopeType = nullptr; |
| 2304 | |
| 2305 | |
| 2306 | |
| 2307 | SourceLocation ColonColonLoc; |
| 2308 | |
| 2309 | |
| 2310 | SourceLocation TildeLoc; |
| 2311 | |
| 2312 | |
| 2313 | |
| 2314 | PseudoDestructorTypeStorage DestroyedType; |
| 2315 | |
| 2316 | public: |
| 2317 | CXXPseudoDestructorExpr(const ASTContext &Context, |
| 2318 | Expr *Base, bool isArrow, SourceLocation OperatorLoc, |
| 2319 | NestedNameSpecifierLoc QualifierLoc, |
| 2320 | TypeSourceInfo *ScopeType, |
| 2321 | SourceLocation ColonColonLoc, |
| 2322 | SourceLocation TildeLoc, |
| 2323 | PseudoDestructorTypeStorage DestroyedType); |
| 2324 | |
| 2325 | explicit CXXPseudoDestructorExpr(EmptyShell Shell) |
| 2326 | : Expr(CXXPseudoDestructorExprClass, Shell), IsArrow(false) {} |
| 2327 | |
| 2328 | Expr *getBase() const { return cast<Expr>(Base); } |
| 2329 | |
| 2330 | |
| 2331 | |
| 2332 | |
| 2333 | bool hasQualifier() const { return QualifierLoc.hasQualifier(); } |
| 2334 | |
| 2335 | |
| 2336 | |
| 2337 | NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; } |
| 2338 | |
| 2339 | |
| 2340 | |
| 2341 | |
| 2342 | NestedNameSpecifier *getQualifier() const { |
| 2343 | return QualifierLoc.getNestedNameSpecifier(); |
| 2344 | } |
| 2345 | |
| 2346 | |
| 2347 | |
| 2348 | bool isArrow() const { return IsArrow; } |
| 2349 | |
| 2350 | |
| 2351 | SourceLocation getOperatorLoc() const { return OperatorLoc; } |
| 2352 | |
| 2353 | |
| 2354 | |
| 2355 | |
| 2356 | |
| 2357 | |
| 2358 | |
| 2359 | |
| 2360 | |
| 2361 | |
| 2362 | TypeSourceInfo *getScopeTypeInfo() const { return ScopeType; } |
| 2363 | |
| 2364 | |
| 2365 | |
| 2366 | SourceLocation getColonColonLoc() const { return ColonColonLoc; } |
| 2367 | |
| 2368 | |
| 2369 | SourceLocation getTildeLoc() const { return TildeLoc; } |
| 2370 | |
| 2371 | |
| 2372 | |
| 2373 | |
| 2374 | |
| 2375 | |
| 2376 | |
| 2377 | |
| 2378 | TypeSourceInfo *getDestroyedTypeInfo() const { |
| 2379 | return DestroyedType.getTypeSourceInfo(); |
| 2380 | } |
| 2381 | |
| 2382 | |
| 2383 | |
| 2384 | |
| 2385 | IdentifierInfo *getDestroyedTypeIdentifier() const { |
| 2386 | return DestroyedType.getIdentifier(); |
| 2387 | } |
| 2388 | |
| 2389 | |
| 2390 | QualType getDestroyedType() const; |
| 2391 | |
| 2392 | |
| 2393 | SourceLocation getDestroyedTypeLoc() const { |
| 2394 | return DestroyedType.getLocation(); |
| 2395 | } |
| 2396 | |
| 2397 | |
| 2398 | |
| 2399 | void setDestroyedType(IdentifierInfo *II, SourceLocation Loc) { |
| 2400 | DestroyedType = PseudoDestructorTypeStorage(II, Loc); |
| 2401 | } |
| 2402 | |
| 2403 | |
| 2404 | void setDestroyedType(TypeSourceInfo *Info) { |
| 2405 | DestroyedType = PseudoDestructorTypeStorage(Info); |
| 2406 | } |
| 2407 | |
| 2408 | SourceLocation getBeginLoc() const LLVM_READONLY { |
| 2409 | return Base->getBeginLoc(); |
| 2410 | } |
| 2411 | SourceLocation getEndLoc() const LLVM_READONLY; |
| 2412 | |
| 2413 | static bool classof(const Stmt *T) { |
| 2414 | return T->getStmtClass() == CXXPseudoDestructorExprClass; |
| 2415 | } |
| 2416 | |
| 2417 | |
| 2418 | child_range children() { return child_range(&Base, &Base + 1); } |
| 2419 | }; |
| 2420 | |
| 2421 | |
| 2422 | |
| 2423 | |
| 2424 | |
| 2425 | |
| 2426 | |
| 2427 | |
| 2428 | |
| 2429 | class TypeTraitExpr final |
| 2430 | : public Expr, |
| 2431 | private llvm::TrailingObjects<TypeTraitExpr, TypeSourceInfo *> { |
| 2432 | |
| 2433 | SourceLocation Loc; |
| 2434 | |
| 2435 | |
| 2436 | SourceLocation RParenLoc; |
| 2437 | |
| 2438 | |
| 2439 | |
| 2440 | |
| 2441 | TypeTraitExpr(QualType T, SourceLocation Loc, TypeTrait Kind, |
| 2442 | ArrayRef<TypeSourceInfo *> Args, |
| 2443 | SourceLocation RParenLoc, |
| 2444 | bool Value); |
| 2445 | |
| 2446 | TypeTraitExpr(EmptyShell Empty) : Expr(TypeTraitExprClass, Empty) {} |
| 2447 | |
| 2448 | size_t numTrailingObjects(OverloadToken<TypeSourceInfo *>) const { |
| 2449 | return getNumArgs(); |
| 2450 | } |
| 2451 | |
| 2452 | public: |
| 2453 | friend class ASTStmtReader; |
| 2454 | friend class ASTStmtWriter; |
| 2455 | friend TrailingObjects; |
| 2456 | |
| 2457 | |
| 2458 | static TypeTraitExpr *Create(const ASTContext &C, QualType T, |
| 2459 | SourceLocation Loc, TypeTrait Kind, |
| 2460 | ArrayRef<TypeSourceInfo *> Args, |
| 2461 | SourceLocation RParenLoc, |
| 2462 | bool Value); |
| 2463 | |
| 2464 | static TypeTraitExpr *CreateDeserialized(const ASTContext &C, |
| 2465 | unsigned NumArgs); |
| 2466 | |
| 2467 | |
| 2468 | TypeTrait getTrait() const { |
| 2469 | return static_cast<TypeTrait>(TypeTraitExprBits.Kind); |
| 2470 | } |
| 2471 | |
| 2472 | bool getValue() const { |
| 2473 | assert(!isValueDependent()); |
| 2474 | return TypeTraitExprBits.Value; |
| 2475 | } |
| 2476 | |
| 2477 | |
| 2478 | unsigned getNumArgs() const { return TypeTraitExprBits.NumArgs; } |
| 2479 | |
| 2480 | |
| 2481 | TypeSourceInfo *getArg(unsigned I) const { |
| 2482 | (0) . __assert_fail ("I < getNumArgs() && \"Argument out-of-range\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprCXX.h", 2482, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(I < getNumArgs() && "Argument out-of-range"); |
| 2483 | return getArgs()[I]; |
| 2484 | } |
| 2485 | |
| 2486 | |
| 2487 | ArrayRef<TypeSourceInfo *> getArgs() const { |
| 2488 | return llvm::makeArrayRef(getTrailingObjects<TypeSourceInfo *>(), |
| 2489 | getNumArgs()); |
| 2490 | } |
| 2491 | |
| 2492 | SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; } |
| 2493 | SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; } |
| 2494 | |
| 2495 | static bool classof(const Stmt *T) { |
| 2496 | return T->getStmtClass() == TypeTraitExprClass; |
| 2497 | } |
| 2498 | |
| 2499 | |
| 2500 | child_range children() { |
| 2501 | return child_range(child_iterator(), child_iterator()); |
| 2502 | } |
| 2503 | }; |
| 2504 | |
| 2505 | |
| 2506 | |
| 2507 | |
| 2508 | |
| 2509 | |
| 2510 | |
| 2511 | |
| 2512 | |
| 2513 | class ArrayTypeTraitExpr : public Expr { |
| 2514 | |
| 2515 | unsigned ATT : 2; |
| 2516 | |
| 2517 | |
| 2518 | uint64_t Value = 0; |
| 2519 | |
| 2520 | |
| 2521 | Expr *Dimension; |
| 2522 | |
| 2523 | |
| 2524 | SourceLocation Loc; |
| 2525 | |
| 2526 | |
| 2527 | SourceLocation RParen; |
| 2528 | |
| 2529 | |
| 2530 | TypeSourceInfo *QueriedType = nullptr; |
| 2531 | |
| 2532 | public: |
| 2533 | friend class ASTStmtReader; |
| 2534 | |
| 2535 | ArrayTypeTraitExpr(SourceLocation loc, ArrayTypeTrait att, |
| 2536 | TypeSourceInfo *queried, uint64_t value, |
| 2537 | Expr *dimension, SourceLocation rparen, QualType ty) |
| 2538 | : Expr(ArrayTypeTraitExprClass, ty, VK_RValue, OK_Ordinary, |
| 2539 | false, queried->getType()->isDependentType(), |
| 2540 | (queried->getType()->isInstantiationDependentType() || |
| 2541 | (dimension && dimension->isInstantiationDependent())), |
| 2542 | queried->getType()->containsUnexpandedParameterPack()), |
| 2543 | ATT(att), Value(value), Dimension(dimension), |
| 2544 | Loc(loc), RParen(rparen), QueriedType(queried) {} |
| 2545 | |
| 2546 | explicit ArrayTypeTraitExpr(EmptyShell Empty) |
| 2547 | : Expr(ArrayTypeTraitExprClass, Empty), ATT(0) {} |
| 2548 | |
| 2549 | SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; } |
| 2550 | SourceLocation getEndLoc() const LLVM_READONLY { return RParen; } |
| 2551 | |
| 2552 | ArrayTypeTrait getTrait() const { return static_cast<ArrayTypeTrait>(ATT); } |
| 2553 | |
| 2554 | QualType getQueriedType() const { return QueriedType->getType(); } |
| 2555 | |
| 2556 | TypeSourceInfo *getQueriedTypeSourceInfo() const { return QueriedType; } |
| 2557 | |
| 2558 | uint64_t getValue() const { assert(!isTypeDependent()); return Value; } |
| 2559 | |
| 2560 | Expr *getDimensionExpression() const { return Dimension; } |
| 2561 | |
| 2562 | static bool classof(const Stmt *T) { |
| 2563 | return T->getStmtClass() == ArrayTypeTraitExprClass; |
| 2564 | } |
| 2565 | |
| 2566 | |
| 2567 | child_range children() { |
| 2568 | return child_range(child_iterator(), child_iterator()); |
| 2569 | } |
| 2570 | }; |
| 2571 | |
| 2572 | |
| 2573 | |
| 2574 | |
| 2575 | |
| 2576 | |
| 2577 | |
| 2578 | |
| 2579 | class ExpressionTraitExpr : public Expr { |
| 2580 | |
| 2581 | unsigned ET : 31; |
| 2582 | |
| 2583 | |
| 2584 | unsigned Value : 1; |
| 2585 | |
| 2586 | |
| 2587 | SourceLocation Loc; |
| 2588 | |
| 2589 | |
| 2590 | SourceLocation RParen; |
| 2591 | |
| 2592 | |
| 2593 | Expr* QueriedExpression = nullptr; |
| 2594 | |
| 2595 | public: |
| 2596 | friend class ASTStmtReader; |
| 2597 | |
| 2598 | ExpressionTraitExpr(SourceLocation loc, ExpressionTrait et, |
| 2599 | Expr *queried, bool value, |
| 2600 | SourceLocation rparen, QualType resultType) |
| 2601 | : Expr(ExpressionTraitExprClass, resultType, VK_RValue, OK_Ordinary, |
| 2602 | false, |
| 2603 | |
| 2604 | queried->isTypeDependent(), |
| 2605 | queried->isInstantiationDependent(), |
| 2606 | queried->containsUnexpandedParameterPack()), |
| 2607 | ET(et), Value(value), Loc(loc), RParen(rparen), |
| 2608 | QueriedExpression(queried) {} |
| 2609 | |
| 2610 | explicit ExpressionTraitExpr(EmptyShell Empty) |
| 2611 | : Expr(ExpressionTraitExprClass, Empty), ET(0), Value(false) {} |
| 2612 | |
| 2613 | SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; } |
| 2614 | SourceLocation getEndLoc() const LLVM_READONLY { return RParen; } |
| 2615 | |
| 2616 | ExpressionTrait getTrait() const { return static_cast<ExpressionTrait>(ET); } |
| 2617 | |
| 2618 | Expr *getQueriedExpression() const { return QueriedExpression; } |
| 2619 | |
| 2620 | bool getValue() const { return Value; } |
| 2621 | |
| 2622 | static bool classof(const Stmt *T) { |
| 2623 | return T->getStmtClass() == ExpressionTraitExprClass; |
| 2624 | } |
| 2625 | |
| 2626 | |
| 2627 | child_range children() { |
| 2628 | return child_range(child_iterator(), child_iterator()); |
| 2629 | } |
| 2630 | }; |
| 2631 | |
| 2632 | |
| 2633 | |
| 2634 | class OverloadExpr : public Expr { |
| 2635 | friend class ASTStmtReader; |
| 2636 | friend class ASTStmtWriter; |
| 2637 | |
| 2638 | |
| 2639 | DeclarationNameInfo NameInfo; |
| 2640 | |
| 2641 | |
| 2642 | NestedNameSpecifierLoc QualifierLoc; |
| 2643 | |
| 2644 | protected: |
| 2645 | OverloadExpr(StmtClass SC, const ASTContext &Context, |
| 2646 | NestedNameSpecifierLoc QualifierLoc, |
| 2647 | SourceLocation TemplateKWLoc, |
| 2648 | const DeclarationNameInfo &NameInfo, |
| 2649 | const TemplateArgumentListInfo *TemplateArgs, |
| 2650 | UnresolvedSetIterator Begin, UnresolvedSetIterator End, |
| 2651 | bool KnownDependent, bool KnownInstantiationDependent, |
| 2652 | bool KnownContainsUnexpandedParameterPack); |
| 2653 | |
| 2654 | OverloadExpr(StmtClass SC, EmptyShell Empty, unsigned NumResults, |
| 2655 | bool HasTemplateKWAndArgsInfo); |
| 2656 | |
| 2657 | |
| 2658 | inline DeclAccessPair *getTrailingResults(); |
| 2659 | const DeclAccessPair *getTrailingResults() const { |
| 2660 | return const_cast<OverloadExpr *>(this)->getTrailingResults(); |
| 2661 | } |
| 2662 | |
| 2663 | |
| 2664 | |
| 2665 | inline ASTTemplateKWAndArgsInfo *getTrailingASTTemplateKWAndArgsInfo(); |
| 2666 | const ASTTemplateKWAndArgsInfo *getTrailingASTTemplateKWAndArgsInfo() const { |
| 2667 | return const_cast<OverloadExpr *>(this) |
| 2668 | ->getTrailingASTTemplateKWAndArgsInfo(); |
| 2669 | } |
| 2670 | |
| 2671 | |
| 2672 | |
| 2673 | inline TemplateArgumentLoc *getTrailingTemplateArgumentLoc(); |
| 2674 | const TemplateArgumentLoc *getTrailingTemplateArgumentLoc() const { |
| 2675 | return const_cast<OverloadExpr *>(this)->getTrailingTemplateArgumentLoc(); |
| 2676 | } |
| 2677 | |
| 2678 | bool hasTemplateKWAndArgsInfo() const { |
| 2679 | return OverloadExprBits.HasTemplateKWAndArgsInfo; |
| 2680 | } |
| 2681 | |
| 2682 | public: |
| 2683 | struct FindResult { |
| 2684 | OverloadExpr *Expression; |
| 2685 | bool IsAddressOfOperand; |
| 2686 | bool HasFormOfMemberPointer; |
| 2687 | }; |
| 2688 | |
| 2689 | |
| 2690 | |
| 2691 | |
| 2692 | |
| 2693 | |
| 2694 | static FindResult find(Expr *E) { |
| 2695 | getType()->isSpecificBuiltinType(BuiltinType..Overload)", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprCXX.h", 2695, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(E->getType()->isSpecificBuiltinType(BuiltinType::Overload)); |
| 2696 | |
| 2697 | FindResult Result; |
| 2698 | |
| 2699 | E = E->IgnoreParens(); |
| 2700 | if (isa<UnaryOperator>(E)) { |
| 2701 | (E)->getOpcode() == UO_AddrOf", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprCXX.h", 2701, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(cast<UnaryOperator>(E)->getOpcode() == UO_AddrOf); |
| 2702 | E = cast<UnaryOperator>(E)->getSubExpr(); |
| 2703 | auto *Ovl = cast<OverloadExpr>(E->IgnoreParens()); |
| 2704 | |
| 2705 | Result.HasFormOfMemberPointer = (E == Ovl && Ovl->getQualifier()); |
| 2706 | Result.IsAddressOfOperand = true; |
| 2707 | Result.Expression = Ovl; |
| 2708 | } else { |
| 2709 | Result.HasFormOfMemberPointer = false; |
| 2710 | Result.IsAddressOfOperand = false; |
| 2711 | Result.Expression = cast<OverloadExpr>(E); |
| 2712 | } |
| 2713 | |
| 2714 | return Result; |
| 2715 | } |
| 2716 | |
| 2717 | |
| 2718 | |
| 2719 | inline CXXRecordDecl *getNamingClass(); |
| 2720 | const CXXRecordDecl *getNamingClass() const { |
| 2721 | return const_cast<OverloadExpr *>(this)->getNamingClass(); |
| 2722 | } |
| 2723 | |
| 2724 | using decls_iterator = UnresolvedSetImpl::iterator; |
| 2725 | |
| 2726 | decls_iterator decls_begin() const { |
| 2727 | return UnresolvedSetIterator(getTrailingResults()); |
| 2728 | } |
| 2729 | decls_iterator decls_end() const { |
| 2730 | return UnresolvedSetIterator(getTrailingResults() + getNumDecls()); |
| 2731 | } |
| 2732 | llvm::iterator_range<decls_iterator> decls() const { |
| 2733 | return llvm::make_range(decls_begin(), decls_end()); |
| 2734 | } |
| 2735 | |
| 2736 | |
| 2737 | unsigned getNumDecls() const { return OverloadExprBits.NumResults; } |
| 2738 | |
| 2739 | |
| 2740 | const DeclarationNameInfo &getNameInfo() const { return NameInfo; } |
| 2741 | |
| 2742 | |
| 2743 | DeclarationName getName() const { return NameInfo.getName(); } |
| 2744 | |
| 2745 | |
| 2746 | SourceLocation getNameLoc() const { return NameInfo.getLoc(); } |
| 2747 | |
| 2748 | |
| 2749 | NestedNameSpecifier *getQualifier() const { |
| 2750 | return QualifierLoc.getNestedNameSpecifier(); |
| 2751 | } |
| 2752 | |
| 2753 | |
| 2754 | |
| 2755 | NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; } |
| 2756 | |
| 2757 | |
| 2758 | |
| 2759 | SourceLocation getTemplateKeywordLoc() const { |
| 2760 | if (!hasTemplateKWAndArgsInfo()) |
| 2761 | return SourceLocation(); |
| 2762 | return getTrailingASTTemplateKWAndArgsInfo()->TemplateKWLoc; |
| 2763 | } |
| 2764 | |
| 2765 | |
| 2766 | |
| 2767 | SourceLocation getLAngleLoc() const { |
| 2768 | if (!hasTemplateKWAndArgsInfo()) |
| 2769 | return SourceLocation(); |
| 2770 | return getTrailingASTTemplateKWAndArgsInfo()->LAngleLoc; |
| 2771 | } |
| 2772 | |
| 2773 | |
| 2774 | |
| 2775 | SourceLocation getRAngleLoc() const { |
| 2776 | if (!hasTemplateKWAndArgsInfo()) |
| 2777 | return SourceLocation(); |
| 2778 | return getTrailingASTTemplateKWAndArgsInfo()->RAngleLoc; |
| 2779 | } |
| 2780 | |
| 2781 | |
| 2782 | bool hasTemplateKeyword() const { return getTemplateKeywordLoc().isValid(); } |
| 2783 | |
| 2784 | |
| 2785 | bool hasExplicitTemplateArgs() const { return getLAngleLoc().isValid(); } |
| 2786 | |
| 2787 | TemplateArgumentLoc const *getTemplateArgs() const { |
| 2788 | if (!hasExplicitTemplateArgs()) |
| 2789 | return nullptr; |
| 2790 | return const_cast<OverloadExpr *>(this)->getTrailingTemplateArgumentLoc(); |
| 2791 | } |
| 2792 | |
| 2793 | unsigned getNumTemplateArgs() const { |
| 2794 | if (!hasExplicitTemplateArgs()) |
| 2795 | return 0; |
| 2796 | |
| 2797 | return getTrailingASTTemplateKWAndArgsInfo()->NumTemplateArgs; |
| 2798 | } |
| 2799 | |
| 2800 | ArrayRef<TemplateArgumentLoc> template_arguments() const { |
| 2801 | return {getTemplateArgs(), getNumTemplateArgs()}; |
| 2802 | } |
| 2803 | |
| 2804 | |
| 2805 | void copyTemplateArgumentsInto(TemplateArgumentListInfo &List) const { |
| 2806 | if (hasExplicitTemplateArgs()) |
| 2807 | getTrailingASTTemplateKWAndArgsInfo()->copyInto(getTemplateArgs(), List); |
| 2808 | } |
| 2809 | |
| 2810 | static bool classof(const Stmt *T) { |
| 2811 | return T->getStmtClass() == UnresolvedLookupExprClass || |
| 2812 | T->getStmtClass() == UnresolvedMemberExprClass; |
| 2813 | } |
| 2814 | }; |
| 2815 | |
| 2816 | |
| 2817 | |
| 2818 | |
| 2819 | |
| 2820 | |
| 2821 | |
| 2822 | |
| 2823 | |
| 2824 | |
| 2825 | |
| 2826 | |
| 2827 | class UnresolvedLookupExpr final |
| 2828 | : public OverloadExpr, |
| 2829 | private llvm::TrailingObjects<UnresolvedLookupExpr, DeclAccessPair, |
| 2830 | ASTTemplateKWAndArgsInfo, |
| 2831 | TemplateArgumentLoc> { |
| 2832 | friend class ASTStmtReader; |
| 2833 | friend class OverloadExpr; |
| 2834 | friend TrailingObjects; |
| 2835 | |
| 2836 | |
| 2837 | |
| 2838 | |
| 2839 | CXXRecordDecl *NamingClass; |
| 2840 | |
| 2841 | |
| 2842 | |
| 2843 | |
| 2844 | |
| 2845 | |
| 2846 | |
| 2847 | |
| 2848 | |
| 2849 | |
| 2850 | |
| 2851 | |
| 2852 | |
| 2853 | |
| 2854 | |
| 2855 | UnresolvedLookupExpr(const ASTContext &Context, CXXRecordDecl *NamingClass, |
| 2856 | NestedNameSpecifierLoc QualifierLoc, |
| 2857 | SourceLocation TemplateKWLoc, |
| 2858 | const DeclarationNameInfo &NameInfo, bool RequiresADL, |
| 2859 | bool Overloaded, |
| 2860 | const TemplateArgumentListInfo *TemplateArgs, |
| 2861 | UnresolvedSetIterator Begin, UnresolvedSetIterator End); |
| 2862 | |
| 2863 | UnresolvedLookupExpr(EmptyShell Empty, unsigned NumResults, |
| 2864 | bool HasTemplateKWAndArgsInfo); |
| 2865 | |
| 2866 | unsigned numTrailingObjects(OverloadToken<DeclAccessPair>) const { |
| 2867 | return getNumDecls(); |
| 2868 | } |
| 2869 | |
| 2870 | unsigned numTrailingObjects(OverloadToken<ASTTemplateKWAndArgsInfo>) const { |
| 2871 | return hasTemplateKWAndArgsInfo(); |
| 2872 | } |
| 2873 | |
| 2874 | public: |
| 2875 | static UnresolvedLookupExpr * |
| 2876 | Create(const ASTContext &Context, CXXRecordDecl *NamingClass, |
| 2877 | NestedNameSpecifierLoc QualifierLoc, |
| 2878 | const DeclarationNameInfo &NameInfo, bool RequiresADL, bool Overloaded, |
| 2879 | UnresolvedSetIterator Begin, UnresolvedSetIterator End); |
| 2880 | |
| 2881 | static UnresolvedLookupExpr * |
| 2882 | Create(const ASTContext &Context, CXXRecordDecl *NamingClass, |
| 2883 | NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, |
| 2884 | const DeclarationNameInfo &NameInfo, bool RequiresADL, |
| 2885 | const TemplateArgumentListInfo *Args, UnresolvedSetIterator Begin, |
| 2886 | UnresolvedSetIterator End); |
| 2887 | |
| 2888 | static UnresolvedLookupExpr *CreateEmpty(const ASTContext &Context, |
| 2889 | unsigned NumResults, |
| 2890 | bool HasTemplateKWAndArgsInfo, |
| 2891 | unsigned NumTemplateArgs); |
| 2892 | |
| 2893 | |
| 2894 | |
| 2895 | bool requiresADL() const { return UnresolvedLookupExprBits.RequiresADL; } |
| 2896 | |
| 2897 | |
| 2898 | bool isOverloaded() const { return UnresolvedLookupExprBits.Overloaded; } |
| 2899 | |
| 2900 | |
| 2901 | |
| 2902 | |
| 2903 | CXXRecordDecl *getNamingClass() { return NamingClass; } |
| 2904 | const CXXRecordDecl *getNamingClass() const { return NamingClass; } |
| 2905 | |
| 2906 | SourceLocation getBeginLoc() const LLVM_READONLY { |
| 2907 | if (NestedNameSpecifierLoc l = getQualifierLoc()) |
| 2908 | return l.getBeginLoc(); |
| 2909 | return getNameInfo().getBeginLoc(); |
| 2910 | } |
| 2911 | |
| 2912 | SourceLocation getEndLoc() const LLVM_READONLY { |
| 2913 | if (hasExplicitTemplateArgs()) |
| 2914 | return getRAngleLoc(); |
| 2915 | return getNameInfo().getEndLoc(); |
| 2916 | } |
| 2917 | |
| 2918 | child_range children() { |
| 2919 | return child_range(child_iterator(), child_iterator()); |
| 2920 | } |
| 2921 | |
| 2922 | static bool classof(const Stmt *T) { |
| 2923 | return T->getStmtClass() == UnresolvedLookupExprClass; |
| 2924 | } |
| 2925 | }; |
| 2926 | |
| 2927 | |
| 2928 | |
| 2929 | |
| 2930 | |
| 2931 | |
| 2932 | |
| 2933 | |
| 2934 | |
| 2935 | |
| 2936 | |
| 2937 | |
| 2938 | |
| 2939 | |
| 2940 | |
| 2941 | class DependentScopeDeclRefExpr final |
| 2942 | : public Expr, |
| 2943 | private llvm::TrailingObjects<DependentScopeDeclRefExpr, |
| 2944 | ASTTemplateKWAndArgsInfo, |
| 2945 | TemplateArgumentLoc> { |
| 2946 | friend class ASTStmtReader; |
| 2947 | friend class ASTStmtWriter; |
| 2948 | friend TrailingObjects; |
| 2949 | |
| 2950 | |
| 2951 | |
| 2952 | NestedNameSpecifierLoc QualifierLoc; |
| 2953 | |
| 2954 | |
| 2955 | DeclarationNameInfo NameInfo; |
| 2956 | |
| 2957 | DependentScopeDeclRefExpr(QualType Ty, NestedNameSpecifierLoc QualifierLoc, |
| 2958 | SourceLocation TemplateKWLoc, |
| 2959 | const DeclarationNameInfo &NameInfo, |
| 2960 | const TemplateArgumentListInfo *Args); |
| 2961 | |
| 2962 | size_t numTrailingObjects(OverloadToken<ASTTemplateKWAndArgsInfo>) const { |
| 2963 | return hasTemplateKWAndArgsInfo(); |
| 2964 | } |
| 2965 | |
| 2966 | bool hasTemplateKWAndArgsInfo() const { |
| 2967 | return DependentScopeDeclRefExprBits.HasTemplateKWAndArgsInfo; |
| 2968 | } |
| 2969 | |
| 2970 | public: |
| 2971 | static DependentScopeDeclRefExpr * |
| 2972 | Create(const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc, |
| 2973 | SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, |
| 2974 | const TemplateArgumentListInfo *TemplateArgs); |
| 2975 | |
| 2976 | static DependentScopeDeclRefExpr *CreateEmpty(const ASTContext &Context, |
| 2977 | bool HasTemplateKWAndArgsInfo, |
| 2978 | unsigned NumTemplateArgs); |
| 2979 | |
| 2980 | |
| 2981 | const DeclarationNameInfo &getNameInfo() const { return NameInfo; } |
| 2982 | |
| 2983 | |
| 2984 | DeclarationName getDeclName() const { return NameInfo.getName(); } |
| 2985 | |
| 2986 | |
| 2987 | |
| 2988 | |
| 2989 | SourceLocation getLocation() const { return NameInfo.getLoc(); } |
| 2990 | |
| 2991 | |
| 2992 | |
| 2993 | NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; } |
| 2994 | |
| 2995 | |
| 2996 | |
| 2997 | NestedNameSpecifier *getQualifier() const { |
| 2998 | return QualifierLoc.getNestedNameSpecifier(); |
| 2999 | } |
| 3000 | |
| 3001 | |
| 3002 | |
| 3003 | SourceLocation getTemplateKeywordLoc() const { |
| 3004 | if (!hasTemplateKWAndArgsInfo()) |
| 3005 | return SourceLocation(); |
| 3006 | return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->TemplateKWLoc; |
| 3007 | } |
| 3008 | |
| 3009 | |
| 3010 | |
| 3011 | SourceLocation getLAngleLoc() const { |
| 3012 | if (!hasTemplateKWAndArgsInfo()) |
| 3013 | return SourceLocation(); |
| 3014 | return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->LAngleLoc; |
| 3015 | } |
| 3016 | |
| 3017 | |
| 3018 | |
| 3019 | SourceLocation getRAngleLoc() const { |
| 3020 | if (!hasTemplateKWAndArgsInfo()) |
| 3021 | return SourceLocation(); |
| 3022 | return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->RAngleLoc; |
| 3023 | } |
| 3024 | |
| 3025 | |
| 3026 | bool hasTemplateKeyword() const { return getTemplateKeywordLoc().isValid(); } |
| 3027 | |
| 3028 | |
| 3029 | bool hasExplicitTemplateArgs() const { return getLAngleLoc().isValid(); } |
| 3030 | |
| 3031 | |
| 3032 | |
| 3033 | void copyTemplateArgumentsInto(TemplateArgumentListInfo &List) const { |
| 3034 | if (hasExplicitTemplateArgs()) |
| 3035 | getTrailingObjects<ASTTemplateKWAndArgsInfo>()->copyInto( |
| 3036 | getTrailingObjects<TemplateArgumentLoc>(), List); |
| 3037 | } |
| 3038 | |
| 3039 | TemplateArgumentLoc const *getTemplateArgs() const { |
| 3040 | if (!hasExplicitTemplateArgs()) |
| 3041 | return nullptr; |
| 3042 | |
| 3043 | return getTrailingObjects<TemplateArgumentLoc>(); |
| 3044 | } |
| 3045 | |
| 3046 | unsigned getNumTemplateArgs() const { |
| 3047 | if (!hasExplicitTemplateArgs()) |
| 3048 | return 0; |
| 3049 | |
| 3050 | return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->NumTemplateArgs; |
| 3051 | } |
| 3052 | |
| 3053 | ArrayRef<TemplateArgumentLoc> template_arguments() const { |
| 3054 | return {getTemplateArgs(), getNumTemplateArgs()}; |
| 3055 | } |
| 3056 | |
| 3057 | |
| 3058 | |
| 3059 | SourceLocation getBeginLoc() const LLVM_READONLY { |
| 3060 | return QualifierLoc.getBeginLoc(); |
| 3061 | } |
| 3062 | |
| 3063 | SourceLocation getEndLoc() const LLVM_READONLY { |
| 3064 | if (hasExplicitTemplateArgs()) |
| 3065 | return getRAngleLoc(); |
| 3066 | return getLocation(); |
| 3067 | } |
| 3068 | |
| 3069 | static bool classof(const Stmt *T) { |
| 3070 | return T->getStmtClass() == DependentScopeDeclRefExprClass; |
| 3071 | } |
| 3072 | |
| 3073 | child_range children() { |
| 3074 | return child_range(child_iterator(), child_iterator()); |
| 3075 | } |
| 3076 | }; |
| 3077 | |
| 3078 | |
| 3079 | |
| 3080 | |
| 3081 | |
| 3082 | |
| 3083 | |
| 3084 | |
| 3085 | |
| 3086 | |
| 3087 | |
| 3088 | class ExprWithCleanups final |
| 3089 | : public FullExpr, |
| 3090 | private llvm::TrailingObjects<ExprWithCleanups, BlockDecl *> { |
| 3091 | public: |
| 3092 | |
| 3093 | |
| 3094 | |
| 3095 | |
| 3096 | using CleanupObject = BlockDecl *; |
| 3097 | |
| 3098 | private: |
| 3099 | friend class ASTStmtReader; |
| 3100 | friend TrailingObjects; |
| 3101 | |
| 3102 | ExprWithCleanups(EmptyShell, unsigned NumObjects); |
| 3103 | ExprWithCleanups(Expr *SubExpr, bool CleanupsHaveSideEffects, |
| 3104 | ArrayRef<CleanupObject> Objects); |
| 3105 | |
| 3106 | public: |
| 3107 | static ExprWithCleanups *Create(const ASTContext &C, EmptyShell empty, |
| 3108 | unsigned numObjects); |
| 3109 | |
| 3110 | static ExprWithCleanups *Create(const ASTContext &C, Expr *subexpr, |
| 3111 | bool CleanupsHaveSideEffects, |
| 3112 | ArrayRef<CleanupObject> objects); |
| 3113 | |
| 3114 | ArrayRef<CleanupObject> getObjects() const { |
| 3115 | return llvm::makeArrayRef(getTrailingObjects<CleanupObject>(), |
| 3116 | getNumObjects()); |
| 3117 | } |
| 3118 | |
| 3119 | unsigned getNumObjects() const { return ExprWithCleanupsBits.NumObjects; } |
| 3120 | |
| 3121 | CleanupObject getObject(unsigned i) const { |
| 3122 | (0) . __assert_fail ("i < getNumObjects() && \"Index out of range\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprCXX.h", 3122, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(i < getNumObjects() && "Index out of range"); |
| 3123 | return getObjects()[i]; |
| 3124 | } |
| 3125 | |
| 3126 | bool cleanupsHaveSideEffects() const { |
| 3127 | return ExprWithCleanupsBits.CleanupsHaveSideEffects; |
| 3128 | } |
| 3129 | |
| 3130 | SourceLocation getBeginLoc() const LLVM_READONLY { |
| 3131 | return SubExpr->getBeginLoc(); |
| 3132 | } |
| 3133 | |
| 3134 | SourceLocation getEndLoc() const LLVM_READONLY { |
| 3135 | return SubExpr->getEndLoc(); |
| 3136 | } |
| 3137 | |
| 3138 | |
| 3139 | static bool classof(const Stmt *T) { |
| 3140 | return T->getStmtClass() == ExprWithCleanupsClass; |
| 3141 | } |
| 3142 | |
| 3143 | |
| 3144 | child_range children() { return child_range(&SubExpr, &SubExpr + 1); } |
| 3145 | }; |
| 3146 | |
| 3147 | |
| 3148 | |
| 3149 | |
| 3150 | |
| 3151 | |
| 3152 | |
| 3153 | |
| 3154 | |
| 3155 | |
| 3156 | |
| 3157 | |
| 3158 | |
| 3159 | |
| 3160 | |
| 3161 | |
| 3162 | |
| 3163 | |
| 3164 | |
| 3165 | |
| 3166 | |
| 3167 | |
| 3168 | class CXXUnresolvedConstructExpr final |
| 3169 | : public Expr, |
| 3170 | private llvm::TrailingObjects<CXXUnresolvedConstructExpr, Expr *> { |
| 3171 | friend class ASTStmtReader; |
| 3172 | friend TrailingObjects; |
| 3173 | |
| 3174 | |
| 3175 | TypeSourceInfo *TSI; |
| 3176 | |
| 3177 | |
| 3178 | SourceLocation LParenLoc; |
| 3179 | |
| 3180 | |
| 3181 | SourceLocation RParenLoc; |
| 3182 | |
| 3183 | CXXUnresolvedConstructExpr(TypeSourceInfo *TSI, SourceLocation LParenLoc, |
| 3184 | ArrayRef<Expr *> Args, SourceLocation RParenLoc); |
| 3185 | |
| 3186 | CXXUnresolvedConstructExpr(EmptyShell Empty, unsigned NumArgs) |
| 3187 | : Expr(CXXUnresolvedConstructExprClass, Empty) { |
| 3188 | CXXUnresolvedConstructExprBits.NumArgs = NumArgs; |
| 3189 | } |
| 3190 | |
| 3191 | public: |
| 3192 | static CXXUnresolvedConstructExpr *Create(const ASTContext &Context, |
| 3193 | TypeSourceInfo *Type, |
| 3194 | SourceLocation LParenLoc, |
| 3195 | ArrayRef<Expr *> Args, |
| 3196 | SourceLocation RParenLoc); |
| 3197 | |
| 3198 | static CXXUnresolvedConstructExpr *CreateEmpty(const ASTContext &Context, |
| 3199 | unsigned NumArgs); |
| 3200 | |
| 3201 | |
| 3202 | |
| 3203 | QualType getTypeAsWritten() const { return TSI->getType(); } |
| 3204 | |
| 3205 | |
| 3206 | |
| 3207 | TypeSourceInfo *getTypeSourceInfo() const { return TSI; } |
| 3208 | |
| 3209 | |
| 3210 | |
| 3211 | SourceLocation getLParenLoc() const { return LParenLoc; } |
| 3212 | void setLParenLoc(SourceLocation L) { LParenLoc = L; } |
| 3213 | |
| 3214 | |
| 3215 | |
| 3216 | SourceLocation getRParenLoc() const { return RParenLoc; } |
| 3217 | void setRParenLoc(SourceLocation L) { RParenLoc = L; } |
| 3218 | |
| 3219 | |
| 3220 | |
| 3221 | |
| 3222 | bool isListInitialization() const { return LParenLoc.isInvalid(); } |
| 3223 | |
| 3224 | |
| 3225 | unsigned arg_size() const { return CXXUnresolvedConstructExprBits.NumArgs; } |
| 3226 | |
| 3227 | using arg_iterator = Expr **; |
| 3228 | using arg_range = llvm::iterator_range<arg_iterator>; |
| 3229 | |
| 3230 | arg_iterator arg_begin() { return getTrailingObjects<Expr *>(); } |
| 3231 | arg_iterator arg_end() { return arg_begin() + arg_size(); } |
| 3232 | arg_range arguments() { return arg_range(arg_begin(), arg_end()); } |
| 3233 | |
| 3234 | using const_arg_iterator = const Expr* const *; |
| 3235 | using const_arg_range = llvm::iterator_range<const_arg_iterator>; |
| 3236 | |
| 3237 | const_arg_iterator arg_begin() const { return getTrailingObjects<Expr *>(); } |
| 3238 | const_arg_iterator arg_end() const { return arg_begin() + arg_size(); } |
| 3239 | const_arg_range arguments() const { |
| 3240 | return const_arg_range(arg_begin(), arg_end()); |
| 3241 | } |
| 3242 | |
| 3243 | Expr *getArg(unsigned I) { |
| 3244 | (0) . __assert_fail ("I < arg_size() && \"Argument index out-of-range\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprCXX.h", 3244, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(I < arg_size() && "Argument index out-of-range"); |
| 3245 | return arg_begin()[I]; |
| 3246 | } |
| 3247 | |
| 3248 | const Expr *getArg(unsigned I) const { |
| 3249 | (0) . __assert_fail ("I < arg_size() && \"Argument index out-of-range\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprCXX.h", 3249, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(I < arg_size() && "Argument index out-of-range"); |
| 3250 | return arg_begin()[I]; |
| 3251 | } |
| 3252 | |
| 3253 | void setArg(unsigned I, Expr *E) { |
| 3254 | (0) . __assert_fail ("I < arg_size() && \"Argument index out-of-range\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprCXX.h", 3254, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(I < arg_size() && "Argument index out-of-range"); |
| 3255 | arg_begin()[I] = E; |
| 3256 | } |
| 3257 | |
| 3258 | SourceLocation getBeginLoc() const LLVM_READONLY; |
| 3259 | SourceLocation getEndLoc() const LLVM_READONLY { |
| 3260 | if (!RParenLoc.isValid() && arg_size() > 0) |
| 3261 | return getArg(arg_size() - 1)->getEndLoc(); |
| 3262 | return RParenLoc; |
| 3263 | } |
| 3264 | |
| 3265 | static bool classof(const Stmt *T) { |
| 3266 | return T->getStmtClass() == CXXUnresolvedConstructExprClass; |
| 3267 | } |
| 3268 | |
| 3269 | |
| 3270 | child_range children() { |
| 3271 | auto **begin = reinterpret_cast<Stmt **>(arg_begin()); |
| 3272 | return child_range(begin, begin + arg_size()); |
| 3273 | } |
| 3274 | }; |
| 3275 | |
| 3276 | |
| 3277 | |
| 3278 | |
| 3279 | |
| 3280 | |
| 3281 | |
| 3282 | |
| 3283 | class CXXDependentScopeMemberExpr final |
| 3284 | : public Expr, |
| 3285 | private llvm::TrailingObjects<CXXDependentScopeMemberExpr, |
| 3286 | ASTTemplateKWAndArgsInfo, |
| 3287 | TemplateArgumentLoc, NamedDecl *> { |
| 3288 | friend class ASTStmtReader; |
| 3289 | friend class ASTStmtWriter; |
| 3290 | friend TrailingObjects; |
| 3291 | |
| 3292 | |
| 3293 | |
| 3294 | Stmt *Base; |
| 3295 | |
| 3296 | |
| 3297 | |
| 3298 | QualType BaseType; |
| 3299 | |
| 3300 | |
| 3301 | |
| 3302 | |
| 3303 | NestedNameSpecifierLoc QualifierLoc; |
| 3304 | |
| 3305 | |
| 3306 | |
| 3307 | |
| 3308 | |
| 3309 | DeclarationNameInfo MemberNameInfo; |
| 3310 | |
| 3311 | |
| 3312 | |
| 3313 | |
| 3314 | |
| 3315 | |
| 3316 | |
| 3317 | |
| 3318 | |
| 3319 | |
| 3320 | |
| 3321 | |
| 3322 | |
| 3323 | |
| 3324 | |
| 3325 | |
| 3326 | bool hasTemplateKWAndArgsInfo() const { |
| 3327 | return CXXDependentScopeMemberExprBits.HasTemplateKWAndArgsInfo; |
| 3328 | } |
| 3329 | |
| 3330 | bool hasFirstQualifierFoundInScope() const { |
| 3331 | return CXXDependentScopeMemberExprBits.HasFirstQualifierFoundInScope; |
| 3332 | } |
| 3333 | |
| 3334 | unsigned numTrailingObjects(OverloadToken<ASTTemplateKWAndArgsInfo>) const { |
| 3335 | return hasTemplateKWAndArgsInfo(); |
| 3336 | } |
| 3337 | |
| 3338 | unsigned numTrailingObjects(OverloadToken<TemplateArgumentLoc>) const { |
| 3339 | return getNumTemplateArgs(); |
| 3340 | } |
| 3341 | |
| 3342 | unsigned numTrailingObjects(OverloadToken<NamedDecl *>) const { |
| 3343 | return hasFirstQualifierFoundInScope(); |
| 3344 | } |
| 3345 | |
| 3346 | CXXDependentScopeMemberExpr(const ASTContext &Ctx, Expr *Base, |
| 3347 | QualType BaseType, bool IsArrow, |
| 3348 | SourceLocation OperatorLoc, |
| 3349 | NestedNameSpecifierLoc QualifierLoc, |
| 3350 | SourceLocation TemplateKWLoc, |
| 3351 | NamedDecl *FirstQualifierFoundInScope, |
| 3352 | DeclarationNameInfo MemberNameInfo, |
| 3353 | const TemplateArgumentListInfo *TemplateArgs); |
| 3354 | |
| 3355 | CXXDependentScopeMemberExpr(EmptyShell Empty, bool HasTemplateKWAndArgsInfo, |
| 3356 | bool HasFirstQualifierFoundInScope); |
| 3357 | |
| 3358 | public: |
| 3359 | static CXXDependentScopeMemberExpr * |
| 3360 | Create(const ASTContext &Ctx, Expr *Base, QualType BaseType, bool IsArrow, |
| 3361 | SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc, |
| 3362 | SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierFoundInScope, |
| 3363 | DeclarationNameInfo MemberNameInfo, |
| 3364 | const TemplateArgumentListInfo *TemplateArgs); |
| 3365 | |
| 3366 | static CXXDependentScopeMemberExpr * |
| 3367 | CreateEmpty(const ASTContext &Ctx, bool HasTemplateKWAndArgsInfo, |
| 3368 | unsigned NumTemplateArgs, bool HasFirstQualifierFoundInScope); |
| 3369 | |
| 3370 | |
| 3371 | |
| 3372 | |
| 3373 | bool isImplicitAccess() const { |
| 3374 | if (!Base) |
| 3375 | return true; |
| 3376 | return cast<Expr>(Base)->isImplicitCXXThis(); |
| 3377 | } |
| 3378 | |
| 3379 | |
| 3380 | |
| 3381 | Expr *getBase() const { |
| 3382 | assert(!isImplicitAccess()); |
| 3383 | return cast<Expr>(Base); |
| 3384 | } |
| 3385 | |
| 3386 | QualType getBaseType() const { return BaseType; } |
| 3387 | |
| 3388 | |
| 3389 | |
| 3390 | bool isArrow() const { return CXXDependentScopeMemberExprBits.IsArrow; } |
| 3391 | |
| 3392 | |
| 3393 | SourceLocation getOperatorLoc() const { |
| 3394 | return CXXDependentScopeMemberExprBits.OperatorLoc; |
| 3395 | } |
| 3396 | |
| 3397 | |
| 3398 | NestedNameSpecifier *getQualifier() const { |
| 3399 | return QualifierLoc.getNestedNameSpecifier(); |
| 3400 | } |
| 3401 | |
| 3402 | |
| 3403 | |
| 3404 | NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; } |
| 3405 | |
| 3406 | |
| 3407 | |
| 3408 | |
| 3409 | |
| 3410 | |
| 3411 | |
| 3412 | |
| 3413 | |
| 3414 | |
| 3415 | |
| 3416 | |
| 3417 | NamedDecl *getFirstQualifierFoundInScope() const { |
| 3418 | if (!hasFirstQualifierFoundInScope()) |
| 3419 | return nullptr; |
| 3420 | return *getTrailingObjects<NamedDecl *>(); |
| 3421 | } |
| 3422 | |
| 3423 | |
| 3424 | const DeclarationNameInfo &getMemberNameInfo() const { |
| 3425 | return MemberNameInfo; |
| 3426 | } |
| 3427 | |
| 3428 | |
| 3429 | DeclarationName getMember() const { return MemberNameInfo.getName(); } |
| 3430 | |
| 3431 | |
| 3432 | |
| 3433 | SourceLocation getMemberLoc() const { return MemberNameInfo.getLoc(); } |
| 3434 | |
| 3435 | |
| 3436 | |
| 3437 | SourceLocation getTemplateKeywordLoc() const { |
| 3438 | if (!hasTemplateKWAndArgsInfo()) |
| 3439 | return SourceLocation(); |
| 3440 | return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->TemplateKWLoc; |
| 3441 | } |
| 3442 | |
| 3443 | |
| 3444 | |
| 3445 | SourceLocation getLAngleLoc() const { |
| 3446 | if (!hasTemplateKWAndArgsInfo()) |
| 3447 | return SourceLocation(); |
| 3448 | return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->LAngleLoc; |
| 3449 | } |
| 3450 | |
| 3451 | |
| 3452 | |
| 3453 | SourceLocation getRAngleLoc() const { |
| 3454 | if (!hasTemplateKWAndArgsInfo()) |
| 3455 | return SourceLocation(); |
| 3456 | return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->RAngleLoc; |
| 3457 | } |
| 3458 | |
| 3459 | |
| 3460 | bool hasTemplateKeyword() const { return getTemplateKeywordLoc().isValid(); } |
| 3461 | |
| 3462 | |
| 3463 | |
| 3464 | bool hasExplicitTemplateArgs() const { return getLAngleLoc().isValid(); } |
| 3465 | |
| 3466 | |
| 3467 | |
| 3468 | void copyTemplateArgumentsInto(TemplateArgumentListInfo &List) const { |
| 3469 | if (hasExplicitTemplateArgs()) |
| 3470 | getTrailingObjects<ASTTemplateKWAndArgsInfo>()->copyInto( |
| 3471 | getTrailingObjects<TemplateArgumentLoc>(), List); |
| 3472 | } |
| 3473 | |
| 3474 | |
| 3475 | |
| 3476 | const TemplateArgumentLoc *getTemplateArgs() const { |
| 3477 | if (!hasExplicitTemplateArgs()) |
| 3478 | return nullptr; |
| 3479 | |
| 3480 | return getTrailingObjects<TemplateArgumentLoc>(); |
| 3481 | } |
| 3482 | |
| 3483 | |
| 3484 | |
| 3485 | unsigned getNumTemplateArgs() const { |
| 3486 | if (!hasExplicitTemplateArgs()) |
| 3487 | return 0; |
| 3488 | |
| 3489 | return getTrailingObjects<ASTTemplateKWAndArgsInfo>()->NumTemplateArgs; |
| 3490 | } |
| 3491 | |
| 3492 | ArrayRef<TemplateArgumentLoc> template_arguments() const { |
| 3493 | return {getTemplateArgs(), getNumTemplateArgs()}; |
| 3494 | } |
| 3495 | |
| 3496 | SourceLocation getBeginLoc() const LLVM_READONLY { |
| 3497 | if (!isImplicitAccess()) |
| 3498 | return Base->getBeginLoc(); |
| 3499 | if (getQualifier()) |
| 3500 | return getQualifierLoc().getBeginLoc(); |
| 3501 | return MemberNameInfo.getBeginLoc(); |
| 3502 | } |
| 3503 | |
| 3504 | SourceLocation getEndLoc() const LLVM_READONLY { |
| 3505 | if (hasExplicitTemplateArgs()) |
| 3506 | return getRAngleLoc(); |
| 3507 | return MemberNameInfo.getEndLoc(); |
| 3508 | } |
| 3509 | |
| 3510 | static bool classof(const Stmt *T) { |
| 3511 | return T->getStmtClass() == CXXDependentScopeMemberExprClass; |
| 3512 | } |
| 3513 | |
| 3514 | |
| 3515 | child_range children() { |
| 3516 | if (isImplicitAccess()) |
| 3517 | return child_range(child_iterator(), child_iterator()); |
| 3518 | return child_range(&Base, &Base + 1); |
| 3519 | } |
| 3520 | }; |
| 3521 | |
| 3522 | |
| 3523 | |
| 3524 | |
| 3525 | |
| 3526 | |
| 3527 | |
| 3528 | |
| 3529 | |
| 3530 | |
| 3531 | |
| 3532 | |
| 3533 | |
| 3534 | |
| 3535 | |
| 3536 | |
| 3537 | class UnresolvedMemberExpr final |
| 3538 | : public OverloadExpr, |
| 3539 | private llvm::TrailingObjects<UnresolvedMemberExpr, DeclAccessPair, |
| 3540 | ASTTemplateKWAndArgsInfo, |
| 3541 | TemplateArgumentLoc> { |
| 3542 | friend class ASTStmtReader; |
| 3543 | friend class OverloadExpr; |
| 3544 | friend TrailingObjects; |
| 3545 | |
| 3546 | |
| 3547 | |
| 3548 | |
| 3549 | |
| 3550 | Stmt *Base; |
| 3551 | |
| 3552 | |
| 3553 | QualType BaseType; |
| 3554 | |
| 3555 | |
| 3556 | SourceLocation OperatorLoc; |
| 3557 | |
| 3558 | |
| 3559 | |
| 3560 | |
| 3561 | |
| 3562 | |
| 3563 | |
| 3564 | |
| 3565 | |
| 3566 | |
| 3567 | |
| 3568 | |
| 3569 | |
| 3570 | |
| 3571 | |
| 3572 | UnresolvedMemberExpr(const ASTContext &Context, bool HasUnresolvedUsing, |
| 3573 | Expr *Base, QualType BaseType, bool IsArrow, |
| 3574 | SourceLocation OperatorLoc, |
| 3575 | NestedNameSpecifierLoc QualifierLoc, |
| 3576 | SourceLocation TemplateKWLoc, |
| 3577 | const DeclarationNameInfo &MemberNameInfo, |
| 3578 | const TemplateArgumentListInfo *TemplateArgs, |
| 3579 | UnresolvedSetIterator Begin, UnresolvedSetIterator End); |
| 3580 | |
| 3581 | UnresolvedMemberExpr(EmptyShell Empty, unsigned NumResults, |
| 3582 | bool HasTemplateKWAndArgsInfo); |
| 3583 | |
| 3584 | unsigned numTrailingObjects(OverloadToken<DeclAccessPair>) const { |
| 3585 | return getNumDecls(); |
| 3586 | } |
| 3587 | |
| 3588 | unsigned numTrailingObjects(OverloadToken<ASTTemplateKWAndArgsInfo>) const { |
| 3589 | return hasTemplateKWAndArgsInfo(); |
| 3590 | } |
| 3591 | |
| 3592 | public: |
| 3593 | static UnresolvedMemberExpr * |
| 3594 | Create(const ASTContext &Context, bool HasUnresolvedUsing, Expr *Base, |
| 3595 | QualType BaseType, bool IsArrow, SourceLocation OperatorLoc, |
| 3596 | NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, |
| 3597 | const DeclarationNameInfo &MemberNameInfo, |
| 3598 | const TemplateArgumentListInfo *TemplateArgs, |
| 3599 | UnresolvedSetIterator Begin, UnresolvedSetIterator End); |
| 3600 | |
| 3601 | static UnresolvedMemberExpr *CreateEmpty(const ASTContext &Context, |
| 3602 | unsigned NumResults, |
| 3603 | bool HasTemplateKWAndArgsInfo, |
| 3604 | unsigned NumTemplateArgs); |
| 3605 | |
| 3606 | |
| 3607 | |
| 3608 | |
| 3609 | |
| 3610 | bool isImplicitAccess() const; |
| 3611 | |
| 3612 | |
| 3613 | |
| 3614 | Expr *getBase() { |
| 3615 | assert(!isImplicitAccess()); |
| 3616 | return cast<Expr>(Base); |
| 3617 | } |
| 3618 | const Expr *getBase() const { |
| 3619 | assert(!isImplicitAccess()); |
| 3620 | return cast<Expr>(Base); |
| 3621 | } |
| 3622 | |
| 3623 | QualType getBaseType() const { return BaseType; } |
| 3624 | |
| 3625 | |
| 3626 | |
| 3627 | bool hasUnresolvedUsing() const { |
| 3628 | return UnresolvedMemberExprBits.HasUnresolvedUsing; |
| 3629 | } |
| 3630 | |
| 3631 | |
| 3632 | |
| 3633 | bool isArrow() const { return UnresolvedMemberExprBits.IsArrow; } |
| 3634 | |
| 3635 | |
| 3636 | SourceLocation getOperatorLoc() const { return OperatorLoc; } |
| 3637 | |
| 3638 | |
| 3639 | CXXRecordDecl *getNamingClass(); |
| 3640 | const CXXRecordDecl *getNamingClass() const { |
| 3641 | return const_cast<UnresolvedMemberExpr *>(this)->getNamingClass(); |
| 3642 | } |
| 3643 | |
| 3644 | |
| 3645 | |
| 3646 | const DeclarationNameInfo &getMemberNameInfo() const { return getNameInfo(); } |
| 3647 | |
| 3648 | |
| 3649 | DeclarationName getMemberName() const { return getName(); } |
| 3650 | |
| 3651 | |
| 3652 | |
| 3653 | SourceLocation getMemberLoc() const { return getNameLoc(); } |
| 3654 | |
| 3655 | |
| 3656 | |
| 3657 | SourceLocation getExprLoc() const LLVM_READONLY { return getMemberLoc(); } |
| 3658 | |
| 3659 | SourceLocation getBeginLoc() const LLVM_READONLY { |
| 3660 | if (!isImplicitAccess()) |
| 3661 | return Base->getBeginLoc(); |
| 3662 | if (NestedNameSpecifierLoc l = getQualifierLoc()) |
| 3663 | return l.getBeginLoc(); |
| 3664 | return getMemberNameInfo().getBeginLoc(); |
| 3665 | } |
| 3666 | |
| 3667 | SourceLocation getEndLoc() const LLVM_READONLY { |
| 3668 | if (hasExplicitTemplateArgs()) |
| 3669 | return getRAngleLoc(); |
| 3670 | return getMemberNameInfo().getEndLoc(); |
| 3671 | } |
| 3672 | |
| 3673 | static bool classof(const Stmt *T) { |
| 3674 | return T->getStmtClass() == UnresolvedMemberExprClass; |
| 3675 | } |
| 3676 | |
| 3677 | |
| 3678 | child_range children() { |
| 3679 | if (isImplicitAccess()) |
| 3680 | return child_range(child_iterator(), child_iterator()); |
| 3681 | return child_range(&Base, &Base + 1); |
| 3682 | } |
| 3683 | }; |
| 3684 | |
| 3685 | DeclAccessPair *OverloadExpr::getTrailingResults() { |
| 3686 | if (auto *ULE = dyn_cast<UnresolvedLookupExpr>(this)) |
| 3687 | return ULE->getTrailingObjects<DeclAccessPair>(); |
| 3688 | return cast<UnresolvedMemberExpr>(this)->getTrailingObjects<DeclAccessPair>(); |
| 3689 | } |
| 3690 | |
| 3691 | ASTTemplateKWAndArgsInfo *OverloadExpr::getTrailingASTTemplateKWAndArgsInfo() { |
| 3692 | if (!hasTemplateKWAndArgsInfo()) |
| 3693 | return nullptr; |
| 3694 | |
| 3695 | if (auto *ULE = dyn_cast<UnresolvedLookupExpr>(this)) |
| 3696 | return ULE->getTrailingObjects<ASTTemplateKWAndArgsInfo>(); |
| 3697 | return cast<UnresolvedMemberExpr>(this) |
| 3698 | ->getTrailingObjects<ASTTemplateKWAndArgsInfo>(); |
| 3699 | } |
| 3700 | |
| 3701 | TemplateArgumentLoc *OverloadExpr::getTrailingTemplateArgumentLoc() { |
| 3702 | if (auto *ULE = dyn_cast<UnresolvedLookupExpr>(this)) |
| 3703 | return ULE->getTrailingObjects<TemplateArgumentLoc>(); |
| 3704 | return cast<UnresolvedMemberExpr>(this) |
| 3705 | ->getTrailingObjects<TemplateArgumentLoc>(); |
| 3706 | } |
| 3707 | |
| 3708 | CXXRecordDecl *OverloadExpr::getNamingClass() { |
| 3709 | if (auto *ULE = dyn_cast<UnresolvedLookupExpr>(this)) |
| 3710 | return ULE->getNamingClass(); |
| 3711 | return cast<UnresolvedMemberExpr>(this)->getNamingClass(); |
| 3712 | } |
| 3713 | |
| 3714 | |
| 3715 | |
| 3716 | |
| 3717 | |
| 3718 | class CXXNoexceptExpr : public Expr { |
| 3719 | friend class ASTStmtReader; |
| 3720 | |
| 3721 | Stmt *Operand; |
| 3722 | SourceRange Range; |
| 3723 | |
| 3724 | public: |
| 3725 | CXXNoexceptExpr(QualType Ty, Expr *Operand, CanThrowResult Val, |
| 3726 | SourceLocation Keyword, SourceLocation RParen) |
| 3727 | : Expr(CXXNoexceptExprClass, Ty, VK_RValue, OK_Ordinary, |
| 3728 | false, |
| 3729 | Val == CT_Dependent, |
| 3730 | Val == CT_Dependent || Operand->isInstantiationDependent(), |
| 3731 | Operand->containsUnexpandedParameterPack()), |
| 3732 | Operand(Operand), Range(Keyword, RParen) { |
| 3733 | CXXNoexceptExprBits.Value = Val == CT_Cannot; |
| 3734 | } |
| 3735 | |
| 3736 | CXXNoexceptExpr(EmptyShell Empty) : Expr(CXXNoexceptExprClass, Empty) {} |
| 3737 | |
| 3738 | Expr *getOperand() const { return static_cast<Expr *>(Operand); } |
| 3739 | |
| 3740 | SourceLocation getBeginLoc() const { return Range.getBegin(); } |
| 3741 | SourceLocation getEndLoc() const { return Range.getEnd(); } |
| 3742 | SourceRange getSourceRange() const { return Range; } |
| 3743 | |
| 3744 | bool getValue() const { return CXXNoexceptExprBits.Value; } |
| 3745 | |
| 3746 | static bool classof(const Stmt *T) { |
| 3747 | return T->getStmtClass() == CXXNoexceptExprClass; |
| 3748 | } |
| 3749 | |
| 3750 | |
| 3751 | child_range children() { return child_range(&Operand, &Operand + 1); } |
| 3752 | }; |
| 3753 | |
| 3754 | |
| 3755 | |
| 3756 | |
| 3757 | |
| 3758 | |
| 3759 | |
| 3760 | |
| 3761 | |
| 3762 | |
| 3763 | |
| 3764 | |
| 3765 | |
| 3766 | |
| 3767 | |
| 3768 | |
| 3769 | |
| 3770 | |
| 3771 | class PackExpansionExpr : public Expr { |
| 3772 | friend class ASTStmtReader; |
| 3773 | friend class ASTStmtWriter; |
| 3774 | |
| 3775 | SourceLocation EllipsisLoc; |
| 3776 | |
| 3777 | |
| 3778 | |
| 3779 | |
| 3780 | |
| 3781 | |
| 3782 | unsigned NumExpansions; |
| 3783 | |
| 3784 | Stmt *Pattern; |
| 3785 | |
| 3786 | public: |
| 3787 | PackExpansionExpr(QualType T, Expr *Pattern, SourceLocation EllipsisLoc, |
| 3788 | Optional<unsigned> NumExpansions) |
| 3789 | : Expr(PackExpansionExprClass, T, Pattern->getValueKind(), |
| 3790 | Pattern->getObjectKind(), , |
| 3791 | , , |
| 3792 | ), |
| 3793 | EllipsisLoc(EllipsisLoc), |
| 3794 | NumExpansions(NumExpansions ? *NumExpansions + 1 : 0), |
| 3795 | Pattern(Pattern) {} |
| 3796 | |
| 3797 | PackExpansionExpr(EmptyShell Empty) : Expr(PackExpansionExprClass, Empty) {} |
| 3798 | |
| 3799 | |
| 3800 | Expr *getPattern() { return reinterpret_cast<Expr *>(Pattern); } |
| 3801 | |
| 3802 | |
| 3803 | const Expr *getPattern() const { return reinterpret_cast<Expr *>(Pattern); } |
| 3804 | |
| 3805 | |
| 3806 | |
| 3807 | SourceLocation getEllipsisLoc() const { return EllipsisLoc; } |
| 3808 | |
| 3809 | |
| 3810 | |
| 3811 | Optional<unsigned> getNumExpansions() const { |
| 3812 | if (NumExpansions) |
| 3813 | return NumExpansions - 1; |
| 3814 | |
| 3815 | return None; |
| 3816 | } |
| 3817 | |
| 3818 | SourceLocation getBeginLoc() const LLVM_READONLY { |
| 3819 | return Pattern->getBeginLoc(); |
| 3820 | } |
| 3821 | |
| 3822 | SourceLocation getEndLoc() const LLVM_READONLY { return EllipsisLoc; } |
| 3823 | |
| 3824 | static bool classof(const Stmt *T) { |
| 3825 | return T->getStmtClass() == PackExpansionExprClass; |
| 3826 | } |
| 3827 | |
| 3828 | |
| 3829 | child_range children() { |
| 3830 | return child_range(&Pattern, &Pattern + 1); |
| 3831 | } |
| 3832 | }; |
| 3833 | |
| 3834 | |
| 3835 | |
| 3836 | |
| 3837 | |
| 3838 | |
| 3839 | |
| 3840 | |
| 3841 | |
| 3842 | |
| 3843 | class SizeOfPackExpr final |
| 3844 | : public Expr, |
| 3845 | private llvm::TrailingObjects<SizeOfPackExpr, TemplateArgument> { |
| 3846 | friend class ASTStmtReader; |
| 3847 | friend class ASTStmtWriter; |
| 3848 | friend TrailingObjects; |
| 3849 | |
| 3850 | |
| 3851 | SourceLocation OperatorLoc; |
| 3852 | |
| 3853 | |
| 3854 | SourceLocation PackLoc; |
| 3855 | |
| 3856 | |
| 3857 | SourceLocation RParenLoc; |
| 3858 | |
| 3859 | |
| 3860 | |
| 3861 | |
| 3862 | |
| 3863 | |
| 3864 | |
| 3865 | |
| 3866 | |
| 3867 | |
| 3868 | |
| 3869 | unsigned Length; |
| 3870 | |
| 3871 | |
| 3872 | NamedDecl *Pack = nullptr; |
| 3873 | |
| 3874 | |
| 3875 | |
| 3876 | SizeOfPackExpr(QualType SizeType, SourceLocation OperatorLoc, NamedDecl *Pack, |
| 3877 | SourceLocation PackLoc, SourceLocation RParenLoc, |
| 3878 | Optional<unsigned> Length, ArrayRef<TemplateArgument> PartialArgs) |
| 3879 | : Expr(SizeOfPackExprClass, SizeType, VK_RValue, OK_Ordinary, |
| 3880 | , !Length, |
| 3881 | !Length, |
| 3882 | ), |
| 3883 | OperatorLoc(OperatorLoc), PackLoc(PackLoc), RParenLoc(RParenLoc), |
| 3884 | Length(Length ? *Length : PartialArgs.size()), Pack(Pack) { |
| 3885 | (0) . __assert_fail ("(!Length || PartialArgs.empty()) && \"have partial args for non-dependent sizeof... expression\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprCXX.h", 3886, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert((!Length || PartialArgs.empty()) && |
| 3886 | (0) . __assert_fail ("(!Length || PartialArgs.empty()) && \"have partial args for non-dependent sizeof... expression\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprCXX.h", 3886, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "have partial args for non-dependent sizeof... expression"); |
| 3887 | auto *Args = getTrailingObjects<TemplateArgument>(); |
| 3888 | std::uninitialized_copy(PartialArgs.begin(), PartialArgs.end(), Args); |
| 3889 | } |
| 3890 | |
| 3891 | |
| 3892 | SizeOfPackExpr(EmptyShell Empty, unsigned NumPartialArgs) |
| 3893 | : Expr(SizeOfPackExprClass, Empty), Length(NumPartialArgs) {} |
| 3894 | |
| 3895 | public: |
| 3896 | static SizeOfPackExpr *Create(ASTContext &Context, SourceLocation OperatorLoc, |
| 3897 | NamedDecl *Pack, SourceLocation PackLoc, |
| 3898 | SourceLocation RParenLoc, |
| 3899 | Optional<unsigned> Length = None, |
| 3900 | ArrayRef<TemplateArgument> PartialArgs = None); |
| 3901 | static SizeOfPackExpr *CreateDeserialized(ASTContext &Context, |
| 3902 | unsigned NumPartialArgs); |
| 3903 | |
| 3904 | |
| 3905 | SourceLocation getOperatorLoc() const { return OperatorLoc; } |
| 3906 | |
| 3907 | |
| 3908 | SourceLocation getPackLoc() const { return PackLoc; } |
| 3909 | |
| 3910 | |
| 3911 | SourceLocation getRParenLoc() const { return RParenLoc; } |
| 3912 | |
| 3913 | |
| 3914 | NamedDecl *getPack() const { return Pack; } |
| 3915 | |
| 3916 | |
| 3917 | |
| 3918 | |
| 3919 | |
| 3920 | unsigned getPackLength() const { |
| 3921 | (0) . __assert_fail ("!isValueDependent() && \"Cannot get the length of a value-dependent pack size expression\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprCXX.h", 3922, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(!isValueDependent() && |
| 3922 | (0) . __assert_fail ("!isValueDependent() && \"Cannot get the length of a value-dependent pack size expression\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprCXX.h", 3922, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "Cannot get the length of a value-dependent pack size expression"); |
| 3923 | return Length; |
| 3924 | } |
| 3925 | |
| 3926 | |
| 3927 | |
| 3928 | |
| 3929 | |
| 3930 | |
| 3931 | bool isPartiallySubstituted() const { |
| 3932 | return isValueDependent() && Length; |
| 3933 | } |
| 3934 | |
| 3935 | |
| 3936 | ArrayRef<TemplateArgument> getPartialArguments() const { |
| 3937 | assert(isPartiallySubstituted()); |
| 3938 | const auto *Args = getTrailingObjects<TemplateArgument>(); |
| 3939 | return llvm::makeArrayRef(Args, Args + Length); |
| 3940 | } |
| 3941 | |
| 3942 | SourceLocation getBeginLoc() const LLVM_READONLY { return OperatorLoc; } |
| 3943 | SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; } |
| 3944 | |
| 3945 | static bool classof(const Stmt *T) { |
| 3946 | return T->getStmtClass() == SizeOfPackExprClass; |
| 3947 | } |
| 3948 | |
| 3949 | |
| 3950 | child_range children() { |
| 3951 | return child_range(child_iterator(), child_iterator()); |
| 3952 | } |
| 3953 | }; |
| 3954 | |
| 3955 | |
| 3956 | |
| 3957 | class SubstNonTypeTemplateParmExpr : public Expr { |
| 3958 | friend class ASTReader; |
| 3959 | friend class ASTStmtReader; |
| 3960 | |
| 3961 | |
| 3962 | NonTypeTemplateParmDecl *Param; |
| 3963 | |
| 3964 | |
| 3965 | Stmt *Replacement; |
| 3966 | |
| 3967 | explicit SubstNonTypeTemplateParmExpr(EmptyShell Empty) |
| 3968 | : Expr(SubstNonTypeTemplateParmExprClass, Empty) {} |
| 3969 | |
| 3970 | public: |
| 3971 | SubstNonTypeTemplateParmExpr(QualType Ty, ExprValueKind ValueKind, |
| 3972 | SourceLocation Loc, |
| 3973 | NonTypeTemplateParmDecl *Param, |
| 3974 | Expr *Replacement) |
| 3975 | : Expr(SubstNonTypeTemplateParmExprClass, Ty, ValueKind, OK_Ordinary, |
| 3976 | Replacement->isTypeDependent(), Replacement->isValueDependent(), |
| 3977 | Replacement->isInstantiationDependent(), |
| 3978 | Replacement->containsUnexpandedParameterPack()), |
| 3979 | Param(Param), Replacement(Replacement) { |
| 3980 | SubstNonTypeTemplateParmExprBits.NameLoc = Loc; |
| 3981 | } |
| 3982 | |
| 3983 | SourceLocation getNameLoc() const { |
| 3984 | return SubstNonTypeTemplateParmExprBits.NameLoc; |
| 3985 | } |
| 3986 | SourceLocation getBeginLoc() const { return getNameLoc(); } |
| 3987 | SourceLocation getEndLoc() const { return getNameLoc(); } |
| 3988 | |
| 3989 | Expr *getReplacement() const { return cast<Expr>(Replacement); } |
| 3990 | |
| 3991 | NonTypeTemplateParmDecl *getParameter() const { return Param; } |
| 3992 | |
| 3993 | static bool classof(const Stmt *s) { |
| 3994 | return s->getStmtClass() == SubstNonTypeTemplateParmExprClass; |
| 3995 | } |
| 3996 | |
| 3997 | |
| 3998 | child_range children() { return child_range(&Replacement, &Replacement + 1); } |
| 3999 | }; |
| 4000 | |
| 4001 | |
| 4002 | |
| 4003 | |
| 4004 | |
| 4005 | |
| 4006 | |
| 4007 | |
| 4008 | |
| 4009 | |
| 4010 | |
| 4011 | |
| 4012 | |
| 4013 | class SubstNonTypeTemplateParmPackExpr : public Expr { |
| 4014 | friend class ASTReader; |
| 4015 | friend class ASTStmtReader; |
| 4016 | |
| 4017 | |
| 4018 | NonTypeTemplateParmDecl *Param; |
| 4019 | |
| 4020 | |
| 4021 | |
| 4022 | const TemplateArgument *Arguments; |
| 4023 | |
| 4024 | |
| 4025 | unsigned NumArguments; |
| 4026 | |
| 4027 | |
| 4028 | SourceLocation NameLoc; |
| 4029 | |
| 4030 | explicit SubstNonTypeTemplateParmPackExpr(EmptyShell Empty) |
| 4031 | : Expr(SubstNonTypeTemplateParmPackExprClass, Empty) {} |
| 4032 | |
| 4033 | public: |
| 4034 | SubstNonTypeTemplateParmPackExpr(QualType T, |
| 4035 | ExprValueKind ValueKind, |
| 4036 | NonTypeTemplateParmDecl *Param, |
| 4037 | SourceLocation NameLoc, |
| 4038 | const TemplateArgument &ArgPack); |
| 4039 | |
| 4040 | |
| 4041 | NonTypeTemplateParmDecl *getParameterPack() const { return Param; } |
| 4042 | |
| 4043 | |
| 4044 | SourceLocation getParameterPackLocation() const { return NameLoc; } |
| 4045 | |
| 4046 | |
| 4047 | |
| 4048 | TemplateArgument getArgumentPack() const; |
| 4049 | |
| 4050 | SourceLocation getBeginLoc() const LLVM_READONLY { return NameLoc; } |
| 4051 | SourceLocation getEndLoc() const LLVM_READONLY { return NameLoc; } |
| 4052 | |
| 4053 | static bool classof(const Stmt *T) { |
| 4054 | return T->getStmtClass() == SubstNonTypeTemplateParmPackExprClass; |
| 4055 | } |
| 4056 | |
| 4057 | |
| 4058 | child_range children() { |
| 4059 | return child_range(child_iterator(), child_iterator()); |
| 4060 | } |
| 4061 | }; |
| 4062 | |
| 4063 | |
| 4064 | |
| 4065 | |
| 4066 | |
| 4067 | |
| 4068 | |
| 4069 | |
| 4070 | |
| 4071 | |
| 4072 | |
| 4073 | |
| 4074 | |
| 4075 | |
| 4076 | |
| 4077 | class FunctionParmPackExpr final |
| 4078 | : public Expr, |
| 4079 | private llvm::TrailingObjects<FunctionParmPackExpr, ParmVarDecl *> { |
| 4080 | friend class ASTReader; |
| 4081 | friend class ASTStmtReader; |
| 4082 | friend TrailingObjects; |
| 4083 | |
| 4084 | |
| 4085 | ParmVarDecl *ParamPack; |
| 4086 | |
| 4087 | |
| 4088 | SourceLocation NameLoc; |
| 4089 | |
| 4090 | |
| 4091 | unsigned NumParameters; |
| 4092 | |
| 4093 | FunctionParmPackExpr(QualType T, ParmVarDecl *ParamPack, |
| 4094 | SourceLocation NameLoc, unsigned NumParams, |
| 4095 | ParmVarDecl *const *Params); |
| 4096 | |
| 4097 | public: |
| 4098 | static FunctionParmPackExpr *Create(const ASTContext &Context, QualType T, |
| 4099 | ParmVarDecl *ParamPack, |
| 4100 | SourceLocation NameLoc, |
| 4101 | ArrayRef<ParmVarDecl *> Params); |
| 4102 | static FunctionParmPackExpr *CreateEmpty(const ASTContext &Context, |
| 4103 | unsigned NumParams); |
| 4104 | |
| 4105 | |
| 4106 | ParmVarDecl *getParameterPack() const { return ParamPack; } |
| 4107 | |
| 4108 | |
| 4109 | SourceLocation getParameterPackLocation() const { return NameLoc; } |
| 4110 | |
| 4111 | |
| 4112 | |
| 4113 | using iterator = ParmVarDecl * const *; |
| 4114 | iterator begin() const { return getTrailingObjects<ParmVarDecl *>(); } |
| 4115 | iterator end() const { return begin() + NumParameters; } |
| 4116 | |
| 4117 | |
| 4118 | unsigned getNumExpansions() const { return NumParameters; } |
| 4119 | |
| 4120 | |
| 4121 | ParmVarDecl *getExpansion(unsigned I) const { return begin()[I]; } |
| 4122 | |
| 4123 | SourceLocation getBeginLoc() const LLVM_READONLY { return NameLoc; } |
| 4124 | SourceLocation getEndLoc() const LLVM_READONLY { return NameLoc; } |
| 4125 | |
| 4126 | static bool classof(const Stmt *T) { |
| 4127 | return T->getStmtClass() == FunctionParmPackExprClass; |
| 4128 | } |
| 4129 | |
| 4130 | child_range children() { |
| 4131 | return child_range(child_iterator(), child_iterator()); |
| 4132 | } |
| 4133 | }; |
| 4134 | |
| 4135 | |
| 4136 | |
| 4137 | |
| 4138 | |
| 4139 | |
| 4140 | |
| 4141 | |
| 4142 | |
| 4143 | |
| 4144 | |
| 4145 | |
| 4146 | |
| 4147 | |
| 4148 | |
| 4149 | |
| 4150 | |
| 4151 | |
| 4152 | |
| 4153 | |
| 4154 | |
| 4155 | class MaterializeTemporaryExpr : public Expr { |
| 4156 | private: |
| 4157 | friend class ASTStmtReader; |
| 4158 | friend class ASTStmtWriter; |
| 4159 | |
| 4160 | struct { |
| 4161 | |
| 4162 | |
| 4163 | Stmt *; |
| 4164 | |
| 4165 | |
| 4166 | |
| 4167 | const ValueDecl *; |
| 4168 | |
| 4169 | unsigned ; |
| 4170 | }; |
| 4171 | llvm::PointerUnion<Stmt *, ExtraState *> State; |
| 4172 | |
| 4173 | void (const ValueDecl *ExtendedBy, |
| 4174 | unsigned ManglingNumber); |
| 4175 | |
| 4176 | public: |
| 4177 | MaterializeTemporaryExpr(QualType T, Expr *Temporary, |
| 4178 | bool BoundToLvalueReference) |
| 4179 | : Expr(MaterializeTemporaryExprClass, T, |
| 4180 | BoundToLvalueReference? VK_LValue : VK_XValue, OK_Ordinary, |
| 4181 | Temporary->isTypeDependent(), Temporary->isValueDependent(), |
| 4182 | Temporary->isInstantiationDependent(), |
| 4183 | Temporary->containsUnexpandedParameterPack()), |
| 4184 | State(Temporary) {} |
| 4185 | |
| 4186 | MaterializeTemporaryExpr(EmptyShell Empty) |
| 4187 | : Expr(MaterializeTemporaryExprClass, Empty) {} |
| 4188 | |
| 4189 | Stmt *getTemporary() const { |
| 4190 | return State.is<Stmt *>() ? State.get<Stmt *>() |
| 4191 | : State.get<ExtraState *>()->Temporary; |
| 4192 | } |
| 4193 | |
| 4194 | |
| 4195 | |
| 4196 | Expr *GetTemporaryExpr() const { return static_cast<Expr *>(getTemporary()); } |
| 4197 | |
| 4198 | |
| 4199 | StorageDuration getStorageDuration() const { |
| 4200 | const ValueDecl *ExtendingDecl = getExtendingDecl(); |
| 4201 | if (!ExtendingDecl) |
| 4202 | return SD_FullExpression; |
| 4203 | |
| 4204 | |
| 4205 | if (isa<FieldDecl>(ExtendingDecl)) |
| 4206 | return SD_Automatic; |
| 4207 | |
| 4208 | |
| 4209 | if (isa<BindingDecl>(ExtendingDecl)) |
| 4210 | return ExtendingDecl->getDeclContext()->isFunctionOrMethod() |
| 4211 | ? SD_Automatic |
| 4212 | : SD_Static; |
| 4213 | return cast<VarDecl>(ExtendingDecl)->getStorageDuration(); |
| 4214 | } |
| 4215 | |
| 4216 | |
| 4217 | |
| 4218 | const ValueDecl *getExtendingDecl() const { |
| 4219 | return State.is<Stmt *>() ? nullptr |
| 4220 | : State.get<ExtraState *>()->ExtendingDecl; |
| 4221 | } |
| 4222 | |
| 4223 | void setExtendingDecl(const ValueDecl *ExtendedBy, unsigned ManglingNumber); |
| 4224 | |
| 4225 | unsigned getManglingNumber() const { |
| 4226 | return State.is<Stmt *>() ? 0 : State.get<ExtraState *>()->ManglingNumber; |
| 4227 | } |
| 4228 | |
| 4229 | |
| 4230 | |
| 4231 | bool isBoundToLvalueReference() const { |
| 4232 | return getValueKind() == VK_LValue; |
| 4233 | } |
| 4234 | |
| 4235 | SourceLocation getBeginLoc() const LLVM_READONLY { |
| 4236 | return getTemporary()->getBeginLoc(); |
| 4237 | } |
| 4238 | |
| 4239 | SourceLocation getEndLoc() const LLVM_READONLY { |
| 4240 | return getTemporary()->getEndLoc(); |
| 4241 | } |
| 4242 | |
| 4243 | static bool classof(const Stmt *T) { |
| 4244 | return T->getStmtClass() == MaterializeTemporaryExprClass; |
| 4245 | } |
| 4246 | |
| 4247 | |
| 4248 | child_range children() { |
| 4249 | if (State.is<Stmt *>()) |
| 4250 | return child_range(State.getAddrOfPtr1(), State.getAddrOfPtr1() + 1); |
| 4251 | |
| 4252 | auto ES = State.get<ExtraState *>(); |
| 4253 | return child_range(&ES->Temporary, &ES->Temporary + 1); |
| 4254 | } |
| 4255 | }; |
| 4256 | |
| 4257 | |
| 4258 | |
| 4259 | |
| 4260 | |
| 4261 | |
| 4262 | |
| 4263 | |
| 4264 | |
| 4265 | class CXXFoldExpr : public Expr { |
| 4266 | friend class ASTStmtReader; |
| 4267 | friend class ASTStmtWriter; |
| 4268 | |
| 4269 | SourceLocation LParenLoc; |
| 4270 | SourceLocation EllipsisLoc; |
| 4271 | SourceLocation RParenLoc; |
| 4272 | Stmt *SubExprs[2]; |
| 4273 | BinaryOperatorKind Opcode; |
| 4274 | |
| 4275 | public: |
| 4276 | CXXFoldExpr(QualType T, SourceLocation LParenLoc, Expr *LHS, |
| 4277 | BinaryOperatorKind Opcode, SourceLocation EllipsisLoc, Expr *RHS, |
| 4278 | SourceLocation RParenLoc) |
| 4279 | : Expr(CXXFoldExprClass, T, VK_RValue, OK_Ordinary, |
| 4280 | true, true, true, |
| 4281 | false), |
| 4282 | LParenLoc(LParenLoc), EllipsisLoc(EllipsisLoc), RParenLoc(RParenLoc), |
| 4283 | Opcode(Opcode) { |
| 4284 | SubExprs[0] = LHS; |
| 4285 | SubExprs[1] = RHS; |
| 4286 | } |
| 4287 | |
| 4288 | CXXFoldExpr(EmptyShell Empty) : Expr(CXXFoldExprClass, Empty) {} |
| 4289 | |
| 4290 | Expr *getLHS() const { return static_cast<Expr*>(SubExprs[0]); } |
| 4291 | Expr *getRHS() const { return static_cast<Expr*>(SubExprs[1]); } |
| 4292 | |
| 4293 | |
| 4294 | bool isRightFold() const { |
| 4295 | return getLHS() && getLHS()->containsUnexpandedParameterPack(); |
| 4296 | } |
| 4297 | |
| 4298 | |
| 4299 | bool isLeftFold() const { return !isRightFold(); } |
| 4300 | |
| 4301 | |
| 4302 | Expr *getPattern() const { return isLeftFold() ? getRHS() : getLHS(); } |
| 4303 | |
| 4304 | |
| 4305 | Expr *getInit() const { return isLeftFold() ? getLHS() : getRHS(); } |
| 4306 | |
| 4307 | SourceLocation getEllipsisLoc() const { return EllipsisLoc; } |
| 4308 | BinaryOperatorKind getOperator() const { return Opcode; } |
| 4309 | |
| 4310 | SourceLocation getBeginLoc() const LLVM_READONLY { return LParenLoc; } |
| 4311 | |
| 4312 | SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; } |
| 4313 | |
| 4314 | static bool classof(const Stmt *T) { |
| 4315 | return T->getStmtClass() == CXXFoldExprClass; |
| 4316 | } |
| 4317 | |
| 4318 | |
| 4319 | child_range children() { return child_range(SubExprs, SubExprs + 2); } |
| 4320 | }; |
| 4321 | |
| 4322 | |
| 4323 | |
| 4324 | |
| 4325 | |
| 4326 | |
| 4327 | |
| 4328 | |
| 4329 | |
| 4330 | |
| 4331 | |
| 4332 | |
| 4333 | |
| 4334 | |
| 4335 | class CoroutineSuspendExpr : public Expr { |
| 4336 | friend class ASTStmtReader; |
| 4337 | |
| 4338 | SourceLocation KeywordLoc; |
| 4339 | |
| 4340 | enum SubExpr { Common, Ready, Suspend, Resume, Count }; |
| 4341 | |
| 4342 | Stmt *SubExprs[SubExpr::Count]; |
| 4343 | OpaqueValueExpr *OpaqueValue = nullptr; |
| 4344 | |
| 4345 | public: |
| 4346 | CoroutineSuspendExpr(StmtClass SC, SourceLocation KeywordLoc, Expr *Common, |
| 4347 | Expr *Ready, Expr *Suspend, Expr *Resume, |
| 4348 | OpaqueValueExpr *OpaqueValue) |
| 4349 | : Expr(SC, Resume->getType(), Resume->getValueKind(), |
| 4350 | Resume->getObjectKind(), Resume->isTypeDependent(), |
| 4351 | Resume->isValueDependent(), Common->isInstantiationDependent(), |
| 4352 | Common->containsUnexpandedParameterPack()), |
| 4353 | KeywordLoc(KeywordLoc), OpaqueValue(OpaqueValue) { |
| 4354 | SubExprs[SubExpr::Common] = Common; |
| 4355 | SubExprs[SubExpr::Ready] = Ready; |
| 4356 | SubExprs[SubExpr::Suspend] = Suspend; |
| 4357 | SubExprs[SubExpr::Resume] = Resume; |
| 4358 | } |
| 4359 | |
| 4360 | CoroutineSuspendExpr(StmtClass SC, SourceLocation KeywordLoc, QualType Ty, |
| 4361 | Expr *Common) |
| 4362 | : Expr(SC, Ty, VK_RValue, OK_Ordinary, true, true, true, |
| 4363 | Common->containsUnexpandedParameterPack()), |
| 4364 | KeywordLoc(KeywordLoc) { |
| 4365 | (0) . __assert_fail ("Common->isTypeDependent() && Ty->isDependentType() && \"wrong constructor for non-dependent co_await/co_yield expression\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprCXX.h", 4366, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(Common->isTypeDependent() && Ty->isDependentType() && |
| 4366 | (0) . __assert_fail ("Common->isTypeDependent() && Ty->isDependentType() && \"wrong constructor for non-dependent co_await/co_yield expression\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprCXX.h", 4366, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "wrong constructor for non-dependent co_await/co_yield expression"); |
| 4367 | SubExprs[SubExpr::Common] = Common; |
| 4368 | SubExprs[SubExpr::Ready] = nullptr; |
| 4369 | SubExprs[SubExpr::Suspend] = nullptr; |
| 4370 | SubExprs[SubExpr::Resume] = nullptr; |
| 4371 | } |
| 4372 | |
| 4373 | CoroutineSuspendExpr(StmtClass SC, EmptyShell Empty) : Expr(SC, Empty) { |
| 4374 | SubExprs[SubExpr::Common] = nullptr; |
| 4375 | SubExprs[SubExpr::Ready] = nullptr; |
| 4376 | SubExprs[SubExpr::Suspend] = nullptr; |
| 4377 | SubExprs[SubExpr::Resume] = nullptr; |
| 4378 | } |
| 4379 | |
| 4380 | SourceLocation getKeywordLoc() const { return KeywordLoc; } |
| 4381 | |
| 4382 | Expr *getCommonExpr() const { |
| 4383 | return static_cast<Expr*>(SubExprs[SubExpr::Common]); |
| 4384 | } |
| 4385 | |
| 4386 | |
| 4387 | OpaqueValueExpr *getOpaqueValue() const { return OpaqueValue; } |
| 4388 | |
| 4389 | Expr *getReadyExpr() const { |
| 4390 | return static_cast<Expr*>(SubExprs[SubExpr::Ready]); |
| 4391 | } |
| 4392 | |
| 4393 | Expr *getSuspendExpr() const { |
| 4394 | return static_cast<Expr*>(SubExprs[SubExpr::Suspend]); |
| 4395 | } |
| 4396 | |
| 4397 | Expr *getResumeExpr() const { |
| 4398 | return static_cast<Expr*>(SubExprs[SubExpr::Resume]); |
| 4399 | } |
| 4400 | |
| 4401 | SourceLocation getBeginLoc() const LLVM_READONLY { return KeywordLoc; } |
| 4402 | |
| 4403 | SourceLocation getEndLoc() const LLVM_READONLY { |
| 4404 | return getCommonExpr()->getEndLoc(); |
| 4405 | } |
| 4406 | |
| 4407 | child_range children() { |
| 4408 | return child_range(SubExprs, SubExprs + SubExpr::Count); |
| 4409 | } |
| 4410 | |
| 4411 | static bool classof(const Stmt *T) { |
| 4412 | return T->getStmtClass() == CoawaitExprClass || |
| 4413 | T->getStmtClass() == CoyieldExprClass; |
| 4414 | } |
| 4415 | }; |
| 4416 | |
| 4417 | |
| 4418 | class CoawaitExpr : public CoroutineSuspendExpr { |
| 4419 | friend class ASTStmtReader; |
| 4420 | |
| 4421 | public: |
| 4422 | CoawaitExpr(SourceLocation CoawaitLoc, Expr *Operand, Expr *Ready, |
| 4423 | Expr *Suspend, Expr *Resume, OpaqueValueExpr *OpaqueValue, |
| 4424 | bool IsImplicit = false) |
| 4425 | : CoroutineSuspendExpr(CoawaitExprClass, CoawaitLoc, Operand, Ready, |
| 4426 | Suspend, Resume, OpaqueValue) { |
| 4427 | CoawaitBits.IsImplicit = IsImplicit; |
| 4428 | } |
| 4429 | |
| 4430 | CoawaitExpr(SourceLocation CoawaitLoc, QualType Ty, Expr *Operand, |
| 4431 | bool IsImplicit = false) |
| 4432 | : CoroutineSuspendExpr(CoawaitExprClass, CoawaitLoc, Ty, Operand) { |
| 4433 | CoawaitBits.IsImplicit = IsImplicit; |
| 4434 | } |
| 4435 | |
| 4436 | CoawaitExpr(EmptyShell Empty) |
| 4437 | : CoroutineSuspendExpr(CoawaitExprClass, Empty) {} |
| 4438 | |
| 4439 | Expr *getOperand() const { |
| 4440 | |
| 4441 | return getCommonExpr(); |
| 4442 | } |
| 4443 | |
| 4444 | bool isImplicit() const { return CoawaitBits.IsImplicit; } |
| 4445 | void setIsImplicit(bool value = true) { CoawaitBits.IsImplicit = value; } |
| 4446 | |
| 4447 | static bool classof(const Stmt *T) { |
| 4448 | return T->getStmtClass() == CoawaitExprClass; |
| 4449 | } |
| 4450 | }; |
| 4451 | |
| 4452 | |
| 4453 | |
| 4454 | class DependentCoawaitExpr : public Expr { |
| 4455 | friend class ASTStmtReader; |
| 4456 | |
| 4457 | SourceLocation KeywordLoc; |
| 4458 | Stmt *SubExprs[2]; |
| 4459 | |
| 4460 | public: |
| 4461 | DependentCoawaitExpr(SourceLocation KeywordLoc, QualType Ty, Expr *Op, |
| 4462 | UnresolvedLookupExpr *OpCoawait) |
| 4463 | : Expr(DependentCoawaitExprClass, Ty, VK_RValue, OK_Ordinary, |
| 4464 | true, true, |
| 4465 | true, |
| 4466 | Op->containsUnexpandedParameterPack()), |
| 4467 | KeywordLoc(KeywordLoc) { |
| 4468 | |
| 4469 | |
| 4470 | (0) . __assert_fail ("Ty->isDependentType() && \"wrong constructor for non-dependent co_await/co_yield expression\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprCXX.h", 4471, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(Ty->isDependentType() && |
| 4471 | (0) . __assert_fail ("Ty->isDependentType() && \"wrong constructor for non-dependent co_await/co_yield expression\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ExprCXX.h", 4471, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "wrong constructor for non-dependent co_await/co_yield expression"); |
| 4472 | SubExprs[0] = Op; |
| 4473 | SubExprs[1] = OpCoawait; |
| 4474 | } |
| 4475 | |
| 4476 | DependentCoawaitExpr(EmptyShell Empty) |
| 4477 | : Expr(DependentCoawaitExprClass, Empty) {} |
| 4478 | |
| 4479 | Expr *getOperand() const { return cast<Expr>(SubExprs[0]); } |
| 4480 | |
| 4481 | UnresolvedLookupExpr *getOperatorCoawaitLookup() const { |
| 4482 | return cast<UnresolvedLookupExpr>(SubExprs[1]); |
| 4483 | } |
| 4484 | |
| 4485 | SourceLocation getKeywordLoc() const { return KeywordLoc; } |
| 4486 | |
| 4487 | SourceLocation getBeginLoc() const LLVM_READONLY { return KeywordLoc; } |
| 4488 | |
| 4489 | SourceLocation getEndLoc() const LLVM_READONLY { |
| 4490 | return getOperand()->getEndLoc(); |
| 4491 | } |
| 4492 | |
| 4493 | child_range children() { return child_range(SubExprs, SubExprs + 2); } |
| 4494 | |
| 4495 | static bool classof(const Stmt *T) { |
| 4496 | return T->getStmtClass() == DependentCoawaitExprClass; |
| 4497 | } |
| 4498 | }; |
| 4499 | |
| 4500 | |
| 4501 | class CoyieldExpr : public CoroutineSuspendExpr { |
| 4502 | friend class ASTStmtReader; |
| 4503 | |
| 4504 | public: |
| 4505 | CoyieldExpr(SourceLocation CoyieldLoc, Expr *Operand, Expr *Ready, |
| 4506 | Expr *Suspend, Expr *Resume, OpaqueValueExpr *OpaqueValue) |
| 4507 | : CoroutineSuspendExpr(CoyieldExprClass, CoyieldLoc, Operand, Ready, |
| 4508 | Suspend, Resume, OpaqueValue) {} |
| 4509 | CoyieldExpr(SourceLocation CoyieldLoc, QualType Ty, Expr *Operand) |
| 4510 | : CoroutineSuspendExpr(CoyieldExprClass, CoyieldLoc, Ty, Operand) {} |
| 4511 | CoyieldExpr(EmptyShell Empty) |
| 4512 | : CoroutineSuspendExpr(CoyieldExprClass, Empty) {} |
| 4513 | |
| 4514 | Expr *getOperand() const { |
| 4515 | |
| 4516 | return getCommonExpr(); |
| 4517 | } |
| 4518 | |
| 4519 | static bool classof(const Stmt *T) { |
| 4520 | return T->getStmtClass() == CoyieldExprClass; |
| 4521 | } |
| 4522 | }; |
| 4523 | |
| 4524 | } |
| 4525 | |
| 4526 | #endif |
| 4527 | |