diff options
Diffstat (limited to 'include/clang/AST/DeclFriend.h')
-rw-r--r-- | include/clang/AST/DeclFriend.h | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/include/clang/AST/DeclFriend.h b/include/clang/AST/DeclFriend.h index 4b5e6fd..20d6da1 100644 --- a/include/clang/AST/DeclFriend.h +++ b/include/clang/AST/DeclFriend.h @@ -43,11 +43,16 @@ private: FriendUnion Friend; // A pointer to the next friend in the sequence. - FriendDecl *NextFriend; + LazyDeclPtr NextFriend; // Location of the 'friend' specifier. SourceLocation FriendLoc; + /// True if this 'friend' declaration is unsupported. Eventually we + /// will support every possible friend declaration, but for now we + /// silently ignore some and set this flag to authorize all access. + bool UnsupportedFriend; + friend class CXXRecordDecl::friend_iterator; friend class CXXRecordDecl; @@ -55,13 +60,19 @@ private: SourceLocation FriendL) : Decl(Decl::Friend, DC, L), Friend(Friend), - NextFriend(0), - FriendLoc(FriendL) { + NextFriend(), + FriendLoc(FriendL), + UnsupportedFriend(false) { } explicit FriendDecl(EmptyShell Empty) - : Decl(Decl::Friend, Empty), NextFriend(0) { } + : Decl(Decl::Friend, Empty), NextFriend() { } + FriendDecl *getNextFriend() { + return cast_or_null<FriendDecl>( + NextFriend.get(getASTContext().getExternalSource())); + } + public: static FriendDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L, FriendUnion Friend_, @@ -87,6 +98,14 @@ public: return FriendLoc; } + /// Determines if this friend kind is unsupported. + bool isUnsupportedFriend() const { + return UnsupportedFriend; + } + void setUnsupportedFriend(bool Unsupported) { + UnsupportedFriend = Unsupported; + } + // Implement isa/cast/dyncast/etc. static bool classof(const Decl *D) { return classofKind(D->getKind()); } static bool classof(const FriendDecl *D) { return true; } @@ -115,7 +134,7 @@ public: friend_iterator &operator++() { assert(Ptr && "attempt to increment past end of friend list"); - Ptr = Ptr->NextFriend; + Ptr = Ptr->getNextFriend(); return *this; } |