[cfe-commits] r126993 - /cfe/trunk/include/clang/AST/DeclFriend.h

Abramo Bagnara abramo.bagnara at gmail.com
Fri Mar 4 02:59:18 PST 2011


Author: abramo
Date: Fri Mar  4 04:59:18 2011
New Revision: 126993

URL: http://llvm.org/viewvc/llvm-project?rev=126993&view=rev
Log:
Fixed end location of FriendDecl.

Modified:
    cfe/trunk/include/clang/AST/DeclFriend.h

Modified: cfe/trunk/include/clang/AST/DeclFriend.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclFriend.h?rev=126993&r1=126992&r2=126993&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclFriend.h (original)
+++ cfe/trunk/include/clang/AST/DeclFriend.h Fri Mar  4 04:59:18 2011
@@ -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;





More information about the cfe-commits mailing list