//===- DeclFriend.h - Classes for C++ friend declarations -------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file defines the section of the AST representing C++ friend // declarations. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_AST_DECLFRIEND_H #define LLVM_CLANG_AST_DECLFRIEND_H #include "clang/AST/Decl.h" #include "clang/AST/DeclBase.h" #include "clang/AST/DeclCXX.h" #include "clang/AST/DeclTemplate.h" #include "clang/AST/ExternalASTSource.h" #include "clang/AST/TypeLoc.h" #include "clang/Basic/LLVM.h" #include "clang/Basic/SourceLocation.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/PointerUnion.h" #include "llvm/Support/Casting.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/TrailingObjects.h" #include <cassert> #include <iterator> namespace clang { class ASTContext; /// FriendDecl - Represents the declaration of a friend entity, /// which can be a function, a type, or a templated function or type. /// For example: /// /// @code /// template <typename T> class A { /// friend int foo(T); /// friend class B; /// friend T; // only in C++0x /// template <typename U> friend class C; /// template <typename U> friend A& operator+=(A&, const U&) { ... } /// }; /// @endcode /// /// The semantic context of a friend decl is its declaring class. class FriendDecl final : public Decl, private llvm::TrailingObjects<FriendDecl, TemplateParameterList *> { … }; /// An iterator over the friend declarations of a class. class CXXRecordDecl::friend_iterator { … }; inline CXXRecordDecl::friend_iterator CXXRecordDecl::friend_begin() const { … } inline CXXRecordDecl::friend_iterator CXXRecordDecl::friend_end() const { … } inline CXXRecordDecl::friend_range CXXRecordDecl::friends() const { … } inline void CXXRecordDecl::pushFriendDecl(FriendDecl *FD) { … } } // namespace clang #endif // LLVM_CLANG_AST_DECLFRIEND_H