From: Daniel Dunbar Date: Fri, 9 Mar 2012 18:34:54 +0000 (+0000) Subject: [AST/Sema] Add {CXXBaseSpecifier,Declarator,DeclSpec,TypeLoc,UnqualifiedId}::getLoc... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3d4144f32ea4c24aaf48cbff4f476c1446ba2641;p=clang [AST/Sema] Add {CXXBaseSpecifier,Declarator,DeclSpec,TypeLoc,UnqualifiedId}::getLoc{Start,End}. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152418 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/DeclCXX.h b/include/clang/AST/DeclCXX.h index edecc779a3..838912d49e 100644 --- a/include/clang/AST/DeclCXX.h +++ b/include/clang/AST/DeclCXX.h @@ -209,6 +209,8 @@ public: /// getSourceRange - Retrieves the source range that contains the /// entire base specifier. SourceRange getSourceRange() const { return Range; } + SourceLocation getLocStart() const { return Range.getBegin(); } + SourceLocation getLocEnd() const { return Range.getEnd(); } /// isVirtual - Determines whether the base class is a virtual base /// class (or not). diff --git a/include/clang/AST/TypeLoc.h b/include/clang/AST/TypeLoc.h index bdb0b9b438..c0a77d48b3 100644 --- a/include/clang/AST/TypeLoc.h +++ b/include/clang/AST/TypeLoc.h @@ -96,6 +96,8 @@ public: SourceRange getSourceRange() const { return SourceRange(getBeginLoc(), getEndLoc()); } + SourceLocation getLocStart() const { return getBeginLoc(); } + SourceLocation getLocEnd() const { return getEndLoc(); } /// \brief Get the local source range. SourceRange getLocalSourceRange() const { diff --git a/include/clang/Sema/DeclSpec.h b/include/clang/Sema/DeclSpec.h index f5c2999616..4f8417a8ea 100644 --- a/include/clang/Sema/DeclSpec.h +++ b/include/clang/Sema/DeclSpec.h @@ -447,6 +447,9 @@ public: const CXXScopeSpec &getTypeSpecScope() const { return TypeScope; } const SourceRange &getSourceRange() const { return Range; } + SourceLocation getLocStart() const { return Range.getBegin(); } + SourceLocation getLocEnd() const { return Range.getEnd(); } + SourceLocation getTypeSpecWidthLoc() const { return TSWLoc; } SourceLocation getTypeSpecComplexLoc() const { return TSCLoc; } SourceLocation getTypeSpecSignLoc() const { return TSSLoc; } @@ -966,6 +969,8 @@ public: SourceRange getSourceRange() const { return SourceRange(StartLocation, EndLocation); } + SourceLocation getLocStart() const { return StartLocation; } + SourceLocation getLocEnd() const { return EndLocation; } }; /// CachedTokens - A set of tokens that has been cached for later @@ -1525,6 +1530,8 @@ public: /// getSourceRange - Get the source range that spans this declarator. const SourceRange &getSourceRange() const { return Range; } + SourceLocation getLocStart() const { return Range.getBegin(); } + SourceLocation getLocEnd() const { return Range.getEnd(); } void SetSourceRange(SourceRange R) { Range = R; } /// SetRangeBegin - Set the start of the source range to Loc, unless it's