From: Abramo Bagnara Date: Fri, 4 Mar 2011 10:59:18 +0000 (+0000) Subject: Fixed end location of FriendDecl. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8fbb7628e9fc364bbfb65bdf2c2468b0d06a7e5b;p=clang Fixed end location of FriendDecl. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126993 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/DeclFriend.h b/include/clang/AST/DeclFriend.h index 20d6da19b8..b84e5bba86 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;