15 #ifndef LLVM_CLANG_AST_DECLFRIEND_H
16 #define LLVM_CLANG_AST_DECLFRIEND_H
21 #include "llvm/Support/Compiler.h"
43 virtual void anchor();
45 typedef llvm::PointerUnion<NamedDecl*,TypeSourceInfo*>
FriendUnion;
60 unsigned UnsupportedFriend : 1;
65 unsigned NumTPLists : 31;
77 UnsupportedFriend(
false),
78 NumTPLists(FriendTypeTPLists.size()) {
79 for (
unsigned i = 0; i < NumTPLists; ++i)
80 getTrailingObjects<TemplateParameterList *>()[i] = FriendTypeTPLists[i];
83 FriendDecl(EmptyShell Empty,
unsigned NumFriendTypeTPLists)
84 :
Decl(
Decl::Friend, Empty), NextFriend(),
85 NumTPLists(NumFriendTypeTPLists) { }
87 FriendDecl *getNextFriend() {
89 return cast_or_null<FriendDecl>(NextFriend.
get(
nullptr));
90 return getNextFriendSlowCase();
92 FriendDecl *getNextFriendSlowCase();
97 SourceLocation FriendL,
98 ArrayRef<TemplateParameterList*> FriendTypeTPLists
101 unsigned FriendTypeNumTPLists);
114 assert(N < NumTPLists);
115 return getTrailingObjects<TemplateParameterList *>()[N];
133 return FD->getSourceRange();
135 return FTD->getSourceRange();
137 return CTD->getSourceRange();
139 if (DD->getOuterLocStart() != DD->getInnerLocStart())
140 return DD->getSourceRange();
147 : getTrailingObjects<TemplateParameterList *>()[0]
149 return SourceRange(StartL, TInfo->getTypeLoc().getEndLoc());
157 return UnsupportedFriend;
190 assert(Ptr &&
"attempt to increment past end of friend list");
191 Ptr = Ptr->getNextFriend();
202 return Ptr == Other.Ptr;
206 return Ptr != Other.Ptr;
210 assert(N >= 0 &&
"cannot rewind a CXXRecordDecl::friend_iterator");
236 assert(!FD->NextFriend &&
"friend already has next friend?");
237 FD->NextFriend = data().FirstFriend;
238 data().FirstFriend = FD;
TemplateParameterList * getFriendTypeTemplateParameterList(unsigned N) const
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
reference operator*() const
bool isOffset() const
Whether this pointer is currently stored as an offset.
Defines the C++ template declaration subclasses.
friend_range friends() const
static FriendDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned FriendTypeNumTPLists)
A container of type source information.
static FriendDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, FriendUnion Friend_, SourceLocation FriendL, ArrayRef< TemplateParameterList * > FriendTypeTPLists=None)
FriendDecl - Represents the declaration of a friend entity, which can be a function, a type, or a templated function or type.
Stores a list of template parameters for a TemplateDecl and its derived classes.
llvm::iterator_range< friend_iterator > friend_range
TypeSourceInfo * getFriendType() const
If this friend declaration names an (untemplated but possibly dependent) type, return the type; other...
An iterator over the friend declarations of a class.
unsigned getFriendTypeNumTemplateParameterLists() const
friend_iterator operator++(int)
llvm::PointerUnion< NamedDecl *, TypeSourceInfo * > FriendUnion
friend_iterator & operator+=(difference_type N)
friend_iterator friend_end() const
friend_iterator & operator++()
std::forward_iterator_tag iterator_category
Represents a ValueDecl that came out of a declarator.
friend_iterator friend_begin() const
Defines the clang::TypeLoc interface and its subclasses.
static bool classof(const Decl *D)
SourceLocation getFriendLoc() const
Retrieves the location of the 'friend' keyword.
Encodes a location in the source.
bool operator==(const friend_iterator &Other) const
T * get(ExternalASTSource *Source) const
Retrieve the pointer to the AST node that this lazy pointer.
static bool classofKind(Kind K)
bool isUnsupportedFriend() const
Determines if this friend kind is unsupported.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
NamedDecl * getFriendDecl() const
If this friend declaration doesn't name a type, return the inner declaration.
friend_iterator operator+(difference_type N) const
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
Represents a C++ struct/union/class.
void setUnsupportedFriend(bool Unsupported)
Declaration of a class template.
SourceRange getSourceRange() const override LLVM_READONLY
Retrieves the source range for the friend declaration.
A trivial tuple used to represent a source range.
NamedDecl - This represents a decl with a name.
bool operator!=(const friend_iterator &Other) const
Declaration of a template function.
void pushFriendDecl(FriendDecl *FD)