15 #ifndef LLVM_CLANG_AST_DECLFRIEND_H
16 #define LLVM_CLANG_AST_DECLFRIEND_H
21 #include "llvm/Support/Compiler.h"
41 virtual void anchor();
43 typedef llvm::PointerUnion<NamedDecl*,TypeSourceInfo*>
FriendUnion;
58 bool UnsupportedFriend : 1;
63 unsigned NumTPLists : 31;
83 UnsupportedFriend(
false),
84 NumTPLists(FriendTypeTPLists.size()) {
85 for (
unsigned i = 0; i < NumTPLists; ++i)
86 getTPLists()[i] = FriendTypeTPLists[i];
89 FriendDecl(EmptyShell Empty,
unsigned NumFriendTypeTPLists)
90 :
Decl(
Decl::Friend, Empty), NextFriend(),
91 NumTPLists(NumFriendTypeTPLists) { }
93 FriendDecl *getNextFriend() {
95 return cast_or_null<FriendDecl>(NextFriend.
get(
nullptr));
96 return getNextFriendSlowCase();
98 FriendDecl *getNextFriendSlowCase();
103 SourceLocation FriendL,
104 ArrayRef<TemplateParameterList*> FriendTypeTPLists
107 unsigned FriendTypeNumTPLists);
120 assert(N < NumTPLists);
121 return getTPLists()[N];
139 return FD->getSourceRange();
141 return FTD->getSourceRange();
143 return CTD->getSourceRange();
145 if (DD->getOuterLocStart() != DD->getInnerLocStart())
146 return DD->getSourceRange();
154 return SourceRange(StartL, TInfo->getTypeLoc().getEndLoc());
162 return UnsupportedFriend;
194 assert(Ptr &&
"attempt to increment past end of friend list");
195 Ptr = Ptr->getNextFriend();
206 return Ptr == Other.Ptr;
210 return Ptr != Other.Ptr;
214 assert(N >= 0 &&
"cannot rewind a CXXRecordDecl::friend_iterator");
240 assert(!FD->NextFriend &&
"friend already has next friend?");
241 FD->NextFriend = data().FirstFriend;
242 data().FirstFriend = FD;
TemplateParameterList * getFriendTypeTemplateParameterList(unsigned N) const
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)
Stores a list of template parameters for a TemplateDecl and its derived classes.
llvm::iterator_range< friend_iterator > friend_range
TypeSourceInfo * getFriendType() const
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. Contains type source information through TypeSo...
ID
Defines the set of possible language-specific address spaces.
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. The SourceManager can decode this to get at the full include stack...
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.
NamedDecl * getFriendDecl() const
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.
Kind
Lists the kind of concrete classes of Decl.
SourceRange getSourceRange() const override LLVM_READONLY
Retrieves the source range for the friend declaration.
A trivial tuple used to represent a source range.
SourceLocation getLocation() const
bool operator!=(const friend_iterator &Other) const
Declaration of a template function.
void pushFriendDecl(FriendDecl *FD)
SourceLocation getTemplateLoc() const