| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | #ifndef LLVM_CLANG_AST_DECLCXX_H |
| 16 | #define LLVM_CLANG_AST_DECLCXX_H |
| 17 | |
| 18 | #include "clang/AST/ASTContext.h" |
| 19 | #include "clang/AST/ASTUnresolvedSet.h" |
| 20 | #include "clang/AST/Attr.h" |
| 21 | #include "clang/AST/Decl.h" |
| 22 | #include "clang/AST/DeclBase.h" |
| 23 | #include "clang/AST/DeclarationName.h" |
| 24 | #include "clang/AST/Expr.h" |
| 25 | #include "clang/AST/ExternalASTSource.h" |
| 26 | #include "clang/AST/LambdaCapture.h" |
| 27 | #include "clang/AST/NestedNameSpecifier.h" |
| 28 | #include "clang/AST/Redeclarable.h" |
| 29 | #include "clang/AST/Stmt.h" |
| 30 | #include "clang/AST/Type.h" |
| 31 | #include "clang/AST/TypeLoc.h" |
| 32 | #include "clang/AST/UnresolvedSet.h" |
| 33 | #include "clang/Basic/LLVM.h" |
| 34 | #include "clang/Basic/Lambda.h" |
| 35 | #include "clang/Basic/LangOptions.h" |
| 36 | #include "clang/Basic/OperatorKinds.h" |
| 37 | #include "clang/Basic/SourceLocation.h" |
| 38 | #include "clang/Basic/Specifiers.h" |
| 39 | #include "llvm/ADT/ArrayRef.h" |
| 40 | #include "llvm/ADT/DenseMap.h" |
| 41 | #include "llvm/ADT/PointerIntPair.h" |
| 42 | #include "llvm/ADT/PointerUnion.h" |
| 43 | #include "llvm/ADT/STLExtras.h" |
| 44 | #include "llvm/ADT/iterator_range.h" |
| 45 | #include "llvm/Support/Casting.h" |
| 46 | #include "llvm/Support/Compiler.h" |
| 47 | #include "llvm/Support/PointerLikeTypeTraits.h" |
| 48 | #include "llvm/Support/TrailingObjects.h" |
| 49 | #include <cassert> |
| 50 | #include <cstddef> |
| 51 | #include <iterator> |
| 52 | #include <memory> |
| 53 | #include <vector> |
| 54 | |
| 55 | namespace clang { |
| 56 | |
| 57 | class ClassTemplateDecl; |
| 58 | class ConstructorUsingShadowDecl; |
| 59 | class CXXBasePath; |
| 60 | class CXXBasePaths; |
| 61 | class CXXConstructorDecl; |
| 62 | class CXXDestructorDecl; |
| 63 | class CXXFinalOverriderMap; |
| 64 | class CXXIndirectPrimaryBaseSet; |
| 65 | class CXXMethodDecl; |
| 66 | class DiagnosticBuilder; |
| 67 | class FriendDecl; |
| 68 | class FunctionTemplateDecl; |
| 69 | class IdentifierInfo; |
| 70 | class MemberSpecializationInfo; |
| 71 | class TemplateDecl; |
| 72 | class TemplateParameterList; |
| 73 | class UsingDecl; |
| 74 | |
| 75 | |
| 76 | |
| 77 | class AnyFunctionDecl { |
| 78 | NamedDecl *Function; |
| 79 | |
| 80 | AnyFunctionDecl(NamedDecl *ND) : Function(ND) {} |
| 81 | |
| 82 | public: |
| 83 | AnyFunctionDecl(FunctionDecl *FD) : Function(FD) {} |
| 84 | AnyFunctionDecl(FunctionTemplateDecl *FTD); |
| 85 | |
| 86 | |
| 87 | |
| 88 | operator NamedDecl *() const { return Function; } |
| 89 | |
| 90 | |
| 91 | NamedDecl *get() const { return Function; } |
| 92 | |
| 93 | static AnyFunctionDecl getFromNamedDecl(NamedDecl *ND) { |
| 94 | return AnyFunctionDecl(ND); |
| 95 | } |
| 96 | }; |
| 97 | |
| 98 | } |
| 99 | |
| 100 | namespace llvm { |
| 101 | |
| 102 | |
| 103 | template<> |
| 104 | struct PointerLikeTypeTraits< ::clang::AnyFunctionDecl> { |
| 105 | static void *getAsVoidPointer(::clang::AnyFunctionDecl F) { |
| 106 | return F.get(); |
| 107 | } |
| 108 | |
| 109 | static ::clang::AnyFunctionDecl getFromVoidPointer(void *P) { |
| 110 | return ::clang::AnyFunctionDecl::getFromNamedDecl( |
| 111 | static_cast< ::clang::NamedDecl*>(P)); |
| 112 | } |
| 113 | |
| 114 | enum { NumLowBitsAvailable = 2 }; |
| 115 | }; |
| 116 | |
| 117 | } |
| 118 | |
| 119 | namespace clang { |
| 120 | |
| 121 | |
| 122 | |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | |
| 130 | |
| 131 | class AccessSpecDecl : public Decl { |
| 132 | |
| 133 | SourceLocation ColonLoc; |
| 134 | |
| 135 | AccessSpecDecl(AccessSpecifier AS, DeclContext *DC, |
| 136 | SourceLocation ASLoc, SourceLocation ColonLoc) |
| 137 | : Decl(AccessSpec, DC, ASLoc), ColonLoc(ColonLoc) { |
| 138 | setAccess(AS); |
| 139 | } |
| 140 | |
| 141 | AccessSpecDecl(EmptyShell Empty) : Decl(AccessSpec, Empty) {} |
| 142 | |
| 143 | virtual void anchor(); |
| 144 | |
| 145 | public: |
| 146 | |
| 147 | SourceLocation getAccessSpecifierLoc() const { return getLocation(); } |
| 148 | |
| 149 | |
| 150 | void setAccessSpecifierLoc(SourceLocation ASLoc) { setLocation(ASLoc); } |
| 151 | |
| 152 | |
| 153 | SourceLocation getColonLoc() const { return ColonLoc; } |
| 154 | |
| 155 | |
| 156 | void setColonLoc(SourceLocation CLoc) { ColonLoc = CLoc; } |
| 157 | |
| 158 | SourceRange getSourceRange() const override LLVM_READONLY { |
| 159 | return SourceRange(getAccessSpecifierLoc(), getColonLoc()); |
| 160 | } |
| 161 | |
| 162 | static AccessSpecDecl *Create(ASTContext &C, AccessSpecifier AS, |
| 163 | DeclContext *DC, SourceLocation ASLoc, |
| 164 | SourceLocation ColonLoc) { |
| 165 | return new (C, DC) AccessSpecDecl(AS, DC, ASLoc, ColonLoc); |
| 166 | } |
| 167 | |
| 168 | static AccessSpecDecl *CreateDeserialized(ASTContext &C, unsigned ID); |
| 169 | |
| 170 | |
| 171 | static bool classof(const Decl *D) { return classofKind(D->getKind()); } |
| 172 | static bool classofKind(Kind K) { return K == AccessSpec; } |
| 173 | }; |
| 174 | |
| 175 | |
| 176 | |
| 177 | |
| 178 | |
| 179 | |
| 180 | |
| 181 | |
| 182 | |
| 183 | |
| 184 | |
| 185 | |
| 186 | |
| 187 | |
| 188 | |
| 189 | |
| 190 | |
| 191 | class CXXBaseSpecifier { |
| 192 | |
| 193 | |
| 194 | |
| 195 | SourceRange Range; |
| 196 | |
| 197 | |
| 198 | |
| 199 | SourceLocation EllipsisLoc; |
| 200 | |
| 201 | |
| 202 | unsigned Virtual : 1; |
| 203 | |
| 204 | |
| 205 | |
| 206 | |
| 207 | |
| 208 | unsigned BaseOfClass : 1; |
| 209 | |
| 210 | |
| 211 | |
| 212 | |
| 213 | |
| 214 | unsigned Access : 2; |
| 215 | |
| 216 | |
| 217 | |
| 218 | unsigned InheritConstructors : 1; |
| 219 | |
| 220 | |
| 221 | |
| 222 | |
| 223 | |
| 224 | TypeSourceInfo *BaseTypeInfo; |
| 225 | |
| 226 | public: |
| 227 | CXXBaseSpecifier() = default; |
| 228 | CXXBaseSpecifier(SourceRange R, bool V, bool BC, AccessSpecifier A, |
| 229 | TypeSourceInfo *TInfo, SourceLocation EllipsisLoc) |
| 230 | : Range(R), EllipsisLoc(EllipsisLoc), Virtual(V), BaseOfClass(BC), |
| 231 | Access(A), InheritConstructors(false), BaseTypeInfo(TInfo) {} |
| 232 | |
| 233 | |
| 234 | SourceRange getSourceRange() const LLVM_READONLY { return Range; } |
| 235 | SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); } |
| 236 | SourceLocation getEndLoc() const LLVM_READONLY { return Range.getEnd(); } |
| 237 | |
| 238 | |
| 239 | SourceLocation getBaseTypeLoc() const LLVM_READONLY { |
| 240 | return BaseTypeInfo->getTypeLoc().getBeginLoc(); |
| 241 | } |
| 242 | |
| 243 | |
| 244 | bool isVirtual() const { return Virtual; } |
| 245 | |
| 246 | |
| 247 | |
| 248 | bool isBaseOfClass() const { return BaseOfClass; } |
| 249 | |
| 250 | |
| 251 | bool isPackExpansion() const { return EllipsisLoc.isValid(); } |
| 252 | |
| 253 | |
| 254 | bool getInheritConstructors() const { return InheritConstructors; } |
| 255 | |
| 256 | |
| 257 | void setInheritConstructors(bool Inherit = true) { |
| 258 | InheritConstructors = Inherit; |
| 259 | } |
| 260 | |
| 261 | |
| 262 | SourceLocation getEllipsisLoc() const { |
| 263 | return EllipsisLoc; |
| 264 | } |
| 265 | |
| 266 | |
| 267 | |
| 268 | |
| 269 | |
| 270 | |
| 271 | AccessSpecifier getAccessSpecifier() const { |
| 272 | if ((AccessSpecifier)Access == AS_none) |
| 273 | return BaseOfClass? AS_private : AS_public; |
| 274 | else |
| 275 | return (AccessSpecifier)Access; |
| 276 | } |
| 277 | |
| 278 | |
| 279 | |
| 280 | |
| 281 | |
| 282 | |
| 283 | AccessSpecifier getAccessSpecifierAsWritten() const { |
| 284 | return (AccessSpecifier)Access; |
| 285 | } |
| 286 | |
| 287 | |
| 288 | |
| 289 | |
| 290 | QualType getType() const { |
| 291 | return BaseTypeInfo->getType().getUnqualifiedType(); |
| 292 | } |
| 293 | |
| 294 | |
| 295 | TypeSourceInfo *getTypeSourceInfo() const { return BaseTypeInfo; } |
| 296 | }; |
| 297 | |
| 298 | |
| 299 | class CXXRecordDecl : public RecordDecl { |
| 300 | friend class ASTDeclReader; |
| 301 | friend class ASTDeclWriter; |
| 302 | friend class ASTNodeImporter; |
| 303 | friend class ASTReader; |
| 304 | friend class ASTRecordWriter; |
| 305 | friend class ASTWriter; |
| 306 | friend class DeclContext; |
| 307 | friend class LambdaExpr; |
| 308 | |
| 309 | friend void FunctionDecl::setPure(bool); |
| 310 | friend void TagDecl::startDefinition(); |
| 311 | |
| 312 | |
| 313 | enum SpecialMemberFlags { |
| 314 | SMF_DefaultConstructor = 0x1, |
| 315 | SMF_CopyConstructor = 0x2, |
| 316 | SMF_MoveConstructor = 0x4, |
| 317 | SMF_CopyAssignment = 0x8, |
| 318 | SMF_MoveAssignment = 0x10, |
| 319 | SMF_Destructor = 0x20, |
| 320 | SMF_All = 0x3f |
| 321 | }; |
| 322 | |
| 323 | struct DefinitionData { |
| 324 | |
| 325 | unsigned UserDeclaredConstructor : 1; |
| 326 | |
| 327 | |
| 328 | unsigned UserDeclaredSpecialMembers : 6; |
| 329 | |
| 330 | |
| 331 | unsigned Aggregate : 1; |
| 332 | |
| 333 | |
| 334 | unsigned PlainOldData : 1; |
| 335 | |
| 336 | |
| 337 | |
| 338 | |
| 339 | |
| 340 | unsigned Empty : 1; |
| 341 | |
| 342 | |
| 343 | |
| 344 | unsigned Polymorphic : 1; |
| 345 | |
| 346 | |
| 347 | |
| 348 | unsigned Abstract : 1; |
| 349 | |
| 350 | |
| 351 | |
| 352 | unsigned IsStandardLayout : 1; |
| 353 | |
| 354 | |
| 355 | |
| 356 | |
| 357 | |
| 358 | |
| 359 | |
| 360 | |
| 361 | |
| 362 | |
| 363 | |
| 364 | |
| 365 | |
| 366 | |
| 367 | |
| 368 | |
| 369 | unsigned IsCXX11StandardLayout : 1; |
| 370 | |
| 371 | |
| 372 | |
| 373 | |
| 374 | |
| 375 | unsigned HasBasesWithFields : 1; |
| 376 | |
| 377 | |
| 378 | |
| 379 | |
| 380 | |
| 381 | unsigned HasBasesWithNonStaticDataMembers : 1; |
| 382 | |
| 383 | |
| 384 | unsigned HasPrivateFields : 1; |
| 385 | |
| 386 | |
| 387 | unsigned HasProtectedFields : 1; |
| 388 | |
| 389 | |
| 390 | unsigned HasPublicFields : 1; |
| 391 | |
| 392 | |
| 393 | unsigned HasMutableFields : 1; |
| 394 | |
| 395 | |
| 396 | |
| 397 | unsigned HasVariantMembers : 1; |
| 398 | |
| 399 | |
| 400 | unsigned HasOnlyCMembers : 1; |
| 401 | |
| 402 | |
| 403 | |
| 404 | unsigned HasInClassInitializer : 1; |
| 405 | |
| 406 | |
| 407 | |
| 408 | |
| 409 | |
| 410 | |
| 411 | unsigned HasUninitializedReferenceMember : 1; |
| 412 | |
| 413 | |
| 414 | |
| 415 | unsigned HasUninitializedFields : 1; |
| 416 | |
| 417 | |
| 418 | |
| 419 | unsigned HasInheritedConstructor : 1; |
| 420 | |
| 421 | |
| 422 | |
| 423 | unsigned HasInheritedAssignment : 1; |
| 424 | |
| 425 | |
| 426 | |
| 427 | |
| 428 | unsigned NeedOverloadResolutionForCopyConstructor : 1; |
| 429 | unsigned NeedOverloadResolutionForMoveConstructor : 1; |
| 430 | unsigned NeedOverloadResolutionForMoveAssignment : 1; |
| 431 | unsigned NeedOverloadResolutionForDestructor : 1; |
| 432 | |
| 433 | |
| 434 | |
| 435 | |
| 436 | |
| 437 | unsigned DefaultedCopyConstructorIsDeleted : 1; |
| 438 | unsigned DefaultedMoveConstructorIsDeleted : 1; |
| 439 | unsigned DefaultedMoveAssignmentIsDeleted : 1; |
| 440 | unsigned DefaultedDestructorIsDeleted : 1; |
| 441 | |
| 442 | |
| 443 | |
| 444 | |
| 445 | |
| 446 | |
| 447 | |
| 448 | |
| 449 | unsigned HasTrivialSpecialMembers : 6; |
| 450 | |
| 451 | |
| 452 | |
| 453 | |
| 454 | unsigned HasTrivialSpecialMembersForCall : 6; |
| 455 | |
| 456 | |
| 457 | |
| 458 | |
| 459 | |
| 460 | |
| 461 | |
| 462 | unsigned DeclaredNonTrivialSpecialMembers : 6; |
| 463 | |
| 464 | |
| 465 | |
| 466 | |
| 467 | |
| 468 | unsigned DeclaredNonTrivialSpecialMembersForCall : 6; |
| 469 | |
| 470 | |
| 471 | unsigned HasIrrelevantDestructor : 1; |
| 472 | |
| 473 | |
| 474 | |
| 475 | unsigned HasConstexprNonCopyMoveConstructor : 1; |
| 476 | |
| 477 | |
| 478 | |
| 479 | unsigned HasDefaultedDefaultConstructor : 1; |
| 480 | |
| 481 | |
| 482 | |
| 483 | unsigned DefaultedDefaultConstructorIsConstexpr : 1; |
| 484 | |
| 485 | |
| 486 | |
| 487 | |
| 488 | |
| 489 | unsigned HasConstexprDefaultConstructor : 1; |
| 490 | |
| 491 | |
| 492 | |
| 493 | unsigned HasNonLiteralTypeFieldsOrBases : 1; |
| 494 | |
| 495 | |
| 496 | |
| 497 | unsigned ComputedVisibleConversions : 1; |
| 498 | |
| 499 | |
| 500 | |
| 501 | unsigned UserProvidedDefaultConstructor : 1; |
| 502 | |
| 503 | |
| 504 | |
| 505 | unsigned DeclaredSpecialMembers : 6; |
| 506 | |
| 507 | |
| 508 | |
| 509 | unsigned ImplicitCopyConstructorCanHaveConstParamForVBase : 1; |
| 510 | unsigned ImplicitCopyConstructorCanHaveConstParamForNonVBase : 1; |
| 511 | |
| 512 | |
| 513 | |
| 514 | unsigned ImplicitCopyAssignmentHasConstParam : 1; |
| 515 | |
| 516 | |
| 517 | |
| 518 | unsigned HasDeclaredCopyConstructorWithConstParam : 1; |
| 519 | |
| 520 | |
| 521 | |
| 522 | unsigned HasDeclaredCopyAssignmentWithConstParam : 1; |
| 523 | |
| 524 | |
| 525 | unsigned IsLambda : 1; |
| 526 | |
| 527 | |
| 528 | unsigned IsParsingBaseSpecifiers : 1; |
| 529 | |
| 530 | unsigned HasODRHash : 1; |
| 531 | |
| 532 | |
| 533 | unsigned ODRHash = 0; |
| 534 | |
| 535 | |
| 536 | unsigned NumBases = 0; |
| 537 | |
| 538 | |
| 539 | unsigned NumVBases = 0; |
| 540 | |
| 541 | |
| 542 | |
| 543 | |
| 544 | LazyCXXBaseSpecifiersPtr Bases; |
| 545 | |
| 546 | |
| 547 | LazyCXXBaseSpecifiersPtr VBases; |
| 548 | |
| 549 | |
| 550 | |
| 551 | |
| 552 | |
| 553 | LazyASTUnresolvedSet Conversions; |
| 554 | |
| 555 | |
| 556 | |
| 557 | |
| 558 | |
| 559 | |
| 560 | LazyASTUnresolvedSet VisibleConversions; |
| 561 | |
| 562 | |
| 563 | CXXRecordDecl *Definition; |
| 564 | |
| 565 | |
| 566 | |
| 567 | |
| 568 | |
| 569 | LazyDeclPtr FirstFriend; |
| 570 | |
| 571 | DefinitionData(CXXRecordDecl *D); |
| 572 | |
| 573 | |
| 574 | CXXBaseSpecifier *getBases() const { |
| 575 | if (!Bases.isOffset()) |
| 576 | return Bases.get(nullptr); |
| 577 | return getBasesSlowCase(); |
| 578 | } |
| 579 | |
| 580 | |
| 581 | CXXBaseSpecifier *getVBases() const { |
| 582 | if (!VBases.isOffset()) |
| 583 | return VBases.get(nullptr); |
| 584 | return getVBasesSlowCase(); |
| 585 | } |
| 586 | |
| 587 | ArrayRef<CXXBaseSpecifier> bases() const { |
| 588 | return llvm::makeArrayRef(getBases(), NumBases); |
| 589 | } |
| 590 | |
| 591 | ArrayRef<CXXBaseSpecifier> vbases() const { |
| 592 | return llvm::makeArrayRef(getVBases(), NumVBases); |
| 593 | } |
| 594 | |
| 595 | private: |
| 596 | CXXBaseSpecifier *getBasesSlowCase() const; |
| 597 | CXXBaseSpecifier *getVBasesSlowCase() const; |
| 598 | }; |
| 599 | |
| 600 | struct DefinitionData *DefinitionData; |
| 601 | |
| 602 | |
| 603 | struct LambdaDefinitionData : public DefinitionData { |
| 604 | using Capture = LambdaCapture; |
| 605 | |
| 606 | |
| 607 | |
| 608 | |
| 609 | |
| 610 | |
| 611 | |
| 612 | |
| 613 | |
| 614 | unsigned Dependent : 1; |
| 615 | |
| 616 | |
| 617 | unsigned IsGenericLambda : 1; |
| 618 | |
| 619 | |
| 620 | unsigned CaptureDefault : 2; |
| 621 | |
| 622 | |
| 623 | unsigned NumCaptures : 15; |
| 624 | |
| 625 | |
| 626 | unsigned NumExplicitCaptures : 13; |
| 627 | |
| 628 | |
| 629 | |
| 630 | unsigned ManglingNumber = 0; |
| 631 | |
| 632 | |
| 633 | |
| 634 | |
| 635 | |
| 636 | LazyDeclPtr ContextDecl; |
| 637 | |
| 638 | |
| 639 | |
| 640 | Capture *Captures = nullptr; |
| 641 | |
| 642 | |
| 643 | TypeSourceInfo *MethodTyInfo; |
| 644 | |
| 645 | LambdaDefinitionData(CXXRecordDecl *D, TypeSourceInfo *Info, |
| 646 | bool Dependent, bool IsGeneric, |
| 647 | LambdaCaptureDefault CaptureDefault) |
| 648 | : DefinitionData(D), Dependent(Dependent), IsGenericLambda(IsGeneric), |
| 649 | CaptureDefault(CaptureDefault), NumCaptures(0), NumExplicitCaptures(0), |
| 650 | MethodTyInfo(Info) { |
| 651 | IsLambda = true; |
| 652 | |
| 653 | |
| 654 | |
| 655 | Aggregate = false; |
| 656 | PlainOldData = false; |
| 657 | } |
| 658 | }; |
| 659 | |
| 660 | struct DefinitionData *dataPtr() const { |
| 661 | |
| 662 | getMostRecentDecl(); |
| 663 | return DefinitionData; |
| 664 | } |
| 665 | |
| 666 | struct DefinitionData &data() const { |
| 667 | auto *DD = dataPtr(); |
| 668 | (0) . __assert_fail ("DD && \"queried property of class with no definition\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/DeclCXX.h", 668, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(DD && "queried property of class with no definition"); |
| 669 | return *DD; |
| 670 | } |
| 671 | |
| 672 | struct LambdaDefinitionData &getLambdaData() const { |
| 673 | |
| 674 | |
| 675 | auto *DD = DefinitionData; |
| 676 | (0) . __assert_fail ("DD && DD->IsLambda && \"queried lambda property of non-lambda class\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/DeclCXX.h", 676, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(DD && DD->IsLambda && "queried lambda property of non-lambda class"); |
| 677 | return static_cast<LambdaDefinitionData&>(*DD); |
| 678 | } |
| 679 | |
| 680 | |
| 681 | |
| 682 | |
| 683 | |
| 684 | |
| 685 | |
| 686 | |
| 687 | |
| 688 | |
| 689 | llvm::PointerUnion<ClassTemplateDecl *, MemberSpecializationInfo *> |
| 690 | TemplateOrInstantiation; |
| 691 | |
| 692 | |
| 693 | |
| 694 | void addedClassSubobject(CXXRecordDecl *Base); |
| 695 | |
| 696 | |
| 697 | |
| 698 | |
| 699 | |
| 700 | |
| 701 | void addedMember(Decl *D); |
| 702 | |
| 703 | void markedVirtualFunctionPure(); |
| 704 | |
| 705 | |
| 706 | |
| 707 | FriendDecl *getFirstFriend() const; |
| 708 | |
| 709 | |
| 710 | |
| 711 | |
| 712 | bool hasSubobjectAtOffsetZeroOfEmptyBaseType(ASTContext &Ctx, |
| 713 | const CXXRecordDecl *X); |
| 714 | |
| 715 | protected: |
| 716 | CXXRecordDecl(Kind K, TagKind TK, const ASTContext &C, DeclContext *DC, |
| 717 | SourceLocation StartLoc, SourceLocation IdLoc, |
| 718 | IdentifierInfo *Id, CXXRecordDecl *PrevDecl); |
| 719 | |
| 720 | public: |
| 721 | |
| 722 | using base_class_iterator = CXXBaseSpecifier *; |
| 723 | |
| 724 | |
| 725 | using base_class_const_iterator = const CXXBaseSpecifier *; |
| 726 | |
| 727 | CXXRecordDecl *getCanonicalDecl() override { |
| 728 | return cast<CXXRecordDecl>(RecordDecl::getCanonicalDecl()); |
| 729 | } |
| 730 | |
| 731 | const CXXRecordDecl *getCanonicalDecl() const { |
| 732 | return const_cast<CXXRecordDecl*>(this)->getCanonicalDecl(); |
| 733 | } |
| 734 | |
| 735 | CXXRecordDecl *getPreviousDecl() { |
| 736 | return cast_or_null<CXXRecordDecl>( |
| 737 | static_cast<RecordDecl *>(this)->getPreviousDecl()); |
| 738 | } |
| 739 | |
| 740 | const CXXRecordDecl *getPreviousDecl() const { |
| 741 | return const_cast<CXXRecordDecl*>(this)->getPreviousDecl(); |
| 742 | } |
| 743 | |
| 744 | CXXRecordDecl *getMostRecentDecl() { |
| 745 | return cast<CXXRecordDecl>( |
| 746 | static_cast<RecordDecl *>(this)->getMostRecentDecl()); |
| 747 | } |
| 748 | |
| 749 | const CXXRecordDecl *getMostRecentDecl() const { |
| 750 | return const_cast<CXXRecordDecl*>(this)->getMostRecentDecl(); |
| 751 | } |
| 752 | |
| 753 | CXXRecordDecl *getMostRecentNonInjectedDecl() { |
| 754 | CXXRecordDecl *Recent = |
| 755 | static_cast<CXXRecordDecl *>(this)->getMostRecentDecl(); |
| 756 | while (Recent->isInjectedClassName()) { |
| 757 | |
| 758 | getPreviousDecl()", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/DeclCXX.h", 758, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(Recent->getPreviousDecl()); |
| 759 | Recent = Recent->getPreviousDecl(); |
| 760 | } |
| 761 | return Recent; |
| 762 | } |
| 763 | |
| 764 | const CXXRecordDecl *getMostRecentNonInjectedDecl() const { |
| 765 | return const_cast<CXXRecordDecl*>(this)->getMostRecentNonInjectedDecl(); |
| 766 | } |
| 767 | |
| 768 | CXXRecordDecl *getDefinition() const { |
| 769 | |
| 770 | |
| 771 | auto *DD = DefinitionData ? DefinitionData : dataPtr(); |
| 772 | return DD ? DD->Definition : nullptr; |
| 773 | } |
| 774 | |
| 775 | bool hasDefinition() const { return DefinitionData || dataPtr(); } |
| 776 | |
| 777 | static CXXRecordDecl *Create(const ASTContext &C, TagKind TK, DeclContext *DC, |
| 778 | SourceLocation StartLoc, SourceLocation IdLoc, |
| 779 | IdentifierInfo *Id, |
| 780 | CXXRecordDecl *PrevDecl = nullptr, |
| 781 | bool DelayTypeCreation = false); |
| 782 | static CXXRecordDecl *CreateLambda(const ASTContext &C, DeclContext *DC, |
| 783 | TypeSourceInfo *Info, SourceLocation Loc, |
| 784 | bool DependentLambda, bool IsGeneric, |
| 785 | LambdaCaptureDefault CaptureDefault); |
| 786 | static CXXRecordDecl *CreateDeserialized(const ASTContext &C, unsigned ID); |
| 787 | |
| 788 | bool isDynamicClass() const { |
| 789 | return data().Polymorphic || data().NumVBases != 0; |
| 790 | } |
| 791 | |
| 792 | |
| 793 | |
| 794 | bool mayBeDynamicClass() const { |
| 795 | return !hasDefinition() || isDynamicClass() || hasAnyDependentBases(); |
| 796 | } |
| 797 | |
| 798 | |
| 799 | |
| 800 | bool mayBeNonDynamicClass() const { |
| 801 | return !hasDefinition() || !isDynamicClass() || hasAnyDependentBases(); |
| 802 | } |
| 803 | |
| 804 | void setIsParsingBaseSpecifiers() { data().IsParsingBaseSpecifiers = true; } |
| 805 | |
| 806 | bool isParsingBaseSpecifiers() const { |
| 807 | return data().IsParsingBaseSpecifiers; |
| 808 | } |
| 809 | |
| 810 | unsigned getODRHash() const; |
| 811 | |
| 812 | |
| 813 | void setBases(CXXBaseSpecifier const * const *Bases, unsigned NumBases); |
| 814 | |
| 815 | |
| 816 | unsigned getNumBases() const { return data().NumBases; } |
| 817 | |
| 818 | using base_class_range = llvm::iterator_range<base_class_iterator>; |
| 819 | using base_class_const_range = |
| 820 | llvm::iterator_range<base_class_const_iterator>; |
| 821 | |
| 822 | base_class_range bases() { |
| 823 | return base_class_range(bases_begin(), bases_end()); |
| 824 | } |
| 825 | base_class_const_range bases() const { |
| 826 | return base_class_const_range(bases_begin(), bases_end()); |
| 827 | } |
| 828 | |
| 829 | base_class_iterator bases_begin() { return data().getBases(); } |
| 830 | base_class_const_iterator bases_begin() const { return data().getBases(); } |
| 831 | base_class_iterator bases_end() { return bases_begin() + data().NumBases; } |
| 832 | base_class_const_iterator bases_end() const { |
| 833 | return bases_begin() + data().NumBases; |
| 834 | } |
| 835 | |
| 836 | |
| 837 | unsigned getNumVBases() const { return data().NumVBases; } |
| 838 | |
| 839 | base_class_range vbases() { |
| 840 | return base_class_range(vbases_begin(), vbases_end()); |
| 841 | } |
| 842 | base_class_const_range vbases() const { |
| 843 | return base_class_const_range(vbases_begin(), vbases_end()); |
| 844 | } |
| 845 | |
| 846 | base_class_iterator vbases_begin() { return data().getVBases(); } |
| 847 | base_class_const_iterator vbases_begin() const { return data().getVBases(); } |
| 848 | base_class_iterator vbases_end() { return vbases_begin() + data().NumVBases; } |
| 849 | base_class_const_iterator vbases_end() const { |
| 850 | return vbases_begin() + data().NumVBases; |
| 851 | } |
| 852 | |
| 853 | |
| 854 | |
| 855 | bool hasAnyDependentBases() const; |
| 856 | |
| 857 | |
| 858 | |
| 859 | |
| 860 | using method_iterator = specific_decl_iterator<CXXMethodDecl>; |
| 861 | using method_range = |
| 862 | llvm::iterator_range<specific_decl_iterator<CXXMethodDecl>>; |
| 863 | |
| 864 | method_range methods() const { |
| 865 | return method_range(method_begin(), method_end()); |
| 866 | } |
| 867 | |
| 868 | |
| 869 | |
| 870 | method_iterator method_begin() const { |
| 871 | return method_iterator(decls_begin()); |
| 872 | } |
| 873 | |
| 874 | |
| 875 | method_iterator method_end() const { |
| 876 | return method_iterator(decls_end()); |
| 877 | } |
| 878 | |
| 879 | |
| 880 | using ctor_iterator = specific_decl_iterator<CXXConstructorDecl>; |
| 881 | using ctor_range = |
| 882 | llvm::iterator_range<specific_decl_iterator<CXXConstructorDecl>>; |
| 883 | |
| 884 | ctor_range ctors() const { return ctor_range(ctor_begin(), ctor_end()); } |
| 885 | |
| 886 | ctor_iterator ctor_begin() const { |
| 887 | return ctor_iterator(decls_begin()); |
| 888 | } |
| 889 | |
| 890 | ctor_iterator ctor_end() const { |
| 891 | return ctor_iterator(decls_end()); |
| 892 | } |
| 893 | |
| 894 | |
| 895 | |
| 896 | class friend_iterator; |
| 897 | using friend_range = llvm::iterator_range<friend_iterator>; |
| 898 | |
| 899 | friend_range friends() const; |
| 900 | friend_iterator friend_begin() const; |
| 901 | friend_iterator friend_end() const; |
| 902 | void pushFriendDecl(FriendDecl *FD); |
| 903 | |
| 904 | |
| 905 | bool hasFriends() const { |
| 906 | return data().FirstFriend.isValid(); |
| 907 | } |
| 908 | |
| 909 | |
| 910 | |
| 911 | bool defaultedCopyConstructorIsDeleted() const { |
| 912 | (0) . __assert_fail ("(!needsOverloadResolutionForCopyConstructor() || (data().DeclaredSpecialMembers & SMF_CopyConstructor)) && \"this property has not yet been computed by Sema\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/DeclCXX.h", 914, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert((!needsOverloadResolutionForCopyConstructor() || |
| 913 | (0) . __assert_fail ("(!needsOverloadResolutionForCopyConstructor() || (data().DeclaredSpecialMembers & SMF_CopyConstructor)) && \"this property has not yet been computed by Sema\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/DeclCXX.h", 914, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> (data().DeclaredSpecialMembers & SMF_CopyConstructor)) && |
| 914 | (0) . __assert_fail ("(!needsOverloadResolutionForCopyConstructor() || (data().DeclaredSpecialMembers & SMF_CopyConstructor)) && \"this property has not yet been computed by Sema\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/DeclCXX.h", 914, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "this property has not yet been computed by Sema"); |
| 915 | return data().DefaultedCopyConstructorIsDeleted; |
| 916 | } |
| 917 | |
| 918 | |
| 919 | |
| 920 | bool defaultedMoveConstructorIsDeleted() const { |
| 921 | (0) . __assert_fail ("(!needsOverloadResolutionForMoveConstructor() || (data().DeclaredSpecialMembers & SMF_MoveConstructor)) && \"this property has not yet been computed by Sema\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/DeclCXX.h", 923, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert((!needsOverloadResolutionForMoveConstructor() || |
| 922 | (0) . __assert_fail ("(!needsOverloadResolutionForMoveConstructor() || (data().DeclaredSpecialMembers & SMF_MoveConstructor)) && \"this property has not yet been computed by Sema\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/DeclCXX.h", 923, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> (data().DeclaredSpecialMembers & SMF_MoveConstructor)) && |
| 923 | (0) . __assert_fail ("(!needsOverloadResolutionForMoveConstructor() || (data().DeclaredSpecialMembers & SMF_MoveConstructor)) && \"this property has not yet been computed by Sema\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/DeclCXX.h", 923, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "this property has not yet been computed by Sema"); |
| 924 | return data().DefaultedMoveConstructorIsDeleted; |
| 925 | } |
| 926 | |
| 927 | |
| 928 | bool defaultedDestructorIsDeleted() const { |
| 929 | (0) . __assert_fail ("(!needsOverloadResolutionForDestructor() || (data().DeclaredSpecialMembers & SMF_Destructor)) && \"this property has not yet been computed by Sema\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/DeclCXX.h", 931, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert((!needsOverloadResolutionForDestructor() || |
| 930 | (0) . __assert_fail ("(!needsOverloadResolutionForDestructor() || (data().DeclaredSpecialMembers & SMF_Destructor)) && \"this property has not yet been computed by Sema\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/DeclCXX.h", 931, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> (data().DeclaredSpecialMembers & SMF_Destructor)) && |
| 931 | (0) . __assert_fail ("(!needsOverloadResolutionForDestructor() || (data().DeclaredSpecialMembers & SMF_Destructor)) && \"this property has not yet been computed by Sema\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/DeclCXX.h", 931, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "this property has not yet been computed by Sema"); |
| 932 | return data().DefaultedDestructorIsDeleted; |
| 933 | } |
| 934 | |
| 935 | |
| 936 | |
| 937 | bool hasSimpleCopyConstructor() const { |
| 938 | return !hasUserDeclaredCopyConstructor() && |
| 939 | !data().DefaultedCopyConstructorIsDeleted; |
| 940 | } |
| 941 | |
| 942 | |
| 943 | |
| 944 | bool hasSimpleMoveConstructor() const { |
| 945 | return !hasUserDeclaredMoveConstructor() && hasMoveConstructor() && |
| 946 | !data().DefaultedMoveConstructorIsDeleted; |
| 947 | } |
| 948 | |
| 949 | |
| 950 | |
| 951 | bool hasSimpleMoveAssignment() const { |
| 952 | return !hasUserDeclaredMoveAssignment() && hasMoveAssignment() && |
| 953 | !data().DefaultedMoveAssignmentIsDeleted; |
| 954 | } |
| 955 | |
| 956 | |
| 957 | |
| 958 | bool hasSimpleDestructor() const { |
| 959 | return !hasUserDeclaredDestructor() && |
| 960 | !data().DefaultedDestructorIsDeleted; |
| 961 | } |
| 962 | |
| 963 | |
| 964 | bool hasDefaultConstructor() const { |
| 965 | return (data().DeclaredSpecialMembers & SMF_DefaultConstructor) || |
| 966 | needsImplicitDefaultConstructor(); |
| 967 | } |
| 968 | |
| 969 | |
| 970 | |
| 971 | |
| 972 | |
| 973 | bool needsImplicitDefaultConstructor() const { |
| 974 | return !data().UserDeclaredConstructor && |
| 975 | !(data().DeclaredSpecialMembers & SMF_DefaultConstructor) && |
| 976 | (!isLambda() || lambdaIsDefaultConstructibleAndAssignable()); |
| 977 | } |
| 978 | |
| 979 | |
| 980 | |
| 981 | |
| 982 | bool hasUserDeclaredConstructor() const { |
| 983 | return data().UserDeclaredConstructor; |
| 984 | } |
| 985 | |
| 986 | |
| 987 | |
| 988 | bool hasUserProvidedDefaultConstructor() const { |
| 989 | return data().UserProvidedDefaultConstructor; |
| 990 | } |
| 991 | |
| 992 | |
| 993 | |
| 994 | |
| 995 | bool hasUserDeclaredCopyConstructor() const { |
| 996 | return data().UserDeclaredSpecialMembers & SMF_CopyConstructor; |
| 997 | } |
| 998 | |
| 999 | |
| 1000 | |
| 1001 | bool needsImplicitCopyConstructor() const { |
| 1002 | return !(data().DeclaredSpecialMembers & SMF_CopyConstructor); |
| 1003 | } |
| 1004 | |
| 1005 | |
| 1006 | |
| 1007 | bool needsOverloadResolutionForCopyConstructor() const { |
| 1008 | |
| 1009 | |
| 1010 | |
| 1011 | |
| 1012 | |
| 1013 | |
| 1014 | if (data().UserDeclaredSpecialMembers & |
| 1015 | (SMF_MoveConstructor | SMF_MoveAssignment)) |
| 1016 | return true; |
| 1017 | return data().NeedOverloadResolutionForCopyConstructor; |
| 1018 | } |
| 1019 | |
| 1020 | |
| 1021 | |
| 1022 | bool implicitCopyConstructorHasConstParam() const { |
| 1023 | return data().ImplicitCopyConstructorCanHaveConstParamForNonVBase && |
| 1024 | (isAbstract() || |
| 1025 | data().ImplicitCopyConstructorCanHaveConstParamForVBase); |
| 1026 | } |
| 1027 | |
| 1028 | |
| 1029 | |
| 1030 | bool hasCopyConstructorWithConstParam() const { |
| 1031 | return data().HasDeclaredCopyConstructorWithConstParam || |
| 1032 | (needsImplicitCopyConstructor() && |
| 1033 | implicitCopyConstructorHasConstParam()); |
| 1034 | } |
| 1035 | |
| 1036 | |
| 1037 | |
| 1038 | |
| 1039 | |
| 1040 | |
| 1041 | bool hasUserDeclaredMoveOperation() const { |
| 1042 | return data().UserDeclaredSpecialMembers & |
| 1043 | (SMF_MoveConstructor | SMF_MoveAssignment); |
| 1044 | } |
| 1045 | |
| 1046 | |
| 1047 | |
| 1048 | bool hasUserDeclaredMoveConstructor() const { |
| 1049 | return data().UserDeclaredSpecialMembers & SMF_MoveConstructor; |
| 1050 | } |
| 1051 | |
| 1052 | |
| 1053 | bool hasMoveConstructor() const { |
| 1054 | return (data().DeclaredSpecialMembers & SMF_MoveConstructor) || |
| 1055 | needsImplicitMoveConstructor(); |
| 1056 | } |
| 1057 | |
| 1058 | |
| 1059 | |
| 1060 | void setImplicitCopyConstructorIsDeleted() { |
| 1061 | (0) . __assert_fail ("(data().DefaultedCopyConstructorIsDeleted || needsOverloadResolutionForCopyConstructor()) && \"Copy constructor should not be deleted\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/DeclCXX.h", 1063, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert((data().DefaultedCopyConstructorIsDeleted || |
| 1062 | (0) . __assert_fail ("(data().DefaultedCopyConstructorIsDeleted || needsOverloadResolutionForCopyConstructor()) && \"Copy constructor should not be deleted\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/DeclCXX.h", 1063, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> needsOverloadResolutionForCopyConstructor()) && |
| 1063 | (0) . __assert_fail ("(data().DefaultedCopyConstructorIsDeleted || needsOverloadResolutionForCopyConstructor()) && \"Copy constructor should not be deleted\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/DeclCXX.h", 1063, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "Copy constructor should not be deleted"); |
| 1064 | data().DefaultedCopyConstructorIsDeleted = true; |
| 1065 | } |
| 1066 | |
| 1067 | |
| 1068 | |
| 1069 | void setImplicitMoveConstructorIsDeleted() { |
| 1070 | (0) . __assert_fail ("(data().DefaultedMoveConstructorIsDeleted || needsOverloadResolutionForMoveConstructor()) && \"move constructor should not be deleted\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/DeclCXX.h", 1072, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert((data().DefaultedMoveConstructorIsDeleted || |
| 1071 | (0) . __assert_fail ("(data().DefaultedMoveConstructorIsDeleted || needsOverloadResolutionForMoveConstructor()) && \"move constructor should not be deleted\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/DeclCXX.h", 1072, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> needsOverloadResolutionForMoveConstructor()) && |
| 1072 | (0) . __assert_fail ("(data().DefaultedMoveConstructorIsDeleted || needsOverloadResolutionForMoveConstructor()) && \"move constructor should not be deleted\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/DeclCXX.h", 1072, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "move constructor should not be deleted"); |
| 1073 | data().DefaultedMoveConstructorIsDeleted = true; |
| 1074 | } |
| 1075 | |
| 1076 | |
| 1077 | |
| 1078 | void setImplicitDestructorIsDeleted() { |
| 1079 | (0) . __assert_fail ("(data().DefaultedDestructorIsDeleted || needsOverloadResolutionForDestructor()) && \"destructor should not be deleted\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/DeclCXX.h", 1081, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert((data().DefaultedDestructorIsDeleted || |
| 1080 | (0) . __assert_fail ("(data().DefaultedDestructorIsDeleted || needsOverloadResolutionForDestructor()) && \"destructor should not be deleted\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/DeclCXX.h", 1081, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> needsOverloadResolutionForDestructor()) && |
| 1081 | (0) . __assert_fail ("(data().DefaultedDestructorIsDeleted || needsOverloadResolutionForDestructor()) && \"destructor should not be deleted\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/DeclCXX.h", 1081, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "destructor should not be deleted"); |
| 1082 | data().DefaultedDestructorIsDeleted = true; |
| 1083 | } |
| 1084 | |
| 1085 | |
| 1086 | |
| 1087 | bool needsImplicitMoveConstructor() const { |
| 1088 | return !(data().DeclaredSpecialMembers & SMF_MoveConstructor) && |
| 1089 | !hasUserDeclaredCopyConstructor() && |
| 1090 | !hasUserDeclaredCopyAssignment() && |
| 1091 | !hasUserDeclaredMoveAssignment() && |
| 1092 | !hasUserDeclaredDestructor(); |
| 1093 | } |
| 1094 | |
| 1095 | |
| 1096 | |
| 1097 | bool needsOverloadResolutionForMoveConstructor() const { |
| 1098 | return data().NeedOverloadResolutionForMoveConstructor; |
| 1099 | } |
| 1100 | |
| 1101 | |
| 1102 | |
| 1103 | |
| 1104 | |
| 1105 | bool hasUserDeclaredCopyAssignment() const { |
| 1106 | return data().UserDeclaredSpecialMembers & SMF_CopyAssignment; |
| 1107 | } |
| 1108 | |
| 1109 | |
| 1110 | |
| 1111 | bool needsImplicitCopyAssignment() const { |
| 1112 | return !(data().DeclaredSpecialMembers & SMF_CopyAssignment); |
| 1113 | } |
| 1114 | |
| 1115 | |
| 1116 | |
| 1117 | bool needsOverloadResolutionForCopyAssignment() const { |
| 1118 | return data().HasMutableFields; |
| 1119 | } |
| 1120 | |
| 1121 | |
| 1122 | |
| 1123 | bool implicitCopyAssignmentHasConstParam() const { |
| 1124 | return data().ImplicitCopyAssignmentHasConstParam; |
| 1125 | } |
| 1126 | |
| 1127 | |
| 1128 | |
| 1129 | |
| 1130 | bool hasCopyAssignmentWithConstParam() const { |
| 1131 | return data().HasDeclaredCopyAssignmentWithConstParam || |
| 1132 | (needsImplicitCopyAssignment() && |
| 1133 | implicitCopyAssignmentHasConstParam()); |
| 1134 | } |
| 1135 | |
| 1136 | |
| 1137 | |
| 1138 | bool hasUserDeclaredMoveAssignment() const { |
| 1139 | return data().UserDeclaredSpecialMembers & SMF_MoveAssignment; |
| 1140 | } |
| 1141 | |
| 1142 | |
| 1143 | bool hasMoveAssignment() const { |
| 1144 | return (data().DeclaredSpecialMembers & SMF_MoveAssignment) || |
| 1145 | needsImplicitMoveAssignment(); |
| 1146 | } |
| 1147 | |
| 1148 | |
| 1149 | |
| 1150 | void setImplicitMoveAssignmentIsDeleted() { |
| 1151 | (0) . __assert_fail ("(data().DefaultedMoveAssignmentIsDeleted || needsOverloadResolutionForMoveAssignment()) && \"move assignment should not be deleted\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/DeclCXX.h", 1153, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert((data().DefaultedMoveAssignmentIsDeleted || |
| 1152 | (0) . __assert_fail ("(data().DefaultedMoveAssignmentIsDeleted || needsOverloadResolutionForMoveAssignment()) && \"move assignment should not be deleted\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/DeclCXX.h", 1153, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> needsOverloadResolutionForMoveAssignment()) && |
| 1153 | (0) . __assert_fail ("(data().DefaultedMoveAssignmentIsDeleted || needsOverloadResolutionForMoveAssignment()) && \"move assignment should not be deleted\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/DeclCXX.h", 1153, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "move assignment should not be deleted"); |
| 1154 | data().DefaultedMoveAssignmentIsDeleted = true; |
| 1155 | } |
| 1156 | |
| 1157 | |
| 1158 | |
| 1159 | |
| 1160 | bool needsImplicitMoveAssignment() const { |
| 1161 | return !(data().DeclaredSpecialMembers & SMF_MoveAssignment) && |
| 1162 | !hasUserDeclaredCopyConstructor() && |
| 1163 | !hasUserDeclaredCopyAssignment() && |
| 1164 | !hasUserDeclaredMoveConstructor() && |
| 1165 | !hasUserDeclaredDestructor() && |
| 1166 | (!isLambda() || lambdaIsDefaultConstructibleAndAssignable()); |
| 1167 | } |
| 1168 | |
| 1169 | |
| 1170 | |
| 1171 | bool needsOverloadResolutionForMoveAssignment() const { |
| 1172 | return data().NeedOverloadResolutionForMoveAssignment; |
| 1173 | } |
| 1174 | |
| 1175 | |
| 1176 | |
| 1177 | |
| 1178 | bool hasUserDeclaredDestructor() const { |
| 1179 | return data().UserDeclaredSpecialMembers & SMF_Destructor; |
| 1180 | } |
| 1181 | |
| 1182 | |
| 1183 | |
| 1184 | bool needsImplicitDestructor() const { |
| 1185 | return !(data().DeclaredSpecialMembers & SMF_Destructor); |
| 1186 | } |
| 1187 | |
| 1188 | |
| 1189 | |
| 1190 | bool needsOverloadResolutionForDestructor() const { |
| 1191 | return data().NeedOverloadResolutionForDestructor; |
| 1192 | } |
| 1193 | |
| 1194 | |
| 1195 | bool isLambda() const { |
| 1196 | |
| 1197 | auto *DD = DefinitionData; |
| 1198 | return DD && DD->IsLambda; |
| 1199 | } |
| 1200 | |
| 1201 | |
| 1202 | |
| 1203 | |
| 1204 | bool isGenericLambda() const; |
| 1205 | |
| 1206 | |
| 1207 | |
| 1208 | bool lambdaIsDefaultConstructibleAndAssignable() const; |
| 1209 | |
| 1210 | |
| 1211 | |
| 1212 | CXXMethodDecl *getLambdaCallOperator() const; |
| 1213 | |
| 1214 | |
| 1215 | |
| 1216 | |
| 1217 | CXXMethodDecl *getLambdaStaticInvoker() const; |
| 1218 | |
| 1219 | |
| 1220 | |
| 1221 | |
| 1222 | TemplateParameterList *getGenericLambdaTemplateParameterList() const; |
| 1223 | |
| 1224 | LambdaCaptureDefault getLambdaCaptureDefault() const { |
| 1225 | assert(isLambda()); |
| 1226 | return static_cast<LambdaCaptureDefault>(getLambdaData().CaptureDefault); |
| 1227 | } |
| 1228 | |
| 1229 | |
| 1230 | |
| 1231 | |
| 1232 | |
| 1233 | |
| 1234 | |
| 1235 | |
| 1236 | |
| 1237 | |
| 1238 | |
| 1239 | |
| 1240 | |
| 1241 | void getCaptureFields(llvm::DenseMap<const VarDecl *, FieldDecl *> &Captures, |
| 1242 | FieldDecl *&ThisCapture) const; |
| 1243 | |
| 1244 | using capture_const_iterator = const LambdaCapture *; |
| 1245 | using capture_const_range = llvm::iterator_range<capture_const_iterator>; |
| 1246 | |
| 1247 | capture_const_range captures() const { |
| 1248 | return capture_const_range(captures_begin(), captures_end()); |
| 1249 | } |
| 1250 | |
| 1251 | capture_const_iterator captures_begin() const { |
| 1252 | return isLambda() ? getLambdaData().Captures : nullptr; |
| 1253 | } |
| 1254 | |
| 1255 | capture_const_iterator captures_end() const { |
| 1256 | return isLambda() ? captures_begin() + getLambdaData().NumCaptures |
| 1257 | : nullptr; |
| 1258 | } |
| 1259 | |
| 1260 | using conversion_iterator = UnresolvedSetIterator; |
| 1261 | |
| 1262 | conversion_iterator conversion_begin() const { |
| 1263 | return data().Conversions.get(getASTContext()).begin(); |
| 1264 | } |
| 1265 | |
| 1266 | conversion_iterator conversion_end() const { |
| 1267 | return data().Conversions.get(getASTContext()).end(); |
| 1268 | } |
| 1269 | |
| 1270 | |
| 1271 | |
| 1272 | |
| 1273 | void removeConversion(const NamedDecl *Old); |
| 1274 | |
| 1275 | |
| 1276 | |
| 1277 | llvm::iterator_range<conversion_iterator> getVisibleConversionFunctions(); |
| 1278 | |
| 1279 | |
| 1280 | |
| 1281 | |
| 1282 | |
| 1283 | bool isAggregate() const { return data().Aggregate; } |
| 1284 | |
| 1285 | |
| 1286 | |
| 1287 | |
| 1288 | bool hasInClassInitializer() const { return data().HasInClassInitializer; } |
| 1289 | |
| 1290 | |
| 1291 | |
| 1292 | |
| 1293 | |
| 1294 | |
| 1295 | |
| 1296 | |
| 1297 | |
| 1298 | bool hasUninitializedReferenceMember() const { |
| 1299 | return !isUnion() && !hasUserDeclaredConstructor() && |
| 1300 | data().HasUninitializedReferenceMember; |
| 1301 | } |
| 1302 | |
| 1303 | |
| 1304 | |
| 1305 | |
| 1306 | |
| 1307 | |
| 1308 | |
| 1309 | |
| 1310 | |
| 1311 | bool isPOD() const { return data().PlainOldData; } |
| 1312 | |
| 1313 | |
| 1314 | |
| 1315 | bool isCLike() const; |
| 1316 | |
| 1317 | |
| 1318 | |
| 1319 | |
| 1320 | |
| 1321 | |
| 1322 | |
| 1323 | |
| 1324 | |
| 1325 | |
| 1326 | bool isEmpty() const { return data().Empty; } |
| 1327 | |
| 1328 | |
| 1329 | bool hasDirectFields() const { |
| 1330 | auto &D = data(); |
| 1331 | return D.HasPublicFields || D.HasProtectedFields || D.HasPrivateFields; |
| 1332 | } |
| 1333 | |
| 1334 | |
| 1335 | |
| 1336 | bool isPolymorphic() const { return data().Polymorphic; } |
| 1337 | |
| 1338 | |
| 1339 | |
| 1340 | |
| 1341 | |
| 1342 | |
| 1343 | bool isAbstract() const { return data().Abstract; } |
| 1344 | |
| 1345 | |
| 1346 | |
| 1347 | bool isStandardLayout() const { return data().IsStandardLayout; } |
| 1348 | |
| 1349 | |
| 1350 | |
| 1351 | bool isCXX11StandardLayout() const { return data().IsCXX11StandardLayout; } |
| 1352 | |
| 1353 | |
| 1354 | |
| 1355 | bool hasMutableFields() const { return data().HasMutableFields; } |
| 1356 | |
| 1357 | |
| 1358 | bool hasVariantMembers() const { return data().HasVariantMembers; } |
| 1359 | |
| 1360 | |
| 1361 | |
| 1362 | bool hasTrivialDefaultConstructor() const { |
| 1363 | return hasDefaultConstructor() && |
| 1364 | (data().HasTrivialSpecialMembers & SMF_DefaultConstructor); |
| 1365 | } |
| 1366 | |
| 1367 | |
| 1368 | |
| 1369 | bool hasNonTrivialDefaultConstructor() const { |
| 1370 | return (data().DeclaredNonTrivialSpecialMembers & SMF_DefaultConstructor) || |
| 1371 | (needsImplicitDefaultConstructor() && |
| 1372 | !(data().HasTrivialSpecialMembers & SMF_DefaultConstructor)); |
| 1373 | } |
| 1374 | |
| 1375 | |
| 1376 | |
| 1377 | bool hasConstexprNonCopyMoveConstructor() const { |
| 1378 | return data().HasConstexprNonCopyMoveConstructor || |
| 1379 | (needsImplicitDefaultConstructor() && |
| 1380 | defaultedDefaultConstructorIsConstexpr()); |
| 1381 | } |
| 1382 | |
| 1383 | |
| 1384 | |
| 1385 | bool defaultedDefaultConstructorIsConstexpr() const { |
| 1386 | return data().DefaultedDefaultConstructorIsConstexpr && |
| 1387 | (!isUnion() || hasInClassInitializer() || !hasVariantMembers()); |
| 1388 | } |
| 1389 | |
| 1390 | |
| 1391 | bool hasConstexprDefaultConstructor() const { |
| 1392 | return data().HasConstexprDefaultConstructor || |
| 1393 | (needsImplicitDefaultConstructor() && |
| 1394 | defaultedDefaultConstructorIsConstexpr()); |
| 1395 | } |
| 1396 | |
| 1397 | |
| 1398 | |
| 1399 | bool hasTrivialCopyConstructor() const { |
| 1400 | return data().HasTrivialSpecialMembers & SMF_CopyConstructor; |
| 1401 | } |
| 1402 | |
| 1403 | bool hasTrivialCopyConstructorForCall() const { |
| 1404 | return data().HasTrivialSpecialMembersForCall & SMF_CopyConstructor; |
| 1405 | } |
| 1406 | |
| 1407 | |
| 1408 | |
| 1409 | bool hasNonTrivialCopyConstructor() const { |
| 1410 | return data().DeclaredNonTrivialSpecialMembers & SMF_CopyConstructor || |
| 1411 | !hasTrivialCopyConstructor(); |
| 1412 | } |
| 1413 | |
| 1414 | bool hasNonTrivialCopyConstructorForCall() const { |
| 1415 | return (data().DeclaredNonTrivialSpecialMembersForCall & |
| 1416 | SMF_CopyConstructor) || |
| 1417 | !hasTrivialCopyConstructorForCall(); |
| 1418 | } |
| 1419 | |
| 1420 | |
| 1421 | |
| 1422 | bool hasTrivialMoveConstructor() const { |
| 1423 | return hasMoveConstructor() && |
| 1424 | (data().HasTrivialSpecialMembers & SMF_MoveConstructor); |
| 1425 | } |
| 1426 | |
| 1427 | bool hasTrivialMoveConstructorForCall() const { |
| 1428 | return hasMoveConstructor() && |
| 1429 | (data().HasTrivialSpecialMembersForCall & SMF_MoveConstructor); |
| 1430 | } |
| 1431 | |
| 1432 | |
| 1433 | |
| 1434 | bool hasNonTrivialMoveConstructor() const { |
| 1435 | return (data().DeclaredNonTrivialSpecialMembers & SMF_MoveConstructor) || |
| 1436 | (needsImplicitMoveConstructor() && |
| 1437 | !(data().HasTrivialSpecialMembers & SMF_MoveConstructor)); |
| 1438 | } |
| 1439 | |
| 1440 | bool hasNonTrivialMoveConstructorForCall() const { |
| 1441 | return (data().DeclaredNonTrivialSpecialMembersForCall & |
| 1442 | SMF_MoveConstructor) || |
| 1443 | (needsImplicitMoveConstructor() && |
| 1444 | !(data().HasTrivialSpecialMembersForCall & SMF_MoveConstructor)); |
| 1445 | } |
| 1446 | |
| 1447 | |
| 1448 | |
| 1449 | bool hasTrivialCopyAssignment() const { |
| 1450 | return data().HasTrivialSpecialMembers & SMF_CopyAssignment; |
| 1451 | } |
| 1452 | |
| 1453 | |
| 1454 | |
| 1455 | bool hasNonTrivialCopyAssignment() const { |
| 1456 | return data().DeclaredNonTrivialSpecialMembers & SMF_CopyAssignment || |
| 1457 | !hasTrivialCopyAssignment(); |
| 1458 | } |
| 1459 | |
| 1460 | |
| 1461 | |
| 1462 | bool hasTrivialMoveAssignment() const { |
| 1463 | return hasMoveAssignment() && |
| 1464 | (data().HasTrivialSpecialMembers & SMF_MoveAssignment); |
| 1465 | } |
| 1466 | |
| 1467 | |
| 1468 | |
| 1469 | bool hasNonTrivialMoveAssignment() const { |
| 1470 | return (data().DeclaredNonTrivialSpecialMembers & SMF_MoveAssignment) || |
| 1471 | (needsImplicitMoveAssignment() && |
| 1472 | !(data().HasTrivialSpecialMembers & SMF_MoveAssignment)); |
| 1473 | } |
| 1474 | |
| 1475 | |
| 1476 | |
| 1477 | bool hasTrivialDestructor() const { |
| 1478 | return data().HasTrivialSpecialMembers & SMF_Destructor; |
| 1479 | } |
| 1480 | |
| 1481 | bool hasTrivialDestructorForCall() const { |
| 1482 | return data().HasTrivialSpecialMembersForCall & SMF_Destructor; |
| 1483 | } |
| 1484 | |
| 1485 | |
| 1486 | |
| 1487 | bool hasNonTrivialDestructor() const { |
| 1488 | return !(data().HasTrivialSpecialMembers & SMF_Destructor); |
| 1489 | } |
| 1490 | |
| 1491 | bool hasNonTrivialDestructorForCall() const { |
| 1492 | return !(data().HasTrivialSpecialMembersForCall & SMF_Destructor); |
| 1493 | } |
| 1494 | |
| 1495 | void setHasTrivialSpecialMemberForCall() { |
| 1496 | data().HasTrivialSpecialMembersForCall = |
| 1497 | (SMF_CopyConstructor | SMF_MoveConstructor | SMF_Destructor); |
| 1498 | } |
| 1499 | |
| 1500 | |
| 1501 | |
| 1502 | bool allowConstDefaultInit() const { |
| 1503 | return !data().HasUninitializedFields || |
| 1504 | !(data().HasDefaultedDefaultConstructor || |
| 1505 | needsImplicitDefaultConstructor()); |
| 1506 | } |
| 1507 | |
| 1508 | |
| 1509 | |
| 1510 | |
| 1511 | |
| 1512 | |
| 1513 | bool hasIrrelevantDestructor() const { |
| 1514 | return data().HasIrrelevantDestructor; |
| 1515 | } |
| 1516 | |
| 1517 | |
| 1518 | |
| 1519 | bool hasNonLiteralTypeFieldsOrBases() const { |
| 1520 | return data().HasNonLiteralTypeFieldsOrBases; |
| 1521 | } |
| 1522 | |
| 1523 | |
| 1524 | |
| 1525 | bool hasInheritedConstructor() const { |
| 1526 | return data().HasInheritedConstructor; |
| 1527 | } |
| 1528 | |
| 1529 | |
| 1530 | |
| 1531 | bool hasInheritedAssignment() const { |
| 1532 | return data().HasInheritedAssignment; |
| 1533 | } |
| 1534 | |
| 1535 | |
| 1536 | |
| 1537 | bool isTriviallyCopyable() const; |
| 1538 | |
| 1539 | |
| 1540 | |
| 1541 | |
| 1542 | |
| 1543 | |
| 1544 | bool isTrivial() const { |
| 1545 | return isTriviallyCopyable() && hasTrivialDefaultConstructor(); |
| 1546 | } |
| 1547 | |
| 1548 | |
| 1549 | |
| 1550 | |
| 1551 | |
| 1552 | |
| 1553 | |
| 1554 | |
| 1555 | |
| 1556 | |
| 1557 | |
| 1558 | |
| 1559 | |
| 1560 | |
| 1561 | |
| 1562 | |
| 1563 | |
| 1564 | |
| 1565 | bool isLiteral() const { |
| 1566 | return hasTrivialDestructor() && |
| 1567 | (!isLambda() || getASTContext().getLangOpts().CPlusPlus17) && |
| 1568 | !hasNonLiteralTypeFieldsOrBases() && |
| 1569 | (isAggregate() || isLambda() || |
| 1570 | hasConstexprNonCopyMoveConstructor() || |
| 1571 | hasTrivialDefaultConstructor()); |
| 1572 | } |
| 1573 | |
| 1574 | |
| 1575 | |
| 1576 | |
| 1577 | |
| 1578 | |
| 1579 | |
| 1580 | |
| 1581 | |
| 1582 | |
| 1583 | |
| 1584 | |
| 1585 | |
| 1586 | |
| 1587 | |
| 1588 | |
| 1589 | |
| 1590 | |
| 1591 | |
| 1592 | |
| 1593 | CXXRecordDecl *getInstantiatedFromMemberClass() const; |
| 1594 | |
| 1595 | |
| 1596 | |
| 1597 | |
| 1598 | MemberSpecializationInfo *getMemberSpecializationInfo() const; |
| 1599 | |
| 1600 | |
| 1601 | |
| 1602 | void setInstantiationOfMemberClass(CXXRecordDecl *RD, |
| 1603 | TemplateSpecializationKind TSK); |
| 1604 | |
| 1605 | |
| 1606 | |
| 1607 | |
| 1608 | |
| 1609 | |
| 1610 | |
| 1611 | |
| 1612 | |
| 1613 | |
| 1614 | |
| 1615 | |
| 1616 | ClassTemplateDecl *getDescribedClassTemplate() const; |
| 1617 | |
| 1618 | void setDescribedClassTemplate(ClassTemplateDecl *Template); |
| 1619 | |
| 1620 | |
| 1621 | |
| 1622 | |
| 1623 | TemplateSpecializationKind getTemplateSpecializationKind() const; |
| 1624 | |
| 1625 | |
| 1626 | void setTemplateSpecializationKind(TemplateSpecializationKind TSK); |
| 1627 | |
| 1628 | |
| 1629 | |
| 1630 | const CXXRecordDecl *getTemplateInstantiationPattern() const; |
| 1631 | |
| 1632 | CXXRecordDecl *getTemplateInstantiationPattern() { |
| 1633 | return const_cast<CXXRecordDecl *>(const_cast<const CXXRecordDecl *>(this) |
| 1634 | ->getTemplateInstantiationPattern()); |
| 1635 | } |
| 1636 | |
| 1637 | |
| 1638 | CXXDestructorDecl *getDestructor() const; |
| 1639 | |
| 1640 | |
| 1641 | |
| 1642 | bool isAnyDestructorNoReturn() const; |
| 1643 | |
| 1644 | |
| 1645 | |
| 1646 | const FunctionDecl *isLocalClass() const { |
| 1647 | if (const auto *RD = dyn_cast<CXXRecordDecl>(getDeclContext())) |
| 1648 | return RD->isLocalClass(); |
| 1649 | |
| 1650 | return dyn_cast<FunctionDecl>(getDeclContext()); |
| 1651 | } |
| 1652 | |
| 1653 | FunctionDecl *isLocalClass() { |
| 1654 | return const_cast<FunctionDecl*>( |
| 1655 | const_cast<const CXXRecordDecl*>(this)->isLocalClass()); |
| 1656 | } |
| 1657 | |
| 1658 | |
| 1659 | |
| 1660 | bool isCurrentInstantiation(const DeclContext *CurContext) const; |
| 1661 | |
| 1662 | |
| 1663 | |
| 1664 | |
| 1665 | |
| 1666 | |
| 1667 | |
| 1668 | |
| 1669 | |
| 1670 | |
| 1671 | |
| 1672 | bool isDerivedFrom(const CXXRecordDecl *Base) const; |
| 1673 | |
| 1674 | |
| 1675 | |
| 1676 | |
| 1677 | |
| 1678 | |
| 1679 | |
| 1680 | |
| 1681 | |
| 1682 | |
| 1683 | |
| 1684 | |
| 1685 | |
| 1686 | |
| 1687 | |
| 1688 | |
| 1689 | |
| 1690 | bool isDerivedFrom(const CXXRecordDecl *Base, CXXBasePaths &Paths) const; |
| 1691 | |
| 1692 | |
| 1693 | |
| 1694 | |
| 1695 | |
| 1696 | |
| 1697 | |
| 1698 | |
| 1699 | |
| 1700 | |
| 1701 | |
| 1702 | |
| 1703 | |
| 1704 | |
| 1705 | bool isVirtuallyDerivedFrom(const CXXRecordDecl *Base) const; |
| 1706 | |
| 1707 | |
| 1708 | |
| 1709 | bool isProvablyNotDerivedFrom(const CXXRecordDecl *Base) const; |
| 1710 | |
| 1711 | |
| 1712 | |
| 1713 | |
| 1714 | |
| 1715 | |
| 1716 | using ForallBasesCallback = |
| 1717 | llvm::function_ref<bool(const CXXRecordDecl *BaseDefinition)>; |
| 1718 | |
| 1719 | |
| 1720 | |
| 1721 | |
| 1722 | |
| 1723 | |
| 1724 | |
| 1725 | |
| 1726 | |
| 1727 | |
| 1728 | |
| 1729 | |
| 1730 | |
| 1731 | |
| 1732 | bool forallBases(ForallBasesCallback BaseMatches, |
| 1733 | bool AllowShortCircuit = true) const; |
| 1734 | |
| 1735 | |
| 1736 | |
| 1737 | |
| 1738 | |
| 1739 | |
| 1740 | |
| 1741 | |
| 1742 | |
| 1743 | |
| 1744 | |
| 1745 | using BaseMatchesCallback = |
| 1746 | llvm::function_ref<bool(const CXXBaseSpecifier *Specifier, |
| 1747 | CXXBasePath &Path)>; |
| 1748 | |
| 1749 | |
| 1750 | |
| 1751 | |
| 1752 | |
| 1753 | |
| 1754 | |
| 1755 | |
| 1756 | |
| 1757 | |
| 1758 | |
| 1759 | |
| 1760 | |
| 1761 | |
| 1762 | |
| 1763 | |
| 1764 | |
| 1765 | |
| 1766 | |
| 1767 | |
| 1768 | |
| 1769 | |
| 1770 | bool lookupInBases(BaseMatchesCallback BaseMatches, CXXBasePaths &Paths, |
| 1771 | bool LookupInDependent = false) const; |
| 1772 | |
| 1773 | |
| 1774 | |
| 1775 | |
| 1776 | |
| 1777 | |
| 1778 | |
| 1779 | |
| 1780 | static bool FindBaseClass(const CXXBaseSpecifier *Specifier, |
| 1781 | CXXBasePath &Path, const CXXRecordDecl *BaseRecord); |
| 1782 | |
| 1783 | |
| 1784 | |
| 1785 | |
| 1786 | |
| 1787 | |
| 1788 | |
| 1789 | |
| 1790 | |
| 1791 | |
| 1792 | static bool FindVirtualBaseClass(const CXXBaseSpecifier *Specifier, |
| 1793 | CXXBasePath &Path, |
| 1794 | const CXXRecordDecl *BaseRecord); |
| 1795 | |
| 1796 | |
| 1797 | |
| 1798 | |
| 1799 | |
| 1800 | |
| 1801 | static bool FindTagMember(const CXXBaseSpecifier *Specifier, |
| 1802 | CXXBasePath &Path, DeclarationName Name); |
| 1803 | |
| 1804 | |
| 1805 | |
| 1806 | |
| 1807 | |
| 1808 | |
| 1809 | static bool FindOrdinaryMember(const CXXBaseSpecifier *Specifier, |
| 1810 | CXXBasePath &Path, DeclarationName Name); |
| 1811 | |
| 1812 | |
| 1813 | |
| 1814 | |
| 1815 | |
| 1816 | |
| 1817 | |
| 1818 | static bool |
| 1819 | FindOrdinaryMemberInDependentClasses(const CXXBaseSpecifier *Specifier, |
| 1820 | CXXBasePath &Path, DeclarationName Name); |
| 1821 | |
| 1822 | |
| 1823 | |
| 1824 | |
| 1825 | |
| 1826 | |
| 1827 | static bool FindOMPReductionMember(const CXXBaseSpecifier *Specifier, |
| 1828 | CXXBasePath &Path, DeclarationName Name); |
| 1829 | |
| 1830 | |
| 1831 | |
| 1832 | |
| 1833 | |
| 1834 | |
| 1835 | static bool FindOMPMapperMember(const CXXBaseSpecifier *Specifier, |
| 1836 | CXXBasePath &Path, DeclarationName Name); |
| 1837 | |
| 1838 | |
| 1839 | |
| 1840 | |
| 1841 | |
| 1842 | |
| 1843 | |
| 1844 | static bool FindNestedNameSpecifierMember(const CXXBaseSpecifier *Specifier, |
| 1845 | CXXBasePath &Path, |
| 1846 | DeclarationName Name); |
| 1847 | |
| 1848 | |
| 1849 | |
| 1850 | |
| 1851 | void getFinalOverriders(CXXFinalOverriderMap &FinaOverriders) const; |
| 1852 | |
| 1853 | |
| 1854 | void getIndirectPrimaryBases(CXXIndirectPrimaryBaseSet& Bases) const; |
| 1855 | |
| 1856 | |
| 1857 | |
| 1858 | |
| 1859 | |
| 1860 | std::vector<const NamedDecl *> |
| 1861 | lookupDependentName(const DeclarationName &Name, |
| 1862 | llvm::function_ref<bool(const NamedDecl *ND)> Filter); |
| 1863 | |
| 1864 | |
| 1865 | |
| 1866 | |
| 1867 | void viewInheritance(ASTContext& Context) const; |
| 1868 | |
| 1869 | |
| 1870 | |
| 1871 | static AccessSpecifier MergeAccess(AccessSpecifier PathAccess, |
| 1872 | AccessSpecifier DeclAccess) { |
| 1873 | assert(DeclAccess != AS_none); |
| 1874 | if (DeclAccess == AS_private) return AS_none; |
| 1875 | return (PathAccess > DeclAccess ? PathAccess : DeclAccess); |
| 1876 | } |
| 1877 | |
| 1878 | |
| 1879 | |
| 1880 | void finishedDefaultedOrDeletedMember(CXXMethodDecl *MD); |
| 1881 | |
| 1882 | void setTrivialForCallFlags(CXXMethodDecl *MD); |
| 1883 | |
| 1884 | |
| 1885 | void completeDefinition() override; |
| 1886 | |
| 1887 | |
| 1888 | |
| 1889 | |
| 1890 | |
| 1891 | |
| 1892 | |
| 1893 | |
| 1894 | void completeDefinition(CXXFinalOverriderMap *FinalOverriders); |
| 1895 | |
| 1896 | |
| 1897 | |
| 1898 | |
| 1899 | |
| 1900 | |
| 1901 | |
| 1902 | |
| 1903 | bool mayBeAbstract() const; |
| 1904 | |
| 1905 | |
| 1906 | |
| 1907 | |
| 1908 | |
| 1909 | |
| 1910 | |
| 1911 | unsigned getLambdaManglingNumber() const { |
| 1912 | (0) . __assert_fail ("isLambda() && \"Not a lambda closure type!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/DeclCXX.h", 1912, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isLambda() && "Not a lambda closure type!"); |
| 1913 | return getLambdaData().ManglingNumber; |
| 1914 | } |
| 1915 | |
| 1916 | |
| 1917 | |
| 1918 | |
| 1919 | |
| 1920 | |
| 1921 | |
| 1922 | |
| 1923 | |
| 1924 | |
| 1925 | Decl *getLambdaContextDecl() const; |
| 1926 | |
| 1927 | |
| 1928 | |
| 1929 | void setLambdaMangling(unsigned ManglingNumber, Decl *ContextDecl) { |
| 1930 | getLambdaData().ManglingNumber = ManglingNumber; |
| 1931 | getLambdaData().ContextDecl = ContextDecl; |
| 1932 | } |
| 1933 | |
| 1934 | |
| 1935 | MSInheritanceAttr::Spelling getMSInheritanceModel() const; |
| 1936 | |
| 1937 | |
| 1938 | MSInheritanceAttr::Spelling calculateInheritanceModel() const; |
| 1939 | |
| 1940 | |
| 1941 | |
| 1942 | |
| 1943 | |
| 1944 | |
| 1945 | |
| 1946 | bool nullFieldOffsetIsZero() const { |
| 1947 | return !MSInheritanceAttr::hasOnlyOneField(, |
| 1948 | getMSInheritanceModel()) || |
| 1949 | (hasDefinition() && isPolymorphic()); |
| 1950 | } |
| 1951 | |
| 1952 | |
| 1953 | |
| 1954 | MSVtorDispAttr::Mode getMSVtorDispMode() const; |
| 1955 | |
| 1956 | |
| 1957 | |
| 1958 | |
| 1959 | |
| 1960 | |
| 1961 | |
| 1962 | |
| 1963 | |
| 1964 | |
| 1965 | |
| 1966 | |
| 1967 | bool isDependentLambda() const { |
| 1968 | return isLambda() && getLambdaData().Dependent; |
| 1969 | } |
| 1970 | |
| 1971 | TypeSourceInfo *getLambdaTypeInfo() const { |
| 1972 | return getLambdaData().MethodTyInfo; |
| 1973 | } |
| 1974 | |
| 1975 | |
| 1976 | |
| 1977 | bool isInterfaceLike() const; |
| 1978 | |
| 1979 | static bool classof(const Decl *D) { return classofKind(D->getKind()); } |
| 1980 | static bool classofKind(Kind K) { |
| 1981 | return K >= firstCXXRecord && K <= lastCXXRecord; |
| 1982 | } |
| 1983 | }; |
| 1984 | |
| 1985 | |
| 1986 | |
| 1987 | |
| 1988 | |
| 1989 | |
| 1990 | |
| 1991 | |
| 1992 | |
| 1993 | |
| 1994 | |
| 1995 | class CXXDeductionGuideDecl : public FunctionDecl { |
| 1996 | void anchor() override; |
| 1997 | |
| 1998 | private: |
| 1999 | CXXDeductionGuideDecl(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, |
| 2000 | bool IsExplicit, const DeclarationNameInfo &NameInfo, |
| 2001 | QualType T, TypeSourceInfo *TInfo, |
| 2002 | SourceLocation EndLocation) |
| 2003 | : FunctionDecl(CXXDeductionGuide, C, DC, StartLoc, NameInfo, T, TInfo, |
| 2004 | SC_None, false, false) { |
| 2005 | if (EndLocation.isValid()) |
| 2006 | setRangeEnd(EndLocation); |
| 2007 | setExplicitSpecified(IsExplicit); |
| 2008 | setIsCopyDeductionCandidate(false); |
| 2009 | } |
| 2010 | |
| 2011 | public: |
| 2012 | friend class ASTDeclReader; |
| 2013 | friend class ASTDeclWriter; |
| 2014 | |
| 2015 | static CXXDeductionGuideDecl *Create(ASTContext &C, DeclContext *DC, |
| 2016 | SourceLocation StartLoc, bool IsExplicit, |
| 2017 | const DeclarationNameInfo &NameInfo, |
| 2018 | QualType T, TypeSourceInfo *TInfo, |
| 2019 | SourceLocation EndLocation); |
| 2020 | |
| 2021 | static CXXDeductionGuideDecl *CreateDeserialized(ASTContext &C, unsigned ID); |
| 2022 | |
| 2023 | |
| 2024 | bool isExplicit() const { return isExplicitSpecified(); } |
| 2025 | |
| 2026 | |
| 2027 | TemplateDecl *getDeducedTemplate() const { |
| 2028 | return getDeclName().getCXXDeductionGuideTemplate(); |
| 2029 | } |
| 2030 | |
| 2031 | void setIsCopyDeductionCandidate(bool isCDC = true) { |
| 2032 | FunctionDeclBits.IsCopyDeductionCandidate = isCDC; |
| 2033 | } |
| 2034 | |
| 2035 | bool isCopyDeductionCandidate() const { |
| 2036 | return FunctionDeclBits.IsCopyDeductionCandidate; |
| 2037 | } |
| 2038 | |
| 2039 | |
| 2040 | static bool classof(const Decl *D) { return classofKind(D->getKind()); } |
| 2041 | static bool classofKind(Kind K) { return K == CXXDeductionGuide; } |
| 2042 | }; |
| 2043 | |
| 2044 | |
| 2045 | |
| 2046 | |
| 2047 | |
| 2048 | class CXXMethodDecl : public FunctionDecl { |
| 2049 | void anchor() override; |
| 2050 | |
| 2051 | protected: |
| 2052 | CXXMethodDecl(Kind DK, ASTContext &C, CXXRecordDecl *RD, |
| 2053 | SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, |
| 2054 | QualType T, TypeSourceInfo *TInfo, |
| 2055 | StorageClass SC, bool isInline, |
| 2056 | bool isConstexpr, SourceLocation EndLocation) |
| 2057 | : FunctionDecl(DK, C, RD, StartLoc, NameInfo, T, TInfo, |
| 2058 | SC, isInline, isConstexpr) { |
| 2059 | if (EndLocation.isValid()) |
| 2060 | setRangeEnd(EndLocation); |
| 2061 | } |
| 2062 | |
| 2063 | public: |
| 2064 | static CXXMethodDecl *Create(ASTContext &C, CXXRecordDecl *RD, |
| 2065 | SourceLocation StartLoc, |
| 2066 | const DeclarationNameInfo &NameInfo, |
| 2067 | QualType T, TypeSourceInfo *TInfo, |
| 2068 | StorageClass SC, |
| 2069 | bool isInline, |
| 2070 | bool isConstexpr, |
| 2071 | SourceLocation EndLocation); |
| 2072 | |
| 2073 | static CXXMethodDecl *CreateDeserialized(ASTContext &C, unsigned ID); |
| 2074 | |
| 2075 | bool isStatic() const; |
| 2076 | bool isInstance() const { return !isStatic(); } |
| 2077 | |
| 2078 | |
| 2079 | |
| 2080 | static bool isStaticOverloadedOperator(OverloadedOperatorKind OOK) { |
| 2081 | |
| 2082 | |
| 2083 | |
| 2084 | |
| 2085 | |
| 2086 | return OOK == OO_New || OOK == OO_Array_New || OOK == OO_Delete || |
| 2087 | OOK == OO_Array_Delete; |
| 2088 | } |
| 2089 | |
| 2090 | bool isConst() const { return getType()->castAs<FunctionType>()->isConst(); } |
| 2091 | bool isVolatile() const { return getType()->castAs<FunctionType>()->isVolatile(); } |
| 2092 | |
| 2093 | bool isVirtual() const { |
| 2094 | CXXMethodDecl *CD = const_cast<CXXMethodDecl*>(this)->getCanonicalDecl(); |
| 2095 | |
| 2096 | |
| 2097 | |
| 2098 | if (CD->isVirtualAsWritten() || CD->isPure()) |
| 2099 | return true; |
| 2100 | |
| 2101 | return CD->size_overridden_methods() != 0; |
| 2102 | } |
| 2103 | |
| 2104 | |
| 2105 | |
| 2106 | |
| 2107 | |
| 2108 | |
| 2109 | CXXMethodDecl *getDevirtualizedMethod(const Expr *Base, bool IsAppleKext); |
| 2110 | |
| 2111 | const CXXMethodDecl *getDevirtualizedMethod(const Expr *Base, |
| 2112 | bool IsAppleKext) const { |
| 2113 | return const_cast<CXXMethodDecl *>(this)->getDevirtualizedMethod( |
| 2114 | Base, IsAppleKext); |
| 2115 | } |
| 2116 | |
| 2117 | |
| 2118 | |
| 2119 | |
| 2120 | |
| 2121 | |
| 2122 | |
| 2123 | |
| 2124 | bool isUsualDeallocationFunction( |
| 2125 | SmallVectorImpl<const FunctionDecl *> &PreventedBy) const; |
| 2126 | |
| 2127 | |
| 2128 | |
| 2129 | bool isCopyAssignmentOperator() const; |
| 2130 | |
| 2131 | |
| 2132 | bool isMoveAssignmentOperator() const; |
| 2133 | |
| 2134 | CXXMethodDecl *getCanonicalDecl() override { |
| 2135 | return cast<CXXMethodDecl>(FunctionDecl::getCanonicalDecl()); |
| 2136 | } |
| 2137 | const CXXMethodDecl *getCanonicalDecl() const { |
| 2138 | return const_cast<CXXMethodDecl*>(this)->getCanonicalDecl(); |
| 2139 | } |
| 2140 | |
| 2141 | CXXMethodDecl *getMostRecentDecl() { |
| 2142 | return cast<CXXMethodDecl>( |
| 2143 | static_cast<FunctionDecl *>(this)->getMostRecentDecl()); |
| 2144 | } |
| 2145 | const CXXMethodDecl *getMostRecentDecl() const { |
| 2146 | return const_cast<CXXMethodDecl*>(this)->getMostRecentDecl(); |
| 2147 | } |
| 2148 | |
| 2149 | |
| 2150 | |
| 2151 | bool isUserProvided() const { |
| 2152 | auto *DeclAsWritten = this; |
| 2153 | if (auto *Pattern = getTemplateInstantiationPattern()) |
| 2154 | DeclAsWritten = cast<CXXMethodDecl>(Pattern); |
| 2155 | return !(DeclAsWritten->isDeleted() || |
| 2156 | DeclAsWritten->getCanonicalDecl()->isDefaulted()); |
| 2157 | } |
| 2158 | |
| 2159 | void addOverriddenMethod(const CXXMethodDecl *MD); |
| 2160 | |
| 2161 | using method_iterator = const CXXMethodDecl *const *; |
| 2162 | |
| 2163 | method_iterator begin_overridden_methods() const; |
| 2164 | method_iterator end_overridden_methods() const; |
| 2165 | unsigned size_overridden_methods() const; |
| 2166 | |
| 2167 | using overridden_method_range= ASTContext::overridden_method_range; |
| 2168 | |
| 2169 | overridden_method_range overridden_methods() const; |
| 2170 | |
| 2171 | |
| 2172 | |
| 2173 | const CXXRecordDecl *getParent() const { |
| 2174 | return cast<CXXRecordDecl>(FunctionDecl::getParent()); |
| 2175 | } |
| 2176 | |
| 2177 | |
| 2178 | |
| 2179 | CXXRecordDecl *getParent() { |
| 2180 | return const_cast<CXXRecordDecl *>( |
| 2181 | cast<CXXRecordDecl>(FunctionDecl::getParent())); |
| 2182 | } |
| 2183 | |
| 2184 | |
| 2185 | |
| 2186 | |
| 2187 | |
| 2188 | |
| 2189 | |
| 2190 | QualType getThisType() const; |
| 2191 | |
| 2192 | static QualType getThisType(const FunctionProtoType *FPT, |
| 2193 | const CXXRecordDecl *Decl); |
| 2194 | |
| 2195 | Qualifiers getMethodQualifiers() const { |
| 2196 | return getType()->getAs<FunctionProtoType>()->getMethodQuals(); |
| 2197 | } |
| 2198 | |
| 2199 | |
| 2200 | |
| 2201 | |
| 2202 | |
| 2203 | |
| 2204 | |
| 2205 | |
| 2206 | |
| 2207 | |
| 2208 | |
| 2209 | |
| 2210 | RefQualifierKind getRefQualifier() const { |
| 2211 | return getType()->getAs<FunctionProtoType>()->getRefQualifier(); |
| 2212 | } |
| 2213 | |
| 2214 | bool hasInlineBody() const; |
| 2215 | |
| 2216 | |
| 2217 | |
| 2218 | |
| 2219 | |
| 2220 | |
| 2221 | |
| 2222 | |
| 2223 | bool isLambdaStaticInvoker() const; |
| 2224 | |
| 2225 | |
| 2226 | |
| 2227 | |
| 2228 | |
| 2229 | |
| 2230 | CXXMethodDecl * |
| 2231 | getCorrespondingMethodInClass(const CXXRecordDecl *RD, |
| 2232 | bool MayBeBase = false); |
| 2233 | |
| 2234 | const CXXMethodDecl * |
| 2235 | getCorrespondingMethodInClass(const CXXRecordDecl *RD, |
| 2236 | bool MayBeBase = false) const { |
| 2237 | return const_cast<CXXMethodDecl *>(this) |
| 2238 | ->getCorrespondingMethodInClass(RD, MayBeBase); |
| 2239 | } |
| 2240 | |
| 2241 | |
| 2242 | static bool classof(const Decl *D) { return classofKind(D->getKind()); } |
| 2243 | static bool classofKind(Kind K) { |
| 2244 | return K >= firstCXXMethod && K <= lastCXXMethod; |
| 2245 | } |
| 2246 | }; |
| 2247 | |
| 2248 | |
| 2249 | |
| 2250 | |
| 2251 | |
| 2252 | |
| 2253 | |
| 2254 | |
| 2255 | |
| 2256 | |
| 2257 | |
| 2258 | |
| 2259 | |
| 2260 | |
| 2261 | |
| 2262 | |
| 2263 | class CXXCtorInitializer final { |
| 2264 | |
| 2265 | |
| 2266 | |
| 2267 | llvm::PointerUnion3<TypeSourceInfo *, FieldDecl *, IndirectFieldDecl *> |
| 2268 | Initializee; |
| 2269 | |
| 2270 | |
| 2271 | |
| 2272 | |
| 2273 | |
| 2274 | |
| 2275 | |
| 2276 | SourceLocation MemberOrEllipsisLocation; |
| 2277 | |
| 2278 | |
| 2279 | |
| 2280 | Stmt *Init; |
| 2281 | |
| 2282 | |
| 2283 | SourceLocation LParenLoc; |
| 2284 | |
| 2285 | |
| 2286 | SourceLocation RParenLoc; |
| 2287 | |
| 2288 | |
| 2289 | |
| 2290 | unsigned IsDelegating : 1; |
| 2291 | |
| 2292 | |
| 2293 | |
| 2294 | unsigned IsVirtual : 1; |
| 2295 | |
| 2296 | |
| 2297 | |
| 2298 | unsigned IsWritten : 1; |
| 2299 | |
| 2300 | |
| 2301 | |
| 2302 | unsigned SourceOrder : 13; |
| 2303 | |
| 2304 | public: |
| 2305 | |
| 2306 | explicit |
| 2307 | CXXCtorInitializer(ASTContext &Context, TypeSourceInfo *TInfo, bool IsVirtual, |
| 2308 | SourceLocation L, Expr *Init, SourceLocation R, |
| 2309 | SourceLocation EllipsisLoc); |
| 2310 | |
| 2311 | |
| 2312 | explicit |
| 2313 | CXXCtorInitializer(ASTContext &Context, FieldDecl *Member, |
| 2314 | SourceLocation MemberLoc, SourceLocation L, Expr *Init, |
| 2315 | SourceLocation R); |
| 2316 | |
| 2317 | |
| 2318 | explicit |
| 2319 | CXXCtorInitializer(ASTContext &Context, IndirectFieldDecl *Member, |
| 2320 | SourceLocation MemberLoc, SourceLocation L, Expr *Init, |
| 2321 | SourceLocation R); |
| 2322 | |
| 2323 | |
| 2324 | explicit |
| 2325 | CXXCtorInitializer(ASTContext &Context, TypeSourceInfo *TInfo, |
| 2326 | SourceLocation L, Expr *Init, SourceLocation R); |
| 2327 | |
| 2328 | |
| 2329 | int64_t getID(const ASTContext &Context) const; |
| 2330 | |
| 2331 | |
| 2332 | bool isBaseInitializer() const { |
| 2333 | return Initializee.is<TypeSourceInfo*>() && !IsDelegating; |
| 2334 | } |
| 2335 | |
| 2336 | |
| 2337 | |
| 2338 | bool isMemberInitializer() const { return Initializee.is<FieldDecl*>(); } |
| 2339 | |
| 2340 | bool isAnyMemberInitializer() const { |
| 2341 | return isMemberInitializer() || isIndirectMemberInitializer(); |
| 2342 | } |
| 2343 | |
| 2344 | bool isIndirectMemberInitializer() const { |
| 2345 | return Initializee.is<IndirectFieldDecl*>(); |
| 2346 | } |
| 2347 | |
| 2348 | |
| 2349 | |
| 2350 | |
| 2351 | |
| 2352 | |
| 2353 | |
| 2354 | bool isInClassMemberInitializer() const { |
| 2355 | return Init->getStmtClass() == Stmt::CXXDefaultInitExprClass; |
| 2356 | } |
| 2357 | |
| 2358 | |
| 2359 | |
| 2360 | bool isDelegatingInitializer() const { |
| 2361 | return Initializee.is<TypeSourceInfo*>() && IsDelegating; |
| 2362 | } |
| 2363 | |
| 2364 | |
| 2365 | bool isPackExpansion() const { |
| 2366 | return isBaseInitializer() && MemberOrEllipsisLocation.isValid(); |
| 2367 | } |
| 2368 | |
| 2369 | |
| 2370 | SourceLocation getEllipsisLoc() const { |
| 2371 | (0) . __assert_fail ("isPackExpansion() && \"Initializer is not a pack expansion\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/DeclCXX.h", 2371, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isPackExpansion() && "Initializer is not a pack expansion"); |
| 2372 | return MemberOrEllipsisLocation; |
| 2373 | } |
| 2374 | |
| 2375 | |
| 2376 | |
| 2377 | |
| 2378 | TypeLoc getBaseClassLoc() const; |
| 2379 | |
| 2380 | |
| 2381 | |
| 2382 | const Type *getBaseClass() const; |
| 2383 | |
| 2384 | |
| 2385 | bool isBaseVirtual() const { |
| 2386 | (0) . __assert_fail ("isBaseInitializer() && \"Must call this on base initializer!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/DeclCXX.h", 2386, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isBaseInitializer() && "Must call this on base initializer!"); |
| 2387 | |
| 2388 | return IsVirtual; |
| 2389 | } |
| 2390 | |
| 2391 | |
| 2392 | |
| 2393 | TypeSourceInfo *getTypeSourceInfo() const { |
| 2394 | return Initializee.dyn_cast<TypeSourceInfo *>(); |
| 2395 | } |
| 2396 | |
| 2397 | |
| 2398 | |
| 2399 | FieldDecl *getMember() const { |
| 2400 | if (isMemberInitializer()) |
| 2401 | return Initializee.get<FieldDecl*>(); |
| 2402 | return nullptr; |
| 2403 | } |
| 2404 | |
| 2405 | FieldDecl *getAnyMember() const { |
| 2406 | if (isMemberInitializer()) |
| 2407 | return Initializee.get<FieldDecl*>(); |
| 2408 | if (isIndirectMemberInitializer()) |
| 2409 | return Initializee.get<IndirectFieldDecl*>()->getAnonField(); |
| 2410 | return nullptr; |
| 2411 | } |
| 2412 | |
| 2413 | IndirectFieldDecl *getIndirectMember() const { |
| 2414 | if (isIndirectMemberInitializer()) |
| 2415 | return Initializee.get<IndirectFieldDecl*>(); |
| 2416 | return nullptr; |
| 2417 | } |
| 2418 | |
| 2419 | SourceLocation getMemberLocation() const { |
| 2420 | return MemberOrEllipsisLocation; |
| 2421 | } |
| 2422 | |
| 2423 | |
| 2424 | SourceLocation getSourceLocation() const; |
| 2425 | |
| 2426 | |
| 2427 | SourceRange getSourceRange() const LLVM_READONLY; |
| 2428 | |
| 2429 | |
| 2430 | |
| 2431 | bool isWritten() const { return IsWritten; } |
| 2432 | |
| 2433 | |
| 2434 | |
| 2435 | int getSourceOrder() const { |
| 2436 | return IsWritten ? static_cast<int>(SourceOrder) : -1; |
| 2437 | } |
| 2438 | |
| 2439 | |
| 2440 | |
| 2441 | |
| 2442 | |
| 2443 | |
| 2444 | |
| 2445 | |
| 2446 | void setSourceOrder(int Pos) { |
| 2447 | (0) . __assert_fail ("!IsWritten && \"setSourceOrder() used on implicit initializer\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/DeclCXX.h", 2448, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(!IsWritten && |
| 2448 | (0) . __assert_fail ("!IsWritten && \"setSourceOrder() used on implicit initializer\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/DeclCXX.h", 2448, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "setSourceOrder() used on implicit initializer"); |
| 2449 | (0) . __assert_fail ("SourceOrder == 0 && \"calling twice setSourceOrder() on the same initializer\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/DeclCXX.h", 2450, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(SourceOrder == 0 && |
| 2450 | (0) . __assert_fail ("SourceOrder == 0 && \"calling twice setSourceOrder() on the same initializer\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/DeclCXX.h", 2450, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "calling twice setSourceOrder() on the same initializer"); |
| 2451 | (0) . __assert_fail ("Pos >= 0 && \"setSourceOrder() used to make an initializer implicit\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/DeclCXX.h", 2452, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(Pos >= 0 && |
| 2452 | (0) . __assert_fail ("Pos >= 0 && \"setSourceOrder() used to make an initializer implicit\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/DeclCXX.h", 2452, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "setSourceOrder() used to make an initializer implicit"); |
| 2453 | IsWritten = true; |
| 2454 | SourceOrder = static_cast<unsigned>(Pos); |
| 2455 | } |
| 2456 | |
| 2457 | SourceLocation getLParenLoc() const { return LParenLoc; } |
| 2458 | SourceLocation getRParenLoc() const { return RParenLoc; } |
| 2459 | |
| 2460 | |
| 2461 | Expr *getInit() const { return static_cast<Expr *>(Init); } |
| 2462 | }; |
| 2463 | |
| 2464 | |
| 2465 | class InheritedConstructor { |
| 2466 | ConstructorUsingShadowDecl *Shadow = nullptr; |
| 2467 | CXXConstructorDecl *BaseCtor = nullptr; |
| 2468 | |
| 2469 | public: |
| 2470 | InheritedConstructor() = default; |
| 2471 | InheritedConstructor(ConstructorUsingShadowDecl *Shadow, |
| 2472 | CXXConstructorDecl *BaseCtor) |
| 2473 | : Shadow(Shadow), BaseCtor(BaseCtor) {} |
| 2474 | |
| 2475 | explicit operator bool() const { return Shadow; } |
| 2476 | |
| 2477 | ConstructorUsingShadowDecl *getShadowDecl() const { return Shadow; } |
| 2478 | CXXConstructorDecl *getConstructor() const { return BaseCtor; } |
| 2479 | }; |
| 2480 | |
| 2481 | |
| 2482 | |
| 2483 | |
| 2484 | |
| 2485 | |
| 2486 | |
| 2487 | |
| 2488 | |
| 2489 | |
| 2490 | |
| 2491 | class CXXConstructorDecl final |
| 2492 | : public CXXMethodDecl, |
| 2493 | private llvm::TrailingObjects<CXXConstructorDecl, InheritedConstructor> { |
| 2494 | |
| 2495 | |
| 2496 | |
| 2497 | |
| 2498 | |
| 2499 | |
| 2500 | LazyCXXCtorInitializersPtr CtorInitializers; |
| 2501 | |
| 2502 | CXXConstructorDecl(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, |
| 2503 | const DeclarationNameInfo &NameInfo, |
| 2504 | QualType T, TypeSourceInfo *TInfo, |
| 2505 | bool isExplicitSpecified, bool isInline, |
| 2506 | bool isImplicitlyDeclared, bool isConstexpr, |
| 2507 | InheritedConstructor Inherited); |
| 2508 | |
| 2509 | void anchor() override; |
| 2510 | |
| 2511 | public: |
| 2512 | friend class ASTDeclReader; |
| 2513 | friend class ASTDeclWriter; |
| 2514 | friend TrailingObjects; |
| 2515 | |
| 2516 | static CXXConstructorDecl *CreateDeserialized(ASTContext &C, unsigned ID, |
| 2517 | bool InheritsConstructor); |
| 2518 | static CXXConstructorDecl * |
| 2519 | Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, |
| 2520 | const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, |
| 2521 | bool isExplicit, bool isInline, bool isImplicitlyDeclared, |
| 2522 | bool isConstexpr, |
| 2523 | InheritedConstructor Inherited = InheritedConstructor()); |
| 2524 | |
| 2525 | |
| 2526 | using init_iterator = CXXCtorInitializer **; |
| 2527 | |
| 2528 | |
| 2529 | using init_const_iterator = CXXCtorInitializer *const *; |
| 2530 | |
| 2531 | using init_range = llvm::iterator_range<init_iterator>; |
| 2532 | using init_const_range = llvm::iterator_range<init_const_iterator>; |
| 2533 | |
| 2534 | init_range inits() { return init_range(init_begin(), init_end()); } |
| 2535 | init_const_range inits() const { |
| 2536 | return init_const_range(init_begin(), init_end()); |
| 2537 | } |
| 2538 | |
| 2539 | |
| 2540 | init_iterator init_begin() { |
| 2541 | const auto *ConstThis = this; |
| 2542 | return const_cast<init_iterator>(ConstThis->init_begin()); |
| 2543 | } |
| 2544 | |
| 2545 | |
| 2546 | init_const_iterator init_begin() const; |
| 2547 | |
| 2548 | |
| 2549 | init_iterator init_end() { |
| 2550 | return init_begin() + getNumCtorInitializers(); |
| 2551 | } |
| 2552 | |
| 2553 | |
| 2554 | init_const_iterator init_end() const { |
| 2555 | return init_begin() + getNumCtorInitializers(); |
| 2556 | } |
| 2557 | |
| 2558 | using init_reverse_iterator = std::reverse_iterator<init_iterator>; |
| 2559 | using init_const_reverse_iterator = |
| 2560 | std::reverse_iterator<init_const_iterator>; |
| 2561 | |
| 2562 | init_reverse_iterator init_rbegin() { |
| 2563 | return init_reverse_iterator(init_end()); |
| 2564 | } |
| 2565 | init_const_reverse_iterator init_rbegin() const { |
| 2566 | return init_const_reverse_iterator(init_end()); |
| 2567 | } |
| 2568 | |
| 2569 | init_reverse_iterator init_rend() { |
| 2570 | return init_reverse_iterator(init_begin()); |
| 2571 | } |
| 2572 | init_const_reverse_iterator init_rend() const { |
| 2573 | return init_const_reverse_iterator(init_begin()); |
| 2574 | } |
| 2575 | |
| 2576 | |
| 2577 | |
| 2578 | unsigned getNumCtorInitializers() const { |
| 2579 | return CXXConstructorDeclBits.NumCtorInitializers; |
| 2580 | } |
| 2581 | |
| 2582 | void setNumCtorInitializers(unsigned numCtorInitializers) { |
| 2583 | CXXConstructorDeclBits.NumCtorInitializers = numCtorInitializers; |
| 2584 | |
| 2585 | |
| 2586 | |
| 2587 | (0) . __assert_fail ("CXXConstructorDeclBits.NumCtorInitializers == numCtorInitializers && \"NumCtorInitializers overflow!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/DeclCXX.h", 2588, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(CXXConstructorDeclBits.NumCtorInitializers == |
| 2588 | (0) . __assert_fail ("CXXConstructorDeclBits.NumCtorInitializers == numCtorInitializers && \"NumCtorInitializers overflow!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/DeclCXX.h", 2588, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> numCtorInitializers && "NumCtorInitializers overflow!"); |
| 2589 | } |
| 2590 | |
| 2591 | void setCtorInitializers(CXXCtorInitializer **Initializers) { |
| 2592 | CtorInitializers = Initializers; |
| 2593 | } |
| 2594 | |
| 2595 | |
| 2596 | bool isExplicit() const { |
| 2597 | return getCanonicalDecl()->isExplicitSpecified(); |
| 2598 | } |
| 2599 | |
| 2600 | |
| 2601 | bool isDelegatingConstructor() const { |
| 2602 | return (getNumCtorInitializers() == 1) && |
| 2603 | init_begin()[0]->isDelegatingInitializer(); |
| 2604 | } |
| 2605 | |
| 2606 | |
| 2607 | CXXConstructorDecl *getTargetConstructor() const; |
| 2608 | |
| 2609 | |
| 2610 | |
| 2611 | |
| 2612 | bool isDefaultConstructor() const; |
| 2613 | |
| 2614 | |
| 2615 | |
| 2616 | |
| 2617 | |
| 2618 | |
| 2619 | |
| 2620 | |
| 2621 | |
| 2622 | |
| 2623 | |
| 2624 | |
| 2625 | |
| 2626 | |
| 2627 | bool isCopyConstructor(unsigned &TypeQuals) const; |
| 2628 | |
| 2629 | |
| 2630 | |
| 2631 | |
| 2632 | bool isCopyConstructor() const { |
| 2633 | unsigned TypeQuals = 0; |
| 2634 | return isCopyConstructor(TypeQuals); |
| 2635 | } |
| 2636 | |
| 2637 | |
| 2638 | |
| 2639 | |
| 2640 | |
| 2641 | |
| 2642 | bool isMoveConstructor(unsigned &TypeQuals) const; |
| 2643 | |
| 2644 | |
| 2645 | |
| 2646 | bool isMoveConstructor() const { |
| 2647 | unsigned TypeQuals = 0; |
| 2648 | return isMoveConstructor(TypeQuals); |
| 2649 | } |
| 2650 | |
| 2651 | |
| 2652 | |
| 2653 | |
| 2654 | |
| 2655 | bool isCopyOrMoveConstructor(unsigned &TypeQuals) const; |
| 2656 | |
| 2657 | |
| 2658 | bool isCopyOrMoveConstructor() const { |
| 2659 | unsigned Quals; |
| 2660 | return isCopyOrMoveConstructor(Quals); |
| 2661 | } |
| 2662 | |
| 2663 | |
| 2664 | |
| 2665 | |
| 2666 | bool isConvertingConstructor(bool AllowExplicit) const; |
| 2667 | |
| 2668 | |
| 2669 | |
| 2670 | |
| 2671 | bool isSpecializationCopyingObject() const; |
| 2672 | |
| 2673 | |
| 2674 | |
| 2675 | bool isInheritingConstructor() const { |
| 2676 | return CXXConstructorDeclBits.IsInheritingConstructor; |
| 2677 | } |
| 2678 | |
| 2679 | |
| 2680 | |
| 2681 | void setInheritingConstructor(bool isIC = true) { |
| 2682 | CXXConstructorDeclBits.IsInheritingConstructor = isIC; |
| 2683 | } |
| 2684 | |
| 2685 | |
| 2686 | InheritedConstructor getInheritedConstructor() const { |
| 2687 | return isInheritingConstructor() ? |
| 2688 | *getTrailingObjects<InheritedConstructor>() : InheritedConstructor(); |
| 2689 | } |
| 2690 | |
| 2691 | CXXConstructorDecl *getCanonicalDecl() override { |
| 2692 | return cast<CXXConstructorDecl>(FunctionDecl::getCanonicalDecl()); |
| 2693 | } |
| 2694 | const CXXConstructorDecl *getCanonicalDecl() const { |
| 2695 | return const_cast<CXXConstructorDecl*>(this)->getCanonicalDecl(); |
| 2696 | } |
| 2697 | |
| 2698 | |
| 2699 | static bool classof(const Decl *D) { return classofKind(D->getKind()); } |
| 2700 | static bool classofKind(Kind K) { return K == CXXConstructor; } |
| 2701 | }; |
| 2702 | |
| 2703 | |
| 2704 | |
| 2705 | |
| 2706 | |
| 2707 | |
| 2708 | |
| 2709 | |
| 2710 | |
| 2711 | |
| 2712 | |
| 2713 | class CXXDestructorDecl : public CXXMethodDecl { |
| 2714 | friend class ASTDeclReader; |
| 2715 | friend class ASTDeclWriter; |
| 2716 | |
| 2717 | |
| 2718 | |
| 2719 | FunctionDecl *OperatorDelete = nullptr; |
| 2720 | Expr *OperatorDeleteThisArg = nullptr; |
| 2721 | |
| 2722 | CXXDestructorDecl(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, |
| 2723 | const DeclarationNameInfo &NameInfo, |
| 2724 | QualType T, TypeSourceInfo *TInfo, |
| 2725 | bool isInline, bool isImplicitlyDeclared) |
| 2726 | : CXXMethodDecl(CXXDestructor, C, RD, StartLoc, NameInfo, T, TInfo, |
| 2727 | SC_None, isInline, , SourceLocation()) |
| 2728 | { |
| 2729 | setImplicit(isImplicitlyDeclared); |
| 2730 | } |
| 2731 | |
| 2732 | void anchor() override; |
| 2733 | |
| 2734 | public: |
| 2735 | static CXXDestructorDecl *Create(ASTContext &C, CXXRecordDecl *RD, |
| 2736 | SourceLocation StartLoc, |
| 2737 | const DeclarationNameInfo &NameInfo, |
| 2738 | QualType T, TypeSourceInfo* TInfo, |
| 2739 | bool isInline, |
| 2740 | bool isImplicitlyDeclared); |
| 2741 | static CXXDestructorDecl *CreateDeserialized(ASTContext & C, unsigned ID); |
| 2742 | |
| 2743 | void setOperatorDelete(FunctionDecl *OD, Expr *ThisArg); |
| 2744 | |
| 2745 | const FunctionDecl *getOperatorDelete() const { |
| 2746 | return getCanonicalDecl()->OperatorDelete; |
| 2747 | } |
| 2748 | |
| 2749 | Expr *getOperatorDeleteThisArg() const { |
| 2750 | return getCanonicalDecl()->OperatorDeleteThisArg; |
| 2751 | } |
| 2752 | |
| 2753 | CXXDestructorDecl *getCanonicalDecl() override { |
| 2754 | return cast<CXXDestructorDecl>(FunctionDecl::getCanonicalDecl()); |
| 2755 | } |
| 2756 | const CXXDestructorDecl *getCanonicalDecl() const { |
| 2757 | return const_cast<CXXDestructorDecl*>(this)->getCanonicalDecl(); |
| 2758 | } |
| 2759 | |
| 2760 | |
| 2761 | static bool classof(const Decl *D) { return classofKind(D->getKind()); } |
| 2762 | static bool classofKind(Kind K) { return K == CXXDestructor; } |
| 2763 | }; |
| 2764 | |
| 2765 | |
| 2766 | |
| 2767 | |
| 2768 | |
| 2769 | |
| 2770 | |
| 2771 | |
| 2772 | |
| 2773 | |
| 2774 | |
| 2775 | class CXXConversionDecl : public CXXMethodDecl { |
| 2776 | CXXConversionDecl(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, |
| 2777 | const DeclarationNameInfo &NameInfo, QualType T, |
| 2778 | TypeSourceInfo *TInfo, bool isInline, |
| 2779 | bool isExplicitSpecified, bool isConstexpr, |
| 2780 | SourceLocation EndLocation) |
| 2781 | : CXXMethodDecl(CXXConversion, C, RD, StartLoc, NameInfo, T, TInfo, |
| 2782 | SC_None, isInline, isConstexpr, EndLocation) { |
| 2783 | setExplicitSpecified(isExplicitSpecified); |
| 2784 | } |
| 2785 | |
| 2786 | void anchor() override; |
| 2787 | |
| 2788 | public: |
| 2789 | friend class ASTDeclReader; |
| 2790 | friend class ASTDeclWriter; |
| 2791 | |
| 2792 | static CXXConversionDecl *Create(ASTContext &C, CXXRecordDecl *RD, |
| 2793 | SourceLocation StartLoc, |
| 2794 | const DeclarationNameInfo &NameInfo, |
| 2795 | QualType T, TypeSourceInfo *TInfo, |
| 2796 | bool isInline, bool isExplicit, |
| 2797 | bool isConstexpr, |
| 2798 | SourceLocation EndLocation); |
| 2799 | static CXXConversionDecl *CreateDeserialized(ASTContext &C, unsigned ID); |
| 2800 | |
| 2801 | |
| 2802 | bool isExplicit() const { |
| 2803 | return getCanonicalDecl()->isExplicitSpecified(); |
| 2804 | } |
| 2805 | |
| 2806 | |
| 2807 | QualType getConversionType() const { |
| 2808 | return getType()->getAs<FunctionType>()->getReturnType(); |
| 2809 | } |
| 2810 | |
| 2811 | |
| 2812 | |
| 2813 | bool isLambdaToBlockPointerConversion() const; |
| 2814 | |
| 2815 | CXXConversionDecl *getCanonicalDecl() override { |
| 2816 | return cast<CXXConversionDecl>(FunctionDecl::getCanonicalDecl()); |
| 2817 | } |
| 2818 | const CXXConversionDecl *getCanonicalDecl() const { |
| 2819 | return const_cast<CXXConversionDecl*>(this)->getCanonicalDecl(); |
| 2820 | } |
| 2821 | |
| 2822 | |
| 2823 | static bool classof(const Decl *D) { return classofKind(D->getKind()); } |
| 2824 | static bool classofKind(Kind K) { return K == CXXConversion; } |
| 2825 | }; |
| 2826 | |
| 2827 | |
| 2828 | |
| 2829 | |
| 2830 | |
| 2831 | |
| 2832 | |
| 2833 | class LinkageSpecDecl : public Decl, public DeclContext { |
| 2834 | virtual void anchor(); |
| 2835 | |
| 2836 | |
| 2837 | public: |
| 2838 | |
| 2839 | |
| 2840 | |
| 2841 | |
| 2842 | |
| 2843 | |
| 2844 | enum LanguageIDs { |
| 2845 | lang_c = 0x0002, |
| 2846 | lang_cxx = 0x0004 |
| 2847 | }; |
| 2848 | |
| 2849 | private: |
| 2850 | |
| 2851 | SourceLocation ExternLoc; |
| 2852 | |
| 2853 | |
| 2854 | SourceLocation RBraceLoc; |
| 2855 | |
| 2856 | LinkageSpecDecl(DeclContext *DC, SourceLocation ExternLoc, |
| 2857 | SourceLocation LangLoc, LanguageIDs lang, bool HasBraces); |
| 2858 | |
| 2859 | public: |
| 2860 | static LinkageSpecDecl *Create(ASTContext &C, DeclContext *DC, |
| 2861 | SourceLocation ExternLoc, |
| 2862 | SourceLocation LangLoc, LanguageIDs Lang, |
| 2863 | bool HasBraces); |
| 2864 | static LinkageSpecDecl *CreateDeserialized(ASTContext &C, unsigned ID); |
| 2865 | |
| 2866 | |
| 2867 | LanguageIDs getLanguage() const { |
| 2868 | return static_cast<LanguageIDs>(LinkageSpecDeclBits.Language); |
| 2869 | } |
| 2870 | |
| 2871 | |
| 2872 | void setLanguage(LanguageIDs L) { LinkageSpecDeclBits.Language = L; } |
| 2873 | |
| 2874 | |
| 2875 | |
| 2876 | bool hasBraces() const { |
| 2877 | assert(!RBraceLoc.isValid() || LinkageSpecDeclBits.HasBraces); |
| 2878 | return LinkageSpecDeclBits.HasBraces; |
| 2879 | } |
| 2880 | |
| 2881 | SourceLocation getExternLoc() const { return ExternLoc; } |
| 2882 | SourceLocation getRBraceLoc() const { return RBraceLoc; } |
| 2883 | void setExternLoc(SourceLocation L) { ExternLoc = L; } |
| 2884 | void setRBraceLoc(SourceLocation L) { |
| 2885 | RBraceLoc = L; |
| 2886 | LinkageSpecDeclBits.HasBraces = RBraceLoc.isValid(); |
| 2887 | } |
| 2888 | |
| 2889 | SourceLocation getEndLoc() const LLVM_READONLY { |
| 2890 | if (hasBraces()) |
| 2891 | return getRBraceLoc(); |
| 2892 | |
| 2893 | |
| 2894 | return decls_empty() ? getLocation() : decls_begin()->getEndLoc(); |
| 2895 | } |
| 2896 | |
| 2897 | SourceRange getSourceRange() const override LLVM_READONLY { |
| 2898 | return SourceRange(ExternLoc, getEndLoc()); |
| 2899 | } |
| 2900 | |
| 2901 | static bool classof(const Decl *D) { return classofKind(D->getKind()); } |
| 2902 | static bool classofKind(Kind K) { return K == LinkageSpec; } |
| 2903 | |
| 2904 | static DeclContext *castToDeclContext(const LinkageSpecDecl *D) { |
| 2905 | return static_cast<DeclContext *>(const_cast<LinkageSpecDecl*>(D)); |
| 2906 | } |
| 2907 | |
| 2908 | static LinkageSpecDecl *castFromDeclContext(const DeclContext *DC) { |
| 2909 | return static_cast<LinkageSpecDecl *>(const_cast<DeclContext*>(DC)); |
| 2910 | } |
| 2911 | }; |
| 2912 | |
| 2913 | |
| 2914 | |
| 2915 | |
| 2916 | |
| 2917 | |
| 2918 | |
| 2919 | |
| 2920 | |
| 2921 | |
| 2922 | |
| 2923 | class UsingDirectiveDecl : public NamedDecl { |
| 2924 | |
| 2925 | SourceLocation UsingLoc; |
| 2926 | |
| 2927 | |
| 2928 | SourceLocation NamespaceLoc; |
| 2929 | |
| 2930 | |
| 2931 | NestedNameSpecifierLoc QualifierLoc; |
| 2932 | |
| 2933 | |
| 2934 | NamedDecl *NominatedNamespace; |
| 2935 | |
| 2936 | |
| 2937 | |
| 2938 | DeclContext *CommonAncestor; |
| 2939 | |
| 2940 | UsingDirectiveDecl(DeclContext *DC, SourceLocation UsingLoc, |
| 2941 | SourceLocation NamespcLoc, |
| 2942 | NestedNameSpecifierLoc QualifierLoc, |
| 2943 | SourceLocation IdentLoc, |
| 2944 | NamedDecl *Nominated, |
| 2945 | DeclContext *CommonAncestor) |
| 2946 | : NamedDecl(UsingDirective, DC, IdentLoc, getName()), UsingLoc(UsingLoc), |
| 2947 | NamespaceLoc(NamespcLoc), QualifierLoc(QualifierLoc), |
| 2948 | NominatedNamespace(Nominated), CommonAncestor(CommonAncestor) {} |
| 2949 | |
| 2950 | |
| 2951 | |
| 2952 | |
| 2953 | |
| 2954 | static DeclarationName getName() { |
| 2955 | return DeclarationName::getUsingDirectiveName(); |
| 2956 | } |
| 2957 | |
| 2958 | void anchor() override; |
| 2959 | |
| 2960 | public: |
| 2961 | friend class ASTDeclReader; |
| 2962 | |
| 2963 | |
| 2964 | friend class DeclContext; |
| 2965 | |
| 2966 | |
| 2967 | |
| 2968 | NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; } |
| 2969 | |
| 2970 | |
| 2971 | |
| 2972 | NestedNameSpecifier *getQualifier() const { |
| 2973 | return QualifierLoc.getNestedNameSpecifier(); |
| 2974 | } |
| 2975 | |
| 2976 | NamedDecl *getNominatedNamespaceAsWritten() { return NominatedNamespace; } |
| 2977 | const NamedDecl *getNominatedNamespaceAsWritten() const { |
| 2978 | return NominatedNamespace; |
| 2979 | } |
| 2980 | |
| 2981 | |
| 2982 | NamespaceDecl *getNominatedNamespace(); |
| 2983 | |
| 2984 | const NamespaceDecl *getNominatedNamespace() const { |
| 2985 | return const_cast<UsingDirectiveDecl*>(this)->getNominatedNamespace(); |
| 2986 | } |
| 2987 | |
| 2988 | |
| 2989 | |
| 2990 | DeclContext *getCommonAncestor() { return CommonAncestor; } |
| 2991 | const DeclContext *getCommonAncestor() const { return CommonAncestor; } |
| 2992 | |
| 2993 | |
| 2994 | SourceLocation getUsingLoc() const { return UsingLoc; } |
| 2995 | |
| 2996 | |
| 2997 | |
| 2998 | SourceLocation getNamespaceKeyLocation() const { return NamespaceLoc; } |
| 2999 | |
| 3000 | |
| 3001 | SourceLocation getIdentLocation() const { return getLocation(); } |
| 3002 | |
| 3003 | static UsingDirectiveDecl *Create(ASTContext &C, DeclContext *DC, |
| 3004 | SourceLocation UsingLoc, |
| 3005 | SourceLocation NamespaceLoc, |
| 3006 | NestedNameSpecifierLoc QualifierLoc, |
| 3007 | SourceLocation IdentLoc, |
| 3008 | NamedDecl *Nominated, |
| 3009 | DeclContext *CommonAncestor); |
| 3010 | static UsingDirectiveDecl *CreateDeserialized(ASTContext &C, unsigned ID); |
| 3011 | |
| 3012 | SourceRange getSourceRange() const override LLVM_READONLY { |
| 3013 | return SourceRange(UsingLoc, getLocation()); |
| 3014 | } |
| 3015 | |
| 3016 | static bool classof(const Decl *D) { return classofKind(D->getKind()); } |
| 3017 | static bool classofKind(Kind K) { return K == UsingDirective; } |
| 3018 | }; |
| 3019 | |
| 3020 | |
| 3021 | |
| 3022 | |
| 3023 | |
| 3024 | |
| 3025 | |
| 3026 | |
| 3027 | class NamespaceAliasDecl : public NamedDecl, |
| 3028 | public Redeclarable<NamespaceAliasDecl> { |
| 3029 | friend class ASTDeclReader; |
| 3030 | |
| 3031 | |
| 3032 | SourceLocation NamespaceLoc; |
| 3033 | |
| 3034 | |
| 3035 | |
| 3036 | |
| 3037 | SourceLocation IdentLoc; |
| 3038 | |
| 3039 | |
| 3040 | NestedNameSpecifierLoc QualifierLoc; |
| 3041 | |
| 3042 | |
| 3043 | |
| 3044 | NamedDecl *Namespace; |
| 3045 | |
| 3046 | NamespaceAliasDecl(ASTContext &C, DeclContext *DC, |
| 3047 | SourceLocation NamespaceLoc, SourceLocation AliasLoc, |
| 3048 | IdentifierInfo *Alias, NestedNameSpecifierLoc QualifierLoc, |
| 3049 | SourceLocation IdentLoc, NamedDecl *Namespace) |
| 3050 | : NamedDecl(NamespaceAlias, DC, AliasLoc, Alias), redeclarable_base(C), |
| 3051 | NamespaceLoc(NamespaceLoc), IdentLoc(IdentLoc), |
| 3052 | QualifierLoc(QualifierLoc), Namespace(Namespace) {} |
| 3053 | |
| 3054 | void anchor() override; |
| 3055 | |
| 3056 | using redeclarable_base = Redeclarable<NamespaceAliasDecl>; |
| 3057 | |
| 3058 | NamespaceAliasDecl *getNextRedeclarationImpl() override; |
| 3059 | NamespaceAliasDecl *getPreviousDeclImpl() override; |
| 3060 | NamespaceAliasDecl *getMostRecentDeclImpl() override; |
| 3061 | |
| 3062 | public: |
| 3063 | static NamespaceAliasDecl *Create(ASTContext &C, DeclContext *DC, |
| 3064 | SourceLocation NamespaceLoc, |
| 3065 | SourceLocation AliasLoc, |
| 3066 | IdentifierInfo *Alias, |
| 3067 | NestedNameSpecifierLoc QualifierLoc, |
| 3068 | SourceLocation IdentLoc, |
| 3069 | NamedDecl *Namespace); |
| 3070 | |
| 3071 | static NamespaceAliasDecl *CreateDeserialized(ASTContext &C, unsigned ID); |
| 3072 | |
| 3073 | using redecl_range = redeclarable_base::redecl_range; |
| 3074 | using redecl_iterator = redeclarable_base::redecl_iterator; |
| 3075 | |
| 3076 | using redeclarable_base::redecls_begin; |
| 3077 | using redeclarable_base::redecls_end; |
| 3078 | using redeclarable_base::redecls; |
| 3079 | using redeclarable_base::getPreviousDecl; |
| 3080 | using redeclarable_base::getMostRecentDecl; |
| 3081 | |
| 3082 | NamespaceAliasDecl *getCanonicalDecl() override { |
| 3083 | return getFirstDecl(); |
| 3084 | } |
| 3085 | const NamespaceAliasDecl *getCanonicalDecl() const { |
| 3086 | return getFirstDecl(); |
| 3087 | } |
| 3088 | |
| 3089 | |
| 3090 | |
| 3091 | NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; } |
| 3092 | |
| 3093 | |
| 3094 | |
| 3095 | NestedNameSpecifier *getQualifier() const { |
| 3096 | return QualifierLoc.getNestedNameSpecifier(); |
| 3097 | } |
| 3098 | |
| 3099 | |
| 3100 | NamespaceDecl *getNamespace() { |
| 3101 | if (auto *AD = dyn_cast<NamespaceAliasDecl>(Namespace)) |
| 3102 | return AD->getNamespace(); |
| 3103 | |
| 3104 | return cast<NamespaceDecl>(Namespace); |
| 3105 | } |
| 3106 | |
| 3107 | const NamespaceDecl *getNamespace() const { |
| 3108 | return const_cast<NamespaceAliasDecl *>(this)->getNamespace(); |
| 3109 | } |
| 3110 | |
| 3111 | |
| 3112 | |
| 3113 | SourceLocation getAliasLoc() const { return getLocation(); } |
| 3114 | |
| 3115 | |
| 3116 | SourceLocation getNamespaceLoc() const { return NamespaceLoc; } |
| 3117 | |
| 3118 | |
| 3119 | SourceLocation getTargetNameLoc() const { return IdentLoc; } |
| 3120 | |
| 3121 | |
| 3122 | |
| 3123 | NamedDecl *getAliasedNamespace() const { return Namespace; } |
| 3124 | |
| 3125 | SourceRange getSourceRange() const override LLVM_READONLY { |
| 3126 | return SourceRange(NamespaceLoc, IdentLoc); |
| 3127 | } |
| 3128 | |
| 3129 | static bool classof(const Decl *D) { return classofKind(D->getKind()); } |
| 3130 | static bool classofKind(Kind K) { return K == NamespaceAlias; } |
| 3131 | }; |
| 3132 | |
| 3133 | |
| 3134 | |
| 3135 | |
| 3136 | |
| 3137 | |
| 3138 | |
| 3139 | |
| 3140 | |
| 3141 | |
| 3142 | |
| 3143 | |
| 3144 | |
| 3145 | |
| 3146 | class UsingShadowDecl : public NamedDecl, public Redeclarable<UsingShadowDecl> { |
| 3147 | friend class UsingDecl; |
| 3148 | |
| 3149 | |
| 3150 | NamedDecl *Underlying = nullptr; |
| 3151 | |
| 3152 | |
| 3153 | |
| 3154 | NamedDecl *UsingOrNextShadow = nullptr; |
| 3155 | |
| 3156 | void anchor() override; |
| 3157 | |
| 3158 | using redeclarable_base = Redeclarable<UsingShadowDecl>; |
| 3159 | |
| 3160 | UsingShadowDecl *getNextRedeclarationImpl() override { |
| 3161 | return getNextRedeclaration(); |
| 3162 | } |
| 3163 | |
| 3164 | UsingShadowDecl *getPreviousDeclImpl() override { |
| 3165 | return getPreviousDecl(); |
| 3166 | } |
| 3167 | |
| 3168 | UsingShadowDecl *getMostRecentDeclImpl() override { |
| 3169 | return getMostRecentDecl(); |
| 3170 | } |
| 3171 | |
| 3172 | protected: |
| 3173 | UsingShadowDecl(Kind K, ASTContext &C, DeclContext *DC, SourceLocation Loc, |
| 3174 | UsingDecl *Using, NamedDecl *Target); |
| 3175 | UsingShadowDecl(Kind K, ASTContext &C, EmptyShell); |
| 3176 | |
| 3177 | public: |
| 3178 | friend class ASTDeclReader; |
| 3179 | friend class ASTDeclWriter; |
| 3180 | |
| 3181 | static UsingShadowDecl *Create(ASTContext &C, DeclContext *DC, |
| 3182 | SourceLocation Loc, UsingDecl *Using, |
| 3183 | NamedDecl *Target) { |
| 3184 | return new (C, DC) UsingShadowDecl(UsingShadow, C, DC, Loc, Using, Target); |
| 3185 | } |
| 3186 | |
| 3187 | static UsingShadowDecl *CreateDeserialized(ASTContext &C, unsigned ID); |
| 3188 | |
| 3189 | using redecl_range = redeclarable_base::redecl_range; |
| 3190 | using redecl_iterator = redeclarable_base::redecl_iterator; |
| 3191 | |
| 3192 | using redeclarable_base::redecls_begin; |
| 3193 | using redeclarable_base::redecls_end; |
| 3194 | using redeclarable_base::redecls; |
| 3195 | using redeclarable_base::getPreviousDecl; |
| 3196 | using redeclarable_base::getMostRecentDecl; |
| 3197 | using redeclarable_base::isFirstDecl; |
| 3198 | |
| 3199 | UsingShadowDecl *getCanonicalDecl() override { |
| 3200 | return getFirstDecl(); |
| 3201 | } |
| 3202 | const UsingShadowDecl *getCanonicalDecl() const { |
| 3203 | return getFirstDecl(); |
| 3204 | } |
| 3205 | |
| 3206 | |
| 3207 | |
| 3208 | NamedDecl *getTargetDecl() const { return Underlying; } |
| 3209 | |
| 3210 | |
| 3211 | |
| 3212 | void setTargetDecl(NamedDecl *ND) { |
| 3213 | (0) . __assert_fail ("ND && \"Target decl is null!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/DeclCXX.h", 3213, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(ND && "Target decl is null!"); |
| 3214 | Underlying = ND; |
| 3215 | |
| 3216 | |
| 3217 | IdentifierNamespace = |
| 3218 | ND->getIdentifierNamespace() & |
| 3219 | ~(IDNS_OrdinaryFriend | IDNS_TagFriend | IDNS_LocalExtern); |
| 3220 | } |
| 3221 | |
| 3222 | |
| 3223 | UsingDecl *getUsingDecl() const; |
| 3224 | |
| 3225 | |
| 3226 | |
| 3227 | UsingShadowDecl *getNextUsingShadowDecl() const { |
| 3228 | return dyn_cast_or_null<UsingShadowDecl>(UsingOrNextShadow); |
| 3229 | } |
| 3230 | |
| 3231 | static bool classof(const Decl *D) { return classofKind(D->getKind()); } |
| 3232 | static bool classofKind(Kind K) { |
| 3233 | return K == Decl::UsingShadow || K == Decl::ConstructorUsingShadow; |
| 3234 | } |
| 3235 | }; |
| 3236 | |
| 3237 | |
| 3238 | |
| 3239 | |
| 3240 | |
| 3241 | |
| 3242 | |
| 3243 | |
| 3244 | |
| 3245 | |
| 3246 | |
| 3247 | class ConstructorUsingShadowDecl final : public UsingShadowDecl { |
| 3248 | |
| 3249 | |
| 3250 | |
| 3251 | ConstructorUsingShadowDecl *NominatedBaseClassShadowDecl = nullptr; |
| 3252 | |
| 3253 | |
| 3254 | |
| 3255 | |
| 3256 | |
| 3257 | ConstructorUsingShadowDecl *ConstructedBaseClassShadowDecl = nullptr; |
| 3258 | |
| 3259 | |
| 3260 | |
| 3261 | |
| 3262 | unsigned IsVirtual : 1; |
| 3263 | |
| 3264 | ConstructorUsingShadowDecl(ASTContext &C, DeclContext *DC, SourceLocation Loc, |
| 3265 | UsingDecl *Using, NamedDecl *Target, |
| 3266 | bool TargetInVirtualBase) |
| 3267 | : UsingShadowDecl(ConstructorUsingShadow, C, DC, Loc, Using, |
| 3268 | Target->getUnderlyingDecl()), |
| 3269 | NominatedBaseClassShadowDecl( |
| 3270 | dyn_cast<ConstructorUsingShadowDecl>(Target)), |
| 3271 | ConstructedBaseClassShadowDecl(NominatedBaseClassShadowDecl), |
| 3272 | IsVirtual(TargetInVirtualBase) { |
| 3273 | |
| 3274 | |
| 3275 | |
| 3276 | if (NominatedBaseClassShadowDecl && |
| 3277 | NominatedBaseClassShadowDecl->constructsVirtualBase()) { |
| 3278 | ConstructedBaseClassShadowDecl = |
| 3279 | NominatedBaseClassShadowDecl->ConstructedBaseClassShadowDecl; |
| 3280 | IsVirtual = true; |
| 3281 | } |
| 3282 | } |
| 3283 | |
| 3284 | ConstructorUsingShadowDecl(ASTContext &C, EmptyShell Empty) |
| 3285 | : UsingShadowDecl(ConstructorUsingShadow, C, Empty), IsVirtual(false) {} |
| 3286 | |
| 3287 | void anchor() override; |
| 3288 | |
| 3289 | public: |
| 3290 | friend class ASTDeclReader; |
| 3291 | friend class ASTDeclWriter; |
| 3292 | |
| 3293 | static ConstructorUsingShadowDecl *Create(ASTContext &C, DeclContext *DC, |
| 3294 | SourceLocation Loc, |
| 3295 | UsingDecl *Using, NamedDecl *Target, |
| 3296 | bool IsVirtual); |
| 3297 | static ConstructorUsingShadowDecl *CreateDeserialized(ASTContext &C, |
| 3298 | unsigned ID); |
| 3299 | |
| 3300 | |
| 3301 | |
| 3302 | |
| 3303 | const CXXRecordDecl *getParent() const { |
| 3304 | return cast<CXXRecordDecl>(getDeclContext()); |
| 3305 | } |
| 3306 | CXXRecordDecl *getParent() { |
| 3307 | return cast<CXXRecordDecl>(getDeclContext()); |
| 3308 | } |
| 3309 | |
| 3310 | |
| 3311 | |
| 3312 | |
| 3313 | |
| 3314 | ConstructorUsingShadowDecl *getNominatedBaseClassShadowDecl() const { |
| 3315 | return NominatedBaseClassShadowDecl; |
| 3316 | } |
| 3317 | |
| 3318 | |
| 3319 | |
| 3320 | ConstructorUsingShadowDecl *getConstructedBaseClassShadowDecl() const { |
| 3321 | return ConstructedBaseClassShadowDecl; |
| 3322 | } |
| 3323 | |
| 3324 | |
| 3325 | |
| 3326 | CXXRecordDecl *getNominatedBaseClass() const; |
| 3327 | |
| 3328 | |
| 3329 | |
| 3330 | CXXRecordDecl *getConstructedBaseClass() const { |
| 3331 | return cast<CXXRecordDecl>((ConstructedBaseClassShadowDecl |
| 3332 | ? ConstructedBaseClassShadowDecl |
| 3333 | : getTargetDecl()) |
| 3334 | ->getDeclContext()); |
| 3335 | } |
| 3336 | |
| 3337 | |
| 3338 | |
| 3339 | bool constructsVirtualBase() const { |
| 3340 | return IsVirtual; |
| 3341 | } |
| 3342 | |
| 3343 | |
| 3344 | |
| 3345 | |
| 3346 | CXXConstructorDecl *getConstructor() const; |
| 3347 | void setConstructor(NamedDecl *Ctor); |
| 3348 | |
| 3349 | static bool classof(const Decl *D) { return classofKind(D->getKind()); } |
| 3350 | static bool classofKind(Kind K) { return K == ConstructorUsingShadow; } |
| 3351 | }; |
| 3352 | |
| 3353 | |
| 3354 | |
| 3355 | |
| 3356 | |
| 3357 | |
| 3358 | |
| 3359 | class UsingDecl : public NamedDecl, public Mergeable<UsingDecl> { |
| 3360 | |
| 3361 | SourceLocation UsingLocation; |
| 3362 | |
| 3363 | |
| 3364 | NestedNameSpecifierLoc QualifierLoc; |
| 3365 | |
| 3366 | |
| 3367 | |
| 3368 | DeclarationNameLoc DNLoc; |
| 3369 | |
| 3370 | |
| 3371 | |
| 3372 | |
| 3373 | |
| 3374 | |
| 3375 | llvm::PointerIntPair<UsingShadowDecl *, 1, bool> FirstUsingShadow; |
| 3376 | |
| 3377 | UsingDecl(DeclContext *DC, SourceLocation UL, |
| 3378 | NestedNameSpecifierLoc QualifierLoc, |
| 3379 | const DeclarationNameInfo &NameInfo, bool HasTypenameKeyword) |
| 3380 | : NamedDecl(Using, DC, NameInfo.getLoc(), NameInfo.getName()), |
| 3381 | UsingLocation(UL), QualifierLoc(QualifierLoc), |
| 3382 | DNLoc(NameInfo.getInfo()), FirstUsingShadow(nullptr, HasTypenameKeyword) { |
| 3383 | } |
| 3384 | |
| 3385 | void anchor() override; |
| 3386 | |
| 3387 | public: |
| 3388 | friend class ASTDeclReader; |
| 3389 | friend class ASTDeclWriter; |
| 3390 | |
| 3391 | |
| 3392 | SourceLocation getUsingLoc() const { return UsingLocation; } |
| 3393 | |
| 3394 | |
| 3395 | void setUsingLoc(SourceLocation L) { UsingLocation = L; } |
| 3396 | |
| 3397 | |
| 3398 | |
| 3399 | NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; } |
| 3400 | |
| 3401 | |
| 3402 | NestedNameSpecifier *getQualifier() const { |
| 3403 | return QualifierLoc.getNestedNameSpecifier(); |
| 3404 | } |
| 3405 | |
| 3406 | DeclarationNameInfo getNameInfo() const { |
| 3407 | return DeclarationNameInfo(getDeclName(), getLocation(), DNLoc); |
| 3408 | } |
| 3409 | |
| 3410 | |
| 3411 | bool isAccessDeclaration() const { return UsingLocation.isInvalid(); } |
| 3412 | |
| 3413 | |
| 3414 | bool hasTypename() const { return FirstUsingShadow.getInt(); } |
| 3415 | |
| 3416 | |
| 3417 | void setTypename(bool TN) { FirstUsingShadow.setInt(TN); } |
| 3418 | |
| 3419 | |
| 3420 | |
| 3421 | class shadow_iterator { |
| 3422 | |
| 3423 | UsingShadowDecl *Current = nullptr; |
| 3424 | |
| 3425 | public: |
| 3426 | using value_type = UsingShadowDecl *; |
| 3427 | using reference = UsingShadowDecl *; |
| 3428 | using pointer = UsingShadowDecl *; |
| 3429 | using iterator_category = std::forward_iterator_tag; |
| 3430 | using difference_type = std::ptrdiff_t; |
| 3431 | |
| 3432 | shadow_iterator() = default; |
| 3433 | explicit shadow_iterator(UsingShadowDecl *C) : Current(C) {} |
| 3434 | |
| 3435 | reference operator*() const { return Current; } |
| 3436 | pointer operator->() const { return Current; } |
| 3437 | |
| 3438 | shadow_iterator& operator++() { |
| 3439 | Current = Current->getNextUsingShadowDecl(); |
| 3440 | return *this; |
| 3441 | } |
| 3442 | |
| 3443 | shadow_iterator operator++(int) { |
| 3444 | shadow_iterator tmp(*this); |
| 3445 | ++(*this); |
| 3446 | return tmp; |
| 3447 | } |
| 3448 | |
| 3449 | friend bool operator==(shadow_iterator x, shadow_iterator y) { |
| 3450 | return x.Current == y.Current; |
| 3451 | } |
| 3452 | friend bool operator!=(shadow_iterator x, shadow_iterator y) { |
| 3453 | return x.Current != y.Current; |
| 3454 | } |
| 3455 | }; |
| 3456 | |
| 3457 | using shadow_range = llvm::iterator_range<shadow_iterator>; |
| 3458 | |
| 3459 | shadow_range shadows() const { |
| 3460 | return shadow_range(shadow_begin(), shadow_end()); |
| 3461 | } |
| 3462 | |
| 3463 | shadow_iterator shadow_begin() const { |
| 3464 | return shadow_iterator(FirstUsingShadow.getPointer()); |
| 3465 | } |
| 3466 | |
| 3467 | shadow_iterator shadow_end() const { return shadow_iterator(); } |
| 3468 | |
| 3469 | |
| 3470 | |
| 3471 | unsigned shadow_size() const { |
| 3472 | return std::distance(shadow_begin(), shadow_end()); |
| 3473 | } |
| 3474 | |
| 3475 | void addShadowDecl(UsingShadowDecl *S); |
| 3476 | void removeShadowDecl(UsingShadowDecl *S); |
| 3477 | |
| 3478 | static UsingDecl *Create(ASTContext &C, DeclContext *DC, |
| 3479 | SourceLocation UsingL, |
| 3480 | NestedNameSpecifierLoc QualifierLoc, |
| 3481 | const DeclarationNameInfo &NameInfo, |
| 3482 | bool HasTypenameKeyword); |
| 3483 | |
| 3484 | static UsingDecl *CreateDeserialized(ASTContext &C, unsigned ID); |
| 3485 | |
| 3486 | SourceRange getSourceRange() const override LLVM_READONLY; |
| 3487 | |
| 3488 | |
| 3489 | UsingDecl *getCanonicalDecl() override { return getFirstDecl(); } |
| 3490 | const UsingDecl *getCanonicalDecl() const { return getFirstDecl(); } |
| 3491 | |
| 3492 | static bool classof(const Decl *D) { return classofKind(D->getKind()); } |
| 3493 | static bool classofKind(Kind K) { return K == Using; } |
| 3494 | }; |
| 3495 | |
| 3496 | |
| 3497 | |
| 3498 | |
| 3499 | |
| 3500 | |
| 3501 | |
| 3502 | |
| 3503 | |
| 3504 | |
| 3505 | |
| 3506 | |
| 3507 | |
| 3508 | |
| 3509 | class UsingPackDecl final |
| 3510 | : public NamedDecl, public Mergeable<UsingPackDecl>, |
| 3511 | private llvm::TrailingObjects<UsingPackDecl, NamedDecl *> { |
| 3512 | |
| 3513 | |
| 3514 | NamedDecl *InstantiatedFrom; |
| 3515 | |
| 3516 | |
| 3517 | unsigned NumExpansions; |
| 3518 | |
| 3519 | UsingPackDecl(DeclContext *DC, NamedDecl *InstantiatedFrom, |
| 3520 | ArrayRef<NamedDecl *> UsingDecls) |
| 3521 | : NamedDecl(UsingPack, DC, |
| 3522 | InstantiatedFrom ? InstantiatedFrom->getLocation() |
| 3523 | : SourceLocation(), |
| 3524 | InstantiatedFrom ? InstantiatedFrom->getDeclName() |
| 3525 | : DeclarationName()), |
| 3526 | InstantiatedFrom(InstantiatedFrom), NumExpansions(UsingDecls.size()) { |
| 3527 | std::uninitialized_copy(UsingDecls.begin(), UsingDecls.end(), |
| 3528 | getTrailingObjects<NamedDecl *>()); |
| 3529 | } |
| 3530 | |
| 3531 | void anchor() override; |
| 3532 | |
| 3533 | public: |
| 3534 | friend class ASTDeclReader; |
| 3535 | friend class ASTDeclWriter; |
| 3536 | friend TrailingObjects; |
| 3537 | |
| 3538 | |
| 3539 | |
| 3540 | |
| 3541 | NamedDecl *getInstantiatedFromUsingDecl() const { return InstantiatedFrom; } |
| 3542 | |
| 3543 | |
| 3544 | |
| 3545 | ArrayRef<NamedDecl *> expansions() const { |
| 3546 | return llvm::makeArrayRef(getTrailingObjects<NamedDecl *>(), NumExpansions); |
| 3547 | } |
| 3548 | |
| 3549 | static UsingPackDecl *Create(ASTContext &C, DeclContext *DC, |
| 3550 | NamedDecl *InstantiatedFrom, |
| 3551 | ArrayRef<NamedDecl *> UsingDecls); |
| 3552 | |
| 3553 | static UsingPackDecl *CreateDeserialized(ASTContext &C, unsigned ID, |
| 3554 | unsigned NumExpansions); |
| 3555 | |
| 3556 | SourceRange getSourceRange() const override LLVM_READONLY { |
| 3557 | return InstantiatedFrom->getSourceRange(); |
| 3558 | } |
| 3559 | |
| 3560 | UsingPackDecl *getCanonicalDecl() override { return getFirstDecl(); } |
| 3561 | const UsingPackDecl *getCanonicalDecl() const { return getFirstDecl(); } |
| 3562 | |
| 3563 | static bool classof(const Decl *D) { return classofKind(D->getKind()); } |
| 3564 | static bool classofKind(Kind K) { return K == UsingPack; } |
| 3565 | }; |
| 3566 | |
| 3567 | |
| 3568 | |
| 3569 | |
| 3570 | |
| 3571 | |
| 3572 | |
| 3573 | |
| 3574 | |
| 3575 | |
| 3576 | |
| 3577 | |
| 3578 | class UnresolvedUsingValueDecl : public ValueDecl, |
| 3579 | public Mergeable<UnresolvedUsingValueDecl> { |
| 3580 | |
| 3581 | SourceLocation UsingLocation; |
| 3582 | |
| 3583 | |
| 3584 | SourceLocation EllipsisLoc; |
| 3585 | |
| 3586 | |
| 3587 | NestedNameSpecifierLoc QualifierLoc; |
| 3588 | |
| 3589 | |
| 3590 | |
| 3591 | DeclarationNameLoc DNLoc; |
| 3592 | |
| 3593 | UnresolvedUsingValueDecl(DeclContext *DC, QualType Ty, |
| 3594 | SourceLocation UsingLoc, |
| 3595 | NestedNameSpecifierLoc QualifierLoc, |
| 3596 | const DeclarationNameInfo &NameInfo, |
| 3597 | SourceLocation EllipsisLoc) |
| 3598 | : ValueDecl(UnresolvedUsingValue, DC, |
| 3599 | NameInfo.getLoc(), NameInfo.getName(), Ty), |
| 3600 | UsingLocation(UsingLoc), EllipsisLoc(EllipsisLoc), |
| 3601 | QualifierLoc(QualifierLoc), DNLoc(NameInfo.getInfo()) {} |
| 3602 | |
| 3603 | void anchor() override; |
| 3604 | |
| 3605 | public: |
| 3606 | friend class ASTDeclReader; |
| 3607 | friend class ASTDeclWriter; |
| 3608 | |
| 3609 | |
| 3610 | SourceLocation getUsingLoc() const { return UsingLocation; } |
| 3611 | |
| 3612 | |
| 3613 | void setUsingLoc(SourceLocation L) { UsingLocation = L; } |
| 3614 | |
| 3615 | |
| 3616 | bool isAccessDeclaration() const { return UsingLocation.isInvalid(); } |
| 3617 | |
| 3618 | |
| 3619 | |
| 3620 | NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; } |
| 3621 | |
| 3622 | |
| 3623 | NestedNameSpecifier *getQualifier() const { |
| 3624 | return QualifierLoc.getNestedNameSpecifier(); |
| 3625 | } |
| 3626 | |
| 3627 | DeclarationNameInfo getNameInfo() const { |
| 3628 | return DeclarationNameInfo(getDeclName(), getLocation(), DNLoc); |
| 3629 | } |
| 3630 | |
| 3631 | |
| 3632 | bool isPackExpansion() const { |
| 3633 | return EllipsisLoc.isValid(); |
| 3634 | } |
| 3635 | |
| 3636 | |
| 3637 | SourceLocation getEllipsisLoc() const { |
| 3638 | return EllipsisLoc; |
| 3639 | } |
| 3640 | |
| 3641 | static UnresolvedUsingValueDecl * |
| 3642 | Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, |
| 3643 | NestedNameSpecifierLoc QualifierLoc, |
| 3644 | const DeclarationNameInfo &NameInfo, SourceLocation EllipsisLoc); |
| 3645 | |
| 3646 | static UnresolvedUsingValueDecl * |
| 3647 | CreateDeserialized(ASTContext &C, unsigned ID); |
| 3648 | |
| 3649 | SourceRange getSourceRange() const override LLVM_READONLY; |
| 3650 | |
| 3651 | |
| 3652 | UnresolvedUsingValueDecl *getCanonicalDecl() override { |
| 3653 | return getFirstDecl(); |
| 3654 | } |
| 3655 | const UnresolvedUsingValueDecl *getCanonicalDecl() const { |
| 3656 | return getFirstDecl(); |
| 3657 | } |
| 3658 | |
| 3659 | static bool classof(const Decl *D) { return classofKind(D->getKind()); } |
| 3660 | static bool classofKind(Kind K) { return K == UnresolvedUsingValue; } |
| 3661 | }; |
| 3662 | |
| 3663 | |
| 3664 | |
| 3665 | |
| 3666 | |
| 3667 | |
| 3668 | |
| 3669 | |
| 3670 | |
| 3671 | |
| 3672 | |
| 3673 | |
| 3674 | class UnresolvedUsingTypenameDecl |
| 3675 | : public TypeDecl, |
| 3676 | public Mergeable<UnresolvedUsingTypenameDecl> { |
| 3677 | friend class ASTDeclReader; |
| 3678 | |
| 3679 | |
| 3680 | SourceLocation TypenameLocation; |
| 3681 | |
| 3682 | |
| 3683 | SourceLocation EllipsisLoc; |
| 3684 | |
| 3685 | |
| 3686 | NestedNameSpecifierLoc QualifierLoc; |
| 3687 | |
| 3688 | UnresolvedUsingTypenameDecl(DeclContext *DC, SourceLocation UsingLoc, |
| 3689 | SourceLocation TypenameLoc, |
| 3690 | NestedNameSpecifierLoc QualifierLoc, |
| 3691 | SourceLocation TargetNameLoc, |
| 3692 | IdentifierInfo *TargetName, |
| 3693 | SourceLocation EllipsisLoc) |
| 3694 | : TypeDecl(UnresolvedUsingTypename, DC, TargetNameLoc, TargetName, |
| 3695 | UsingLoc), |
| 3696 | TypenameLocation(TypenameLoc), EllipsisLoc(EllipsisLoc), |
| 3697 | QualifierLoc(QualifierLoc) {} |
| 3698 | |
| 3699 | void anchor() override; |
| 3700 | |
| 3701 | public: |
| 3702 | |
| 3703 | SourceLocation getUsingLoc() const { return getBeginLoc(); } |
| 3704 | |
| 3705 | |
| 3706 | SourceLocation getTypenameLoc() const { return TypenameLocation; } |
| 3707 | |
| 3708 | |
| 3709 | |
| 3710 | NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; } |
| 3711 | |
| 3712 | |
| 3713 | NestedNameSpecifier *getQualifier() const { |
| 3714 | return QualifierLoc.getNestedNameSpecifier(); |
| 3715 | } |
| 3716 | |
| 3717 | DeclarationNameInfo getNameInfo() const { |
| 3718 | return DeclarationNameInfo(getDeclName(), getLocation()); |
| 3719 | } |
| 3720 | |
| 3721 | |
| 3722 | bool isPackExpansion() const { |
| 3723 | return EllipsisLoc.isValid(); |
| 3724 | } |
| 3725 | |
| 3726 | |
| 3727 | SourceLocation getEllipsisLoc() const { |
| 3728 | return EllipsisLoc; |
| 3729 | } |
| 3730 | |
| 3731 | static UnresolvedUsingTypenameDecl * |
| 3732 | Create(ASTContext &C, DeclContext *DC, SourceLocation UsingLoc, |
| 3733 | SourceLocation TypenameLoc, NestedNameSpecifierLoc QualifierLoc, |
| 3734 | SourceLocation TargetNameLoc, DeclarationName TargetName, |
| 3735 | SourceLocation EllipsisLoc); |
| 3736 | |
| 3737 | static UnresolvedUsingTypenameDecl * |
| 3738 | CreateDeserialized(ASTContext &C, unsigned ID); |
| 3739 | |
| 3740 | |
| 3741 | UnresolvedUsingTypenameDecl *getCanonicalDecl() override { |
| 3742 | return getFirstDecl(); |
| 3743 | } |
| 3744 | const UnresolvedUsingTypenameDecl *getCanonicalDecl() const { |
| 3745 | return getFirstDecl(); |
| 3746 | } |
| 3747 | |
| 3748 | static bool classof(const Decl *D) { return classofKind(D->getKind()); } |
| 3749 | static bool classofKind(Kind K) { return K == UnresolvedUsingTypename; } |
| 3750 | }; |
| 3751 | |
| 3752 | |
| 3753 | class StaticAssertDecl : public Decl { |
| 3754 | llvm::PointerIntPair<Expr *, 1, bool> AssertExprAndFailed; |
| 3755 | StringLiteral *Message; |
| 3756 | SourceLocation RParenLoc; |
| 3757 | |
| 3758 | StaticAssertDecl(DeclContext *DC, SourceLocation StaticAssertLoc, |
| 3759 | Expr *AssertExpr, StringLiteral *Message, |
| 3760 | SourceLocation RParenLoc, bool Failed) |
| 3761 | : Decl(StaticAssert, DC, StaticAssertLoc), |
| 3762 | AssertExprAndFailed(AssertExpr, Failed), Message(Message), |
| 3763 | RParenLoc(RParenLoc) {} |
| 3764 | |
| 3765 | virtual void anchor(); |
| 3766 | |
| 3767 | public: |
| 3768 | friend class ASTDeclReader; |
| 3769 | |
| 3770 | static StaticAssertDecl *Create(ASTContext &C, DeclContext *DC, |
| 3771 | SourceLocation StaticAssertLoc, |
| 3772 | Expr *AssertExpr, StringLiteral *Message, |
| 3773 | SourceLocation RParenLoc, bool Failed); |
| 3774 | static StaticAssertDecl *CreateDeserialized(ASTContext &C, unsigned ID); |
| 3775 | |
| 3776 | Expr *getAssertExpr() { return AssertExprAndFailed.getPointer(); } |
| 3777 | const Expr *getAssertExpr() const { return AssertExprAndFailed.getPointer(); } |
| 3778 | |
| 3779 | StringLiteral *getMessage() { return Message; } |
| 3780 | const StringLiteral *getMessage() const { return Message; } |
| 3781 | |
| 3782 | bool isFailed() const { return AssertExprAndFailed.getInt(); } |
| 3783 | |
| 3784 | SourceLocation getRParenLoc() const { return RParenLoc; } |
| 3785 | |
| 3786 | SourceRange getSourceRange() const override LLVM_READONLY { |
| 3787 | return SourceRange(getLocation(), getRParenLoc()); |
| 3788 | } |
| 3789 | |
| 3790 | static bool classof(const Decl *D) { return classofKind(D->getKind()); } |
| 3791 | static bool classofKind(Kind K) { return K == StaticAssert; } |
| 3792 | }; |
| 3793 | |
| 3794 | |
| 3795 | |
| 3796 | |
| 3797 | |
| 3798 | |
| 3799 | |
| 3800 | |
| 3801 | |
| 3802 | class BindingDecl : public ValueDecl { |
| 3803 | |
| 3804 | |
| 3805 | |
| 3806 | |
| 3807 | Expr *Binding = nullptr; |
| 3808 | |
| 3809 | BindingDecl(DeclContext *DC, SourceLocation IdLoc, IdentifierInfo *Id) |
| 3810 | : ValueDecl(Decl::Binding, DC, IdLoc, Id, QualType()) {} |
| 3811 | |
| 3812 | void anchor() override; |
| 3813 | |
| 3814 | public: |
| 3815 | friend class ASTDeclReader; |
| 3816 | |
| 3817 | static BindingDecl *Create(ASTContext &C, DeclContext *DC, |
| 3818 | SourceLocation IdLoc, IdentifierInfo *Id); |
| 3819 | static BindingDecl *CreateDeserialized(ASTContext &C, unsigned ID); |
| 3820 | |
| 3821 | |
| 3822 | |
| 3823 | |
| 3824 | Expr *getBinding() const { return Binding; } |
| 3825 | |
| 3826 | |
| 3827 | |
| 3828 | VarDecl *getHoldingVar() const; |
| 3829 | |
| 3830 | |
| 3831 | |
| 3832 | |
| 3833 | void setBinding(QualType DeclaredType, Expr *Binding) { |
| 3834 | setType(DeclaredType); |
| 3835 | this->Binding = Binding; |
| 3836 | } |
| 3837 | |
| 3838 | static bool classof(const Decl *D) { return classofKind(D->getKind()); } |
| 3839 | static bool classofKind(Kind K) { return K == Decl::Binding; } |
| 3840 | }; |
| 3841 | |
| 3842 | |
| 3843 | |
| 3844 | |
| 3845 | |
| 3846 | |
| 3847 | |
| 3848 | |
| 3849 | |
| 3850 | class DecompositionDecl final |
| 3851 | : public VarDecl, |
| 3852 | private llvm::TrailingObjects<DecompositionDecl, BindingDecl *> { |
| 3853 | |
| 3854 | unsigned NumBindings; |
| 3855 | |
| 3856 | DecompositionDecl(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, |
| 3857 | SourceLocation LSquareLoc, QualType T, |
| 3858 | TypeSourceInfo *TInfo, StorageClass SC, |
| 3859 | ArrayRef<BindingDecl *> Bindings) |
| 3860 | : VarDecl(Decomposition, C, DC, StartLoc, LSquareLoc, nullptr, T, TInfo, |
| 3861 | SC), |
| 3862 | NumBindings(Bindings.size()) { |
| 3863 | std::uninitialized_copy(Bindings.begin(), Bindings.end(), |
| 3864 | getTrailingObjects<BindingDecl *>()); |
| 3865 | } |
| 3866 | |
| 3867 | void anchor() override; |
| 3868 | |
| 3869 | public: |
| 3870 | friend class ASTDeclReader; |
| 3871 | friend TrailingObjects; |
| 3872 | |
| 3873 | static DecompositionDecl *Create(ASTContext &C, DeclContext *DC, |
| 3874 | SourceLocation StartLoc, |
| 3875 | SourceLocation LSquareLoc, |
| 3876 | QualType T, TypeSourceInfo *TInfo, |
| 3877 | StorageClass S, |
| 3878 | ArrayRef<BindingDecl *> Bindings); |
| 3879 | static DecompositionDecl *CreateDeserialized(ASTContext &C, unsigned ID, |
| 3880 | unsigned NumBindings); |
| 3881 | |
| 3882 | ArrayRef<BindingDecl *> bindings() const { |
| 3883 | return llvm::makeArrayRef(getTrailingObjects<BindingDecl *>(), NumBindings); |
| 3884 | } |
| 3885 | |
| 3886 | void printName(raw_ostream &os) const override; |
| 3887 | |
| 3888 | static bool classof(const Decl *D) { return classofKind(D->getKind()); } |
| 3889 | static bool classofKind(Kind K) { return K == Decomposition; } |
| 3890 | }; |
| 3891 | |
| 3892 | |
| 3893 | |
| 3894 | |
| 3895 | |
| 3896 | |
| 3897 | |
| 3898 | |
| 3899 | |
| 3900 | |
| 3901 | |
| 3902 | |
| 3903 | |
| 3904 | |
| 3905 | |
| 3906 | |
| 3907 | |
| 3908 | |
| 3909 | |
| 3910 | |
| 3911 | |
| 3912 | |
| 3913 | |
| 3914 | |
| 3915 | |
| 3916 | |
| 3917 | |
| 3918 | |
| 3919 | class MSPropertyDecl : public DeclaratorDecl { |
| 3920 | IdentifierInfo *GetterId, *SetterId; |
| 3921 | |
| 3922 | MSPropertyDecl(DeclContext *DC, SourceLocation L, DeclarationName N, |
| 3923 | QualType T, TypeSourceInfo *TInfo, SourceLocation StartL, |
| 3924 | IdentifierInfo *Getter, IdentifierInfo *Setter) |
| 3925 | : DeclaratorDecl(MSProperty, DC, L, N, T, TInfo, StartL), |
| 3926 | GetterId(Getter), SetterId(Setter) {} |
| 3927 | |
| 3928 | void anchor() override; |
| 3929 | public: |
| 3930 | friend class ASTDeclReader; |
| 3931 | |
| 3932 | static MSPropertyDecl *Create(ASTContext &C, DeclContext *DC, |
| 3933 | SourceLocation L, DeclarationName N, QualType T, |
| 3934 | TypeSourceInfo *TInfo, SourceLocation StartL, |
| 3935 | IdentifierInfo *Getter, IdentifierInfo *Setter); |
| 3936 | static MSPropertyDecl *CreateDeserialized(ASTContext &C, unsigned ID); |
| 3937 | |
| 3938 | static bool classof(const Decl *D) { return D->getKind() == MSProperty; } |
| 3939 | |
| 3940 | bool hasGetter() const { return GetterId != nullptr; } |
| 3941 | IdentifierInfo* getGetterId() const { return GetterId; } |
| 3942 | bool hasSetter() const { return SetterId != nullptr; } |
| 3943 | IdentifierInfo* getSetterId() const { return SetterId; } |
| 3944 | }; |
| 3945 | |
| 3946 | |
| 3947 | |
| 3948 | const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, |
| 3949 | AccessSpecifier AS); |
| 3950 | |
| 3951 | const PartialDiagnostic &operator<<(const PartialDiagnostic &DB, |
| 3952 | AccessSpecifier AS); |
| 3953 | |
| 3954 | } |
| 3955 | |
| 3956 | #endif |
| 3957 | |