192b7f70c924cbf4514e9e434cea7def51ab49860John McCall//===-- DeclFriend.h - Classes for C++ friend declarations -*- C++ -*------===// 292b7f70c924cbf4514e9e434cea7def51ab49860John McCall// 392b7f70c924cbf4514e9e434cea7def51ab49860John McCall// The LLVM Compiler Infrastructure 492b7f70c924cbf4514e9e434cea7def51ab49860John McCall// 592b7f70c924cbf4514e9e434cea7def51ab49860John McCall// This file is distributed under the University of Illinois Open Source 692b7f70c924cbf4514e9e434cea7def51ab49860John McCall// License. See LICENSE.TXT for details. 792b7f70c924cbf4514e9e434cea7def51ab49860John McCall// 892b7f70c924cbf4514e9e434cea7def51ab49860John McCall//===----------------------------------------------------------------------===// 992b7f70c924cbf4514e9e434cea7def51ab49860John McCall// 1092b7f70c924cbf4514e9e434cea7def51ab49860John McCall// This file defines the section of the AST representing C++ friend 1192b7f70c924cbf4514e9e434cea7def51ab49860John McCall// declarations. 1292b7f70c924cbf4514e9e434cea7def51ab49860John McCall// 1392b7f70c924cbf4514e9e434cea7def51ab49860John McCall//===----------------------------------------------------------------------===// 1492b7f70c924cbf4514e9e434cea7def51ab49860John McCall 1592b7f70c924cbf4514e9e434cea7def51ab49860John McCall#ifndef LLVM_CLANG_AST_DECLFRIEND_H 1692b7f70c924cbf4514e9e434cea7def51ab49860John McCall#define LLVM_CLANG_AST_DECLFRIEND_H 1792b7f70c924cbf4514e9e434cea7def51ab49860John McCall 1892b7f70c924cbf4514e9e434cea7def51ab49860John McCall#include "clang/AST/DeclCXX.h" 1903a400510fb8ba2e88e27c95ec797d944d944c4bAbramo Bagnara#include "clang/AST/DeclTemplate.h" 206bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines#include "clang/AST/TypeLoc.h" 21aa49a7d70e58dac2aeb40664ba16d2ea571b8c95Daniel Dunbar#include "llvm/Support/Compiler.h" 2292b7f70c924cbf4514e9e434cea7def51ab49860John McCall 2392b7f70c924cbf4514e9e434cea7def51ab49860John McCallnamespace clang { 2492b7f70c924cbf4514e9e434cea7def51ab49860John McCall 2592b7f70c924cbf4514e9e434cea7def51ab49860John McCall/// FriendDecl - Represents the declaration of a friend entity, 2692b7f70c924cbf4514e9e434cea7def51ab49860John McCall/// which can be a function, a type, or a templated function or type. 2792b7f70c924cbf4514e9e434cea7def51ab49860John McCall// For example: 2892b7f70c924cbf4514e9e434cea7def51ab49860John McCall/// 2992b7f70c924cbf4514e9e434cea7def51ab49860John McCall/// @code 3092b7f70c924cbf4514e9e434cea7def51ab49860John McCall/// template <typename T> class A { 3192b7f70c924cbf4514e9e434cea7def51ab49860John McCall/// friend int foo(T); 3292b7f70c924cbf4514e9e434cea7def51ab49860John McCall/// friend class B; 3392b7f70c924cbf4514e9e434cea7def51ab49860John McCall/// friend T; // only in C++0x 3492b7f70c924cbf4514e9e434cea7def51ab49860John McCall/// template <typename U> friend class C; 3592b7f70c924cbf4514e9e434cea7def51ab49860John McCall/// template <typename U> friend A& operator+=(A&, const U&) { ... } 3692b7f70c924cbf4514e9e434cea7def51ab49860John McCall/// }; 3792b7f70c924cbf4514e9e434cea7def51ab49860John McCall/// @endcode 3892b7f70c924cbf4514e9e434cea7def51ab49860John McCall/// 3992b7f70c924cbf4514e9e434cea7def51ab49860John McCall/// The semantic context of a friend decl is its declaring class. 404967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainarclass FriendDecl final 414967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar : public Decl, 424967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar private llvm::TrailingObjects<FriendDecl, TemplateParameterList *> { 4399ba9e3bd70671f3441fb974895f226a83ce0e66David Blaikie virtual void anchor(); 4492b7f70c924cbf4514e9e434cea7def51ab49860John McCallpublic: 4532f2fb53d9d7c28c94d8569fd0fcf06cccee0c3dJohn McCall typedef llvm::PointerUnion<NamedDecl*,TypeSourceInfo*> FriendUnion; 4692b7f70c924cbf4514e9e434cea7def51ab49860John McCall 4792b7f70c924cbf4514e9e434cea7def51ab49860John McCallprivate: 4892b7f70c924cbf4514e9e434cea7def51ab49860John McCall // The declaration that's a friend of this class. 4992b7f70c924cbf4514e9e434cea7def51ab49860John McCall FriendUnion Friend; 5092b7f70c924cbf4514e9e434cea7def51ab49860John McCall 51d60e22e601852ae1345f01514318a0951dc09f89John McCall // A pointer to the next friend in the sequence. 5269aecc6252bf4a5ee59f9b51c3728ea07b6342bfDouglas Gregor LazyDeclPtr NextFriend; 53d60e22e601852ae1345f01514318a0951dc09f89John McCall 5492b7f70c924cbf4514e9e434cea7def51ab49860John McCall // Location of the 'friend' specifier. 5592b7f70c924cbf4514e9e434cea7def51ab49860John McCall SourceLocation FriendLoc; 5692b7f70c924cbf4514e9e434cea7def51ab49860John McCall 576102ca1d490836096678d7d934f0b2b78f9293ecJohn McCall /// True if this 'friend' declaration is unsupported. Eventually we 586102ca1d490836096678d7d934f0b2b78f9293ecJohn McCall /// will support every possible friend declaration, but for now we 596102ca1d490836096678d7d934f0b2b78f9293ecJohn McCall /// silently ignore some and set this flag to authorize all access. 604967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar unsigned UnsupportedFriend : 1; 618c84028ed9aa0dfd54ab729dee78f29c961d7f37Enea Zaffanella 628c84028ed9aa0dfd54ab729dee78f29c961d7f37Enea Zaffanella // The number of "outer" template parameter lists in non-templatic 638c84028ed9aa0dfd54ab729dee78f29c961d7f37Enea Zaffanella // (currently unsupported) friend type declarations, such as 648c84028ed9aa0dfd54ab729dee78f29c961d7f37Enea Zaffanella // template <class T> friend class A<T>::B; 658c84028ed9aa0dfd54ab729dee78f29c961d7f37Enea Zaffanella unsigned NumTPLists : 31; 668c84028ed9aa0dfd54ab729dee78f29c961d7f37Enea Zaffanella 67d60e22e601852ae1345f01514318a0951dc09f89John McCall friend class CXXRecordDecl::friend_iterator; 68d60e22e601852ae1345f01514318a0951dc09f89John McCall friend class CXXRecordDecl; 69d60e22e601852ae1345f01514318a0951dc09f89John McCall 7092b7f70c924cbf4514e9e434cea7def51ab49860John McCall FriendDecl(DeclContext *DC, SourceLocation L, FriendUnion Friend, 718c84028ed9aa0dfd54ab729dee78f29c961d7f37Enea Zaffanella SourceLocation FriendL, 728c84028ed9aa0dfd54ab729dee78f29c961d7f37Enea Zaffanella ArrayRef<TemplateParameterList*> FriendTypeTPLists) 7392b7f70c924cbf4514e9e434cea7def51ab49860John McCall : Decl(Decl::Friend, DC, L), 7492b7f70c924cbf4514e9e434cea7def51ab49860John McCall Friend(Friend), 7569aecc6252bf4a5ee59f9b51c3728ea07b6342bfDouglas Gregor NextFriend(), 766102ca1d490836096678d7d934f0b2b78f9293ecJohn McCall FriendLoc(FriendL), 778c84028ed9aa0dfd54ab729dee78f29c961d7f37Enea Zaffanella UnsupportedFriend(false), 788c84028ed9aa0dfd54ab729dee78f29c961d7f37Enea Zaffanella NumTPLists(FriendTypeTPLists.size()) { 798c84028ed9aa0dfd54ab729dee78f29c961d7f37Enea Zaffanella for (unsigned i = 0; i < NumTPLists; ++i) 804967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar getTrailingObjects<TemplateParameterList *>()[i] = FriendTypeTPLists[i]; 8192b7f70c924cbf4514e9e434cea7def51ab49860John McCall } 8292b7f70c924cbf4514e9e434cea7def51ab49860John McCall 838c84028ed9aa0dfd54ab729dee78f29c961d7f37Enea Zaffanella FriendDecl(EmptyShell Empty, unsigned NumFriendTypeTPLists) 848c84028ed9aa0dfd54ab729dee78f29c961d7f37Enea Zaffanella : Decl(Decl::Friend, Empty), NextFriend(), 858c84028ed9aa0dfd54ab729dee78f29c961d7f37Enea Zaffanella NumTPLists(NumFriendTypeTPLists) { } 866764334dfa73d67cbbb1b1fc8fe00440aad00f2aArgyrios Kyrtzidis 8769aecc6252bf4a5ee59f9b51c3728ea07b6342bfDouglas Gregor FriendDecl *getNextFriend() { 88471c8b49982d1132f30b0b0da27fef94fd6e4f67Benjamin Kramer if (!NextFriend.isOffset()) 896bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines return cast_or_null<FriendDecl>(NextFriend.get(nullptr)); 90471c8b49982d1132f30b0b0da27fef94fd6e4f67Benjamin Kramer return getNextFriendSlowCase(); 9169aecc6252bf4a5ee59f9b51c3728ea07b6342bfDouglas Gregor } 92471c8b49982d1132f30b0b0da27fef94fd6e4f67Benjamin Kramer FriendDecl *getNextFriendSlowCase(); 93471c8b49982d1132f30b0b0da27fef94fd6e4f67Benjamin Kramer 9492b7f70c924cbf4514e9e434cea7def51ab49860John McCallpublic: 9592b7f70c924cbf4514e9e434cea7def51ab49860John McCall static FriendDecl *Create(ASTContext &C, DeclContext *DC, 9692b7f70c924cbf4514e9e434cea7def51ab49860John McCall SourceLocation L, FriendUnion Friend_, 978c84028ed9aa0dfd54ab729dee78f29c961d7f37Enea Zaffanella SourceLocation FriendL, 988c84028ed9aa0dfd54ab729dee78f29c961d7f37Enea Zaffanella ArrayRef<TemplateParameterList*> FriendTypeTPLists 995543169296beeb183b9c9392debc774fcf493eebDmitri Gribenko = None); 1008c84028ed9aa0dfd54ab729dee78f29c961d7f37Enea Zaffanella static FriendDecl *CreateDeserialized(ASTContext &C, unsigned ID, 1018c84028ed9aa0dfd54ab729dee78f29c961d7f37Enea Zaffanella unsigned FriendTypeNumTPLists); 10292b7f70c924cbf4514e9e434cea7def51ab49860John McCall 103710672485039d3dd355748876299fff88e8ad84cCraig Silverstein /// If this friend declaration names an (untemplated but possibly 104710672485039d3dd355748876299fff88e8ad84cCraig Silverstein /// dependent) type, return the type; otherwise return null. This 105710672485039d3dd355748876299fff88e8ad84cCraig Silverstein /// is used for elaborated-type-specifiers and, in C++0x, for 106710672485039d3dd355748876299fff88e8ad84cCraig Silverstein /// arbitrary friend type declarations. 10732f2fb53d9d7c28c94d8569fd0fcf06cccee0c3dJohn McCall TypeSourceInfo *getFriendType() const { 10832f2fb53d9d7c28c94d8569fd0fcf06cccee0c3dJohn McCall return Friend.dyn_cast<TypeSourceInfo*>(); 10992b7f70c924cbf4514e9e434cea7def51ab49860John McCall } 1108c84028ed9aa0dfd54ab729dee78f29c961d7f37Enea Zaffanella unsigned getFriendTypeNumTemplateParameterLists() const { 1118c84028ed9aa0dfd54ab729dee78f29c961d7f37Enea Zaffanella return NumTPLists; 1128c84028ed9aa0dfd54ab729dee78f29c961d7f37Enea Zaffanella } 1138c84028ed9aa0dfd54ab729dee78f29c961d7f37Enea Zaffanella TemplateParameterList *getFriendTypeTemplateParameterList(unsigned N) const { 1148c84028ed9aa0dfd54ab729dee78f29c961d7f37Enea Zaffanella assert(N < NumTPLists); 1154967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar return getTrailingObjects<TemplateParameterList *>()[N]; 1168c84028ed9aa0dfd54ab729dee78f29c961d7f37Enea Zaffanella } 11792b7f70c924cbf4514e9e434cea7def51ab49860John McCall 118710672485039d3dd355748876299fff88e8ad84cCraig Silverstein /// If this friend declaration doesn't name a type, return the inner 119710672485039d3dd355748876299fff88e8ad84cCraig Silverstein /// declaration. 12092b7f70c924cbf4514e9e434cea7def51ab49860John McCall NamedDecl *getFriendDecl() const { 12192b7f70c924cbf4514e9e434cea7def51ab49860John McCall return Friend.dyn_cast<NamedDecl*>(); 12292b7f70c924cbf4514e9e434cea7def51ab49860John McCall } 12392b7f70c924cbf4514e9e434cea7def51ab49860John McCall 12492b7f70c924cbf4514e9e434cea7def51ab49860John McCall /// Retrieves the location of the 'friend' keyword. 12592b7f70c924cbf4514e9e434cea7def51ab49860John McCall SourceLocation getFriendLoc() const { 12692b7f70c924cbf4514e9e434cea7def51ab49860John McCall return FriendLoc; 12792b7f70c924cbf4514e9e434cea7def51ab49860John McCall } 12892b7f70c924cbf4514e9e434cea7def51ab49860John McCall 1298fbb7628e9fc364bbfb65bdf2c2468b0d06a7e5bAbramo Bagnara /// Retrieves the source range for the friend declaration. 130651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines SourceRange getSourceRange() const override LLVM_READONLY { 13103a400510fb8ba2e88e27c95ec797d944d944c4bAbramo Bagnara if (NamedDecl *ND = getFriendDecl()) { 132176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines if (FunctionDecl *FD = dyn_cast<FunctionDecl>(ND)) 133176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines return FD->getSourceRange(); 13403a400510fb8ba2e88e27c95ec797d944d944c4bAbramo Bagnara if (FunctionTemplateDecl *FTD = dyn_cast<FunctionTemplateDecl>(ND)) 13503a400510fb8ba2e88e27c95ec797d944d944c4bAbramo Bagnara return FTD->getSourceRange(); 136176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines if (ClassTemplateDecl *CTD = dyn_cast<ClassTemplateDecl>(ND)) 137176edba5311f6eff0cad2631449885ddf4fbc9eaStephen Hines return CTD->getSourceRange(); 13803a400510fb8ba2e88e27c95ec797d944d944c4bAbramo Bagnara if (DeclaratorDecl *DD = dyn_cast<DeclaratorDecl>(ND)) { 13903a400510fb8ba2e88e27c95ec797d944d944c4bAbramo Bagnara if (DD->getOuterLocStart() != DD->getInnerLocStart()) 14003a400510fb8ba2e88e27c95ec797d944d944c4bAbramo Bagnara return DD->getSourceRange(); 14103a400510fb8ba2e88e27c95ec797d944d944c4bAbramo Bagnara } 1428fbb7628e9fc364bbfb65bdf2c2468b0d06a7e5bAbramo Bagnara return SourceRange(getFriendLoc(), ND->getLocEnd()); 14303a400510fb8ba2e88e27c95ec797d944d944c4bAbramo Bagnara } 1448c84028ed9aa0dfd54ab729dee78f29c961d7f37Enea Zaffanella else if (TypeSourceInfo *TInfo = getFriendType()) { 1454967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar SourceLocation StartL = 1464967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar (NumTPLists == 0) ? getFriendLoc() 1474967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar : getTrailingObjects<TemplateParameterList *>()[0] 1484967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar ->getTemplateLoc(); 1498c84028ed9aa0dfd54ab729dee78f29c961d7f37Enea Zaffanella return SourceRange(StartL, TInfo->getTypeLoc().getEndLoc()); 1508c84028ed9aa0dfd54ab729dee78f29c961d7f37Enea Zaffanella } 1518fbb7628e9fc364bbfb65bdf2c2468b0d06a7e5bAbramo Bagnara else 1528fbb7628e9fc364bbfb65bdf2c2468b0d06a7e5bAbramo Bagnara return SourceRange(getFriendLoc(), getLocation()); 1538fbb7628e9fc364bbfb65bdf2c2468b0d06a7e5bAbramo Bagnara } 1548fbb7628e9fc364bbfb65bdf2c2468b0d06a7e5bAbramo Bagnara 1556102ca1d490836096678d7d934f0b2b78f9293ecJohn McCall /// Determines if this friend kind is unsupported. 1566102ca1d490836096678d7d934f0b2b78f9293ecJohn McCall bool isUnsupportedFriend() const { 1576102ca1d490836096678d7d934f0b2b78f9293ecJohn McCall return UnsupportedFriend; 1586102ca1d490836096678d7d934f0b2b78f9293ecJohn McCall } 1596102ca1d490836096678d7d934f0b2b78f9293ecJohn McCall void setUnsupportedFriend(bool Unsupported) { 1606102ca1d490836096678d7d934f0b2b78f9293ecJohn McCall UnsupportedFriend = Unsupported; 1616102ca1d490836096678d7d934f0b2b78f9293ecJohn McCall } 1626102ca1d490836096678d7d934f0b2b78f9293ecJohn McCall 16392b7f70c924cbf4514e9e434cea7def51ab49860John McCall // Implement isa/cast/dyncast/etc. 16492b7f70c924cbf4514e9e434cea7def51ab49860John McCall static bool classof(const Decl *D) { return classofKind(D->getKind()); } 16592b7f70c924cbf4514e9e434cea7def51ab49860John McCall static bool classofKind(Kind K) { return K == Decl::Friend; } 1666764334dfa73d67cbbb1b1fc8fe00440aad00f2aArgyrios Kyrtzidis 167d527cc06d78fe5afa5f20105b51697637eb02c56Sebastian Redl friend class ASTDeclReader; 1683397c5570369f19b2d6c52e898f708d75ceede1fSebastian Redl friend class ASTDeclWriter; 1694967a710c84587c654b56c828382219c3937dacbPirama Arumuga Nainar friend TrailingObjects; 17092b7f70c924cbf4514e9e434cea7def51ab49860John McCall}; 171d60e22e601852ae1345f01514318a0951dc09f89John McCall 172d60e22e601852ae1345f01514318a0951dc09f89John McCall/// An iterator over the friend declarations of a class. 173d60e22e601852ae1345f01514318a0951dc09f89John McCallclass CXXRecordDecl::friend_iterator { 174d60e22e601852ae1345f01514318a0951dc09f89John McCall FriendDecl *Ptr; 175d60e22e601852ae1345f01514318a0951dc09f89John McCall 176d60e22e601852ae1345f01514318a0951dc09f89John McCall friend class CXXRecordDecl; 177d60e22e601852ae1345f01514318a0951dc09f89John McCall explicit friend_iterator(FriendDecl *Ptr) : Ptr(Ptr) {} 178d60e22e601852ae1345f01514318a0951dc09f89John McCallpublic: 179d60e22e601852ae1345f01514318a0951dc09f89John McCall friend_iterator() {} 180d60e22e601852ae1345f01514318a0951dc09f89John McCall 181d60e22e601852ae1345f01514318a0951dc09f89John McCall typedef FriendDecl *value_type; 182d60e22e601852ae1345f01514318a0951dc09f89John McCall typedef FriendDecl *reference; 183d60e22e601852ae1345f01514318a0951dc09f89John McCall typedef FriendDecl *pointer; 184d60e22e601852ae1345f01514318a0951dc09f89John McCall typedef int difference_type; 185d60e22e601852ae1345f01514318a0951dc09f89John McCall typedef std::forward_iterator_tag iterator_category; 186d60e22e601852ae1345f01514318a0951dc09f89John McCall 187d60e22e601852ae1345f01514318a0951dc09f89John McCall reference operator*() const { return Ptr; } 188d60e22e601852ae1345f01514318a0951dc09f89John McCall 189d60e22e601852ae1345f01514318a0951dc09f89John McCall friend_iterator &operator++() { 190d60e22e601852ae1345f01514318a0951dc09f89John McCall assert(Ptr && "attempt to increment past end of friend list"); 19169aecc6252bf4a5ee59f9b51c3728ea07b6342bfDouglas Gregor Ptr = Ptr->getNextFriend(); 192d60e22e601852ae1345f01514318a0951dc09f89John McCall return *this; 193d60e22e601852ae1345f01514318a0951dc09f89John McCall } 194d60e22e601852ae1345f01514318a0951dc09f89John McCall 195d60e22e601852ae1345f01514318a0951dc09f89John McCall friend_iterator operator++(int) { 196d60e22e601852ae1345f01514318a0951dc09f89John McCall friend_iterator tmp = *this; 197d60e22e601852ae1345f01514318a0951dc09f89John McCall ++*this; 198d60e22e601852ae1345f01514318a0951dc09f89John McCall return tmp; 199d60e22e601852ae1345f01514318a0951dc09f89John McCall } 200d60e22e601852ae1345f01514318a0951dc09f89John McCall 201d60e22e601852ae1345f01514318a0951dc09f89John McCall bool operator==(const friend_iterator &Other) const { 202d60e22e601852ae1345f01514318a0951dc09f89John McCall return Ptr == Other.Ptr; 203d60e22e601852ae1345f01514318a0951dc09f89John McCall } 204d60e22e601852ae1345f01514318a0951dc09f89John McCall 205d60e22e601852ae1345f01514318a0951dc09f89John McCall bool operator!=(const friend_iterator &Other) const { 206d60e22e601852ae1345f01514318a0951dc09f89John McCall return Ptr != Other.Ptr; 207d60e22e601852ae1345f01514318a0951dc09f89John McCall } 208d60e22e601852ae1345f01514318a0951dc09f89John McCall 209d60e22e601852ae1345f01514318a0951dc09f89John McCall friend_iterator &operator+=(difference_type N) { 210d60e22e601852ae1345f01514318a0951dc09f89John McCall assert(N >= 0 && "cannot rewind a CXXRecordDecl::friend_iterator"); 211d60e22e601852ae1345f01514318a0951dc09f89John McCall while (N--) 212d60e22e601852ae1345f01514318a0951dc09f89John McCall ++*this; 213d60e22e601852ae1345f01514318a0951dc09f89John McCall return *this; 214d60e22e601852ae1345f01514318a0951dc09f89John McCall } 215d60e22e601852ae1345f01514318a0951dc09f89John McCall 216d60e22e601852ae1345f01514318a0951dc09f89John McCall friend_iterator operator+(difference_type N) const { 217d60e22e601852ae1345f01514318a0951dc09f89John McCall friend_iterator tmp = *this; 218d60e22e601852ae1345f01514318a0951dc09f89John McCall tmp += N; 219d60e22e601852ae1345f01514318a0951dc09f89John McCall return tmp; 220d60e22e601852ae1345f01514318a0951dc09f89John McCall } 221d60e22e601852ae1345f01514318a0951dc09f89John McCall}; 222d60e22e601852ae1345f01514318a0951dc09f89John McCall 223d60e22e601852ae1345f01514318a0951dc09f89John McCallinline CXXRecordDecl::friend_iterator CXXRecordDecl::friend_begin() const { 2244fc5089e306fe606f2e3e4fa58063ebab35deb62Richard Smith return friend_iterator(getFirstFriend()); 225d60e22e601852ae1345f01514318a0951dc09f89John McCall} 226d60e22e601852ae1345f01514318a0951dc09f89John McCall 227d60e22e601852ae1345f01514318a0951dc09f89John McCallinline CXXRecordDecl::friend_iterator CXXRecordDecl::friend_end() const { 2286bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines return friend_iterator(nullptr); 229d60e22e601852ae1345f01514318a0951dc09f89John McCall} 230d60e22e601852ae1345f01514318a0951dc09f89John McCall 231651f13cea278ec967336033dd032faef0e9fc2ecStephen Hinesinline CXXRecordDecl::friend_range CXXRecordDecl::friends() const { 232651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines return friend_range(friend_begin(), friend_end()); 233651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines} 234651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines 235d60e22e601852ae1345f01514318a0951dc09f89John McCallinline void CXXRecordDecl::pushFriendDecl(FriendDecl *FD) { 2367247c88d1e41514a41085f83ebf03dd5220e054aDavid Blaikie assert(!FD->NextFriend && "friend already has next friend?"); 237d60e22e601852ae1345f01514318a0951dc09f89John McCall FD->NextFriend = data().FirstFriend; 238d60e22e601852ae1345f01514318a0951dc09f89John McCall data().FirstFriend = FD; 239d60e22e601852ae1345f01514318a0951dc09f89John McCall} 24092b7f70c924cbf4514e9e434cea7def51ab49860John McCall 24192b7f70c924cbf4514e9e434cea7def51ab49860John McCall} 24292b7f70c924cbf4514e9e434cea7def51ab49860John McCall 24392b7f70c924cbf4514e9e434cea7def51ab49860John McCall#endif 244