From: Argyrios Kyrtzidis Date: Sat, 18 Jul 2009 00:33:08 +0000 (+0000) Subject: Add getSourceRange() methods for ObjC Decls. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ddfd4c9eda34765b08fae4cb31ad5a365face107;p=clang Add getSourceRange() methods for ObjC Decls. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76267 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h index c6b7910c7d..ded2fc9772 100644 --- a/include/clang/AST/DeclObjC.h +++ b/include/clang/AST/DeclObjC.h @@ -178,7 +178,7 @@ public: SourceLocation getLocStart() const { return getLocation(); } SourceLocation getLocEnd() const { return EndLoc; } void setEndLoc(SourceLocation Loc) { EndLoc = Loc; } - SourceRange getSourceRange() const { + virtual SourceRange getSourceRange() const { return SourceRange(getLocation(), EndLoc); } @@ -341,6 +341,10 @@ public: // Marks the end of the container. SourceLocation getAtEndLoc() const { return AtEndLoc; } void setAtEndLoc(SourceLocation L) { AtEndLoc = L; } + + virtual SourceRange getSourceRange() const { + return SourceRange(getLocation(), getAtEndLoc()); + } // Implement isa/cast/dyncast/etc. static bool classof(const Decl *D) { @@ -484,7 +488,7 @@ public: ObjCMethodDecl *lookupClassMethod(Selector Sel); ObjCInterfaceDecl *lookupInheritedClass(const IdentifierInfo *ICName); - // Location information, modeled after the Stmt API. + // Location information, modeled after the Stmt API. SourceLocation getLocStart() const { return getLocation(); } // '@'interface SourceLocation getLocEnd() const { return EndLoc; } void setLocEnd(SourceLocation LE) { EndLoc = LE; }; @@ -880,6 +884,9 @@ public: } // Location information, modeled after the Stmt API. + virtual SourceRange getSourceRange() const { + return SourceRange(getLocation(), EndLoc); + } SourceLocation getLocStart() const { return getLocation(); } SourceLocation getLocEnd() const { return EndLoc; } void setLocEnd(SourceLocation LE) { EndLoc = LE; }; @@ -1188,6 +1195,9 @@ public: Kind PK, ObjCIvarDecl *ivarDecl); + virtual SourceRange getSourceRange() const { + return SourceRange(AtLoc, getLocation()); + } SourceLocation getLocStart() const { return AtLoc; } void setAtLoc(SourceLocation Loc) { AtLoc = Loc; }