| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | #include "clang/AST/DeclFriend.h" |
| 15 | #include "clang/AST/Decl.h" |
| 16 | #include "clang/AST/DeclBase.h" |
| 17 | #include "clang/AST/DeclCXX.h" |
| 18 | #include "clang/AST/ASTContext.h" |
| 19 | #include "clang/AST/DeclTemplate.h" |
| 20 | #include "clang/Basic/LLVM.h" |
| 21 | #include "llvm/Support/Casting.h" |
| 22 | #include <cassert> |
| 23 | #include <cstddef> |
| 24 | |
| 25 | using namespace clang; |
| 26 | |
| 27 | void FriendDecl::anchor() {} |
| 28 | |
| 29 | FriendDecl *FriendDecl::getNextFriendSlowCase() { |
| 30 | return cast_or_null<FriendDecl>( |
| 31 | NextFriend.get(getASTContext().getExternalSource())); |
| 32 | } |
| 33 | |
| 34 | FriendDecl *FriendDecl::Create(ASTContext &C, DeclContext *DC, |
| 35 | SourceLocation L, |
| 36 | FriendUnion Friend, |
| 37 | SourceLocation FriendL, |
| 38 | ArrayRef<TemplateParameterList *> FriendTypeTPLists) { |
| 39 | #ifndef NDEBUG |
| 40 | if (Friend.is<NamedDecl *>()) { |
| 41 | const auto *D = Friend.get<NamedDecl*>(); |
| 42 | (D) || isa(D) || isa(D) || isa(D)", "/home/seafit/code_projects/clang_source/clang/lib/AST/DeclFriend.cpp", 45, __PRETTY_FUNCTION__))" file_link="../../../include/assert.h.html#88" macro="true">assert(isa<FunctionDecl>(D) || |
| 43 | (D) || isa(D) || isa(D) || isa(D)", "/home/seafit/code_projects/clang_source/clang/lib/AST/DeclFriend.cpp", 45, __PRETTY_FUNCTION__))" file_link="../../../include/assert.h.html#88" macro="true"> isa<CXXRecordDecl>(D) || |
| 44 | (D) || isa(D) || isa(D) || isa(D)", "/home/seafit/code_projects/clang_source/clang/lib/AST/DeclFriend.cpp", 45, __PRETTY_FUNCTION__))" file_link="../../../include/assert.h.html#88" macro="true"> isa<FunctionTemplateDecl>(D) || |
| 45 | (D) || isa(D) || isa(D) || isa(D)", "/home/seafit/code_projects/clang_source/clang/lib/AST/DeclFriend.cpp", 45, __PRETTY_FUNCTION__))" file_link="../../../include/assert.h.html#88" macro="true"> isa<ClassTemplateDecl>(D)); |
| 46 | |
| 47 | |
| 48 | |
| 49 | getFriendObjectKind() || (cast(DC)->getTemplateSpecializationKind())", "/home/seafit/code_projects/clang_source/clang/lib/AST/DeclFriend.cpp", 50, __PRETTY_FUNCTION__))" file_link="../../../include/assert.h.html#88" macro="true">assert(D->getFriendObjectKind() || |
| 50 | getFriendObjectKind() || (cast(DC)->getTemplateSpecializationKind())", "/home/seafit/code_projects/clang_source/clang/lib/AST/DeclFriend.cpp", 50, __PRETTY_FUNCTION__))" file_link="../../../include/assert.h.html#88" macro="true"> (cast<CXXRecordDecl>(DC)->getTemplateSpecializationKind())); |
| 51 | |
| 52 | assert(FriendTypeTPLists.empty()); |
| 53 | } |
| 54 | #endif |
| 55 | |
| 56 | std::size_t = |
| 57 | FriendDecl::additionalSizeToAlloc<TemplateParameterList *>( |
| 58 | FriendTypeTPLists.size()); |
| 59 | auto *FD = new (C, DC, Extra) FriendDecl(DC, L, Friend, FriendL, |
| 60 | FriendTypeTPLists); |
| 61 | cast<CXXRecordDecl>(DC)->pushFriendDecl(FD); |
| 62 | return FD; |
| 63 | } |
| 64 | |
| 65 | FriendDecl *FriendDecl::CreateDeserialized(ASTContext &C, unsigned ID, |
| 66 | unsigned FriendTypeNumTPLists) { |
| 67 | std::size_t = |
| 68 | additionalSizeToAlloc<TemplateParameterList *>(FriendTypeNumTPLists); |
| 69 | return new (C, ID, Extra) FriendDecl(EmptyShell(), FriendTypeNumTPLists); |
| 70 | } |
| 71 | |
| 72 | FriendDecl *CXXRecordDecl::getFirstFriend() const { |
| 73 | ExternalASTSource *Source = getParentASTContext().getExternalSource(); |
| 74 | Decl *First = data().FirstFriend.get(Source); |
| 75 | return First ? cast<FriendDecl>(First) : nullptr; |
| 76 | } |
| 77 | |