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 20d6da1..b84e5bb 100644
--- a/include/clang/AST/DeclFriend.h
+++ b/include/clang/AST/DeclFriend.h
@@ -98,6 +98,17 @@
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;