14#ifndef LLVM_CLANG_AST_DECLFRIEND_H
15#define LLVM_CLANG_AST_DECLFRIEND_H
25#include "llvm/ADT/ArrayRef.h"
26#include "llvm/ADT/PointerUnion.h"
27#include "llvm/Support/Casting.h"
28#include "llvm/Support/Compiler.h"
29#include "llvm/Support/TrailingObjects.h"
54 private llvm::TrailingObjects<FriendDecl, TemplateParameterList *> {
55 virtual void anchor();
58 using FriendUnion = llvm::PointerUnion<NamedDecl *, TypeSourceInfo *>;
76 LLVM_PREFERRED_TYPE(
bool)
77 unsigned UnsupportedFriend : 1;
82 unsigned NumTPLists : 31;
88 UnsupportedFriend(
false), NumTPLists(FriendTypeTPLists.size()) {
89 for (
unsigned i = 0; i < NumTPLists; ++i)
90 getTrailingObjects<TemplateParameterList *>()[i] = FriendTypeTPLists[i];
95 NumTPLists(NumFriendTypeTPLists) {}
97 FriendDecl *getNextFriend() {
99 return cast_or_null<FriendDecl>(NextFriend.
get(
nullptr));
100 return getNextFriendSlowCase();
103 FriendDecl *getNextFriendSlowCase();
116 unsigned FriendTypeNumTPLists);
131 assert(N < NumTPLists);
132 return getTrailingObjects<TemplateParameterList *>()[N];
149 if (
const auto *FD = dyn_cast<FunctionDecl>(ND))
150 return FD->getSourceRange();
151 if (
const auto *FTD = dyn_cast<FunctionTemplateDecl>(ND))
152 return FTD->getSourceRange();
153 if (
const auto *CTD = dyn_cast<ClassTemplateDecl>(ND))
154 return CTD->getSourceRange();
155 if (
const auto *DD = dyn_cast<DeclaratorDecl>(ND)) {
156 if (DD->getOuterLocStart() != DD->getInnerLocStart())
157 return DD->getSourceRange();
164 : getTrailingObjects<TemplateParameterList *>()[0]
166 return SourceRange(StartL, TInfo->getTypeLoc().getEndLoc());
174 return UnsupportedFriend;
177 UnsupportedFriend = Unsupported;
205 assert(Ptr &&
"attempt to increment past end of friend list");
206 Ptr = Ptr->getNextFriend();
217 return Ptr ==
Other.Ptr;
221 return Ptr !=
Other.Ptr;
225 assert(N >= 0 &&
"cannot rewind a CXXRecordDecl::friend_iterator");
251 assert(!FD->NextFriend &&
"friend already has next friend?");
252 FD->NextFriend = data().FirstFriend;
253 data().FirstFriend = FD;
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the C++ template declaration subclasses.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the clang::SourceLocation class and associated facilities.
Defines the clang::TypeLoc interface and its subclasses.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
An iterator over the friend declarations of a class.
std::forward_iterator_tag iterator_category
friend_iterator operator+(difference_type N) const
friend_iterator()=default
bool operator!=(const friend_iterator &Other) const
friend_iterator operator++(int)
bool operator==(const friend_iterator &Other) const
friend_iterator & operator+=(difference_type N)
reference operator*() const
friend_iterator & operator++()
Represents a C++ struct/union/class.
friend_range friends() const
friend_iterator friend_begin() const
llvm::iterator_range< friend_iterator > friend_range
void pushFriendDecl(FriendDecl *FD)
friend_iterator friend_end() const
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Decl - This represents one declaration (or definition), e.g.
Kind
Lists the kind of concrete classes of Decl.
SourceLocation getLocation() const
FriendDecl - Represents the declaration of a friend entity, which can be a function,...
bool isUnsupportedFriend() const
Determines if this friend kind is unsupported.
llvm::PointerUnion< NamedDecl *, TypeSourceInfo * > FriendUnion
static bool classofKind(Kind K)
static FriendDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID, unsigned FriendTypeNumTPLists)
static bool classof(const Decl *D)
unsigned getFriendTypeNumTemplateParameterLists() const
SourceLocation getFriendLoc() const
Retrieves the location of the 'friend' keyword.
void setUnsupportedFriend(bool Unsupported)
SourceRange getSourceRange() const override LLVM_READONLY
Retrieves the source range for the friend declaration.
TemplateParameterList * getFriendTypeTemplateParameterList(unsigned N) const
NamedDecl * getFriendDecl() const
If this friend declaration doesn't name a type, return the inner declaration.
TypeSourceInfo * getFriendType() const
If this friend declaration names an (untemplated but possibly dependent) type, return the type; other...
This represents a decl that may have a name.
Encodes a location in the source.
A trivial tuple used to represent a source range.
Stores a list of template parameters for a TemplateDecl and its derived classes.
A container of type source information.
The JSON file list parser is used to communicate input to InstallAPI.
@ Create
'create' clause, allowed on Compute and Combined constructs, plus 'data', 'enter data',...
@ Other
Other implicit parameter.
bool isOffset() const
Whether this pointer is currently stored as an offset.
T * get(ExternalASTSource *Source) const
Retrieve the pointer to the AST node that this lazy pointer points to.