diff options
Diffstat (limited to 'include/clang/AST/DeclFriend.h')
-rw-r--r-- | include/clang/AST/DeclFriend.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/clang/AST/DeclFriend.h b/include/clang/AST/DeclFriend.h index 20d6da1..b84e5bb 100644 --- a/include/clang/AST/DeclFriend.h +++ b/include/clang/AST/DeclFriend.h @@ -98,6 +98,17 @@ public: return FriendLoc; } + /// Retrieves the source range for the friend declaration. + SourceRange getSourceRange() const { + /* FIXME: consider the case of templates wrt start of range. */ + if (NamedDecl *ND = getFriendDecl()) + return SourceRange(getFriendLoc(), ND->getLocEnd()); + else if (TypeSourceInfo *TInfo = getFriendType()) + return SourceRange(getFriendLoc(), TInfo->getTypeLoc().getEndLoc()); + else + return SourceRange(getFriendLoc(), getLocation()); + } + /// Determines if this friend kind is unsupported. bool isUnsupportedFriend() const { return UnsupportedFriend; |