14 #ifndef LLVM_CLANG_AST_DECLFRIEND_H 15 #define LLVM_CLANG_AST_DECLFRIEND_H 25 #include "llvm/ADT/ArrayRef.h" 26 #include "llvm/ADT/None.h" 27 #include "llvm/ADT/PointerUnion.h" 28 #include "llvm/Support/Casting.h" 29 #include "llvm/Support/Compiler.h" 30 #include "llvm/Support/TrailingObjects.h" 56 virtual void anchor();
59 using FriendUnion = llvm::PointerUnion<NamedDecl *, TypeSourceInfo *>;
77 unsigned UnsupportedFriend : 1;
82 unsigned NumTPLists : 31;
87 :
Decl(
Decl::Friend, DC, L), Friend(Friend), FriendLoc(FriendL),
88 UnsupportedFriend(
false), NumTPLists(FriendTypeTPLists.size()) {
89 for (
unsigned i = 0; i < NumTPLists; ++i)
90 getTrailingObjects<TemplateParameterList *>()[i] = FriendTypeTPLists[i];
95 NumTPLists(NumFriendTypeTPLists) {}
99 return cast_or_null<FriendDecl>(NextFriend.
get(
nullptr));
100 return getNextFriendSlowCase();
117 unsigned FriendTypeNumTPLists);
132 assert(N < NumTPLists);
133 return getTrailingObjects<TemplateParameterList *>()[N];
150 if (
const auto *FD = dyn_cast<FunctionDecl>(ND))
151 return FD->getSourceRange();
152 if (
const auto *FTD = dyn_cast<FunctionTemplateDecl>(ND))
153 return FTD->getSourceRange();
154 if (
const auto *CTD = dyn_cast<ClassTemplateDecl>(ND))
155 return CTD->getSourceRange();
156 if (
const auto *DD = dyn_cast<DeclaratorDecl>(ND)) {
157 if (DD->getOuterLocStart() != DD->getInnerLocStart())
158 return DD->getSourceRange();
165 : getTrailingObjects<TemplateParameterList *>()[0]
167 return SourceRange(StartL, TInfo->getTypeLoc().getEndLoc());
175 return UnsupportedFriend;
206 assert(Ptr &&
"attempt to increment past end of friend list");
207 Ptr = Ptr->getNextFriend();
218 return Ptr == Other.Ptr;
222 return Ptr != Other.Ptr;
226 assert(N >= 0 &&
"cannot rewind a CXXRecordDecl::friend_iterator");
252 assert(!FD->NextFriend &&
"friend already has next friend?");
253 FD->NextFriend = data().FirstFriend;
254 data().FirstFriend = FD;
259 #endif // LLVM_CLANG_AST_DECLFRIEND_H
unsigned getFriendTypeNumTemplateParameterLists() const
Decl - This represents one declaration (or definition), e.g.
Defines the C++ template declaration subclasses.
friend_iterator operator+(difference_type N) const
static FriendDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned FriendTypeNumTPLists)
A container of type source information.
FriendDecl - Represents the declaration of a friend entity, which can be a function, a type, or a templated function or type.
llvm::PointerUnion< NamedDecl *, TypeSourceInfo * > FriendUnion
Stores a list of template parameters for a TemplateDecl and its derived classes.
An iterator over the friend declarations of a class.
TypeSourceInfo * getFriendType() const
If this friend declaration names an (untemplated but possibly dependent) type, return the type; other...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
NamedDecl * getFriendDecl() const
If this friend declaration doesn't name a type, return the inner declaration.
friend_iterator operator++(int)
llvm::iterator_range< friend_iterator > friend_range
friend_iterator & operator+=(difference_type N)
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
friend_iterator & operator++()
friend_iterator friend_end() const
TemplateParameterList * getFriendTypeTemplateParameterList(unsigned N) const
A placeholder type used to construct an empty shell of a decl-derived type that will be filled in lat...
Defines the clang::TypeLoc interface and its subclasses.
static bool classof(const Decl *D)
static FriendDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, FriendUnion Friend_, SourceLocation FriendL, ArrayRef< TemplateParameterList *> FriendTypeTPLists=None)
Encodes a location in the source.
SourceLocation getFriendLoc() const
Retrieves the location of the 'friend' keyword.
friend_iterator friend_begin() const
bool operator==(const friend_iterator &Other) const
reference operator*() const
static bool classofKind(Kind K)
Dataflow Directional Tag Classes.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
std::forward_iterator_tag iterator_category
T * get(ExternalASTSource *Source) const
Retrieve the pointer to the AST node that this lazy pointer points to.
friend_range friends() const
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
Defines the clang::SourceLocation class and associated facilities.
Represents a C++ struct/union/class.
void setUnsupportedFriend(bool Unsupported)
bool isOffset() const
Whether this pointer is currently stored as an offset.
Kind
Lists the kind of concrete classes of Decl.
bool operator!=(const friend_iterator &Other) const
SourceRange getSourceRange() const override LLVM_READONLY
Retrieves the source range for the friend declaration.
A trivial tuple used to represent a source range.
This represents a decl that may have a name.
bool isUnsupportedFriend() const
Determines if this friend kind is unsupported.
SourceLocation getLocation() const
void pushFriendDecl(FriendDecl *FD)