Reviewers: sammccall
Reviewed By: sammccall
Subscribers: mgorny, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D61681
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365331
91177308-0d34-0410-b5e6-
96231b3b80d8
unsigned length() const { return End - Begin; }
+ /// Check if \p Offset is inside the range.
+ bool contains(unsigned Offset) const {
+ return Begin <= Offset && Offset < End;
+ }
+ /// Check \p Offset is inside the range or equal to its endpoint.
+ bool touches(unsigned Offset) const {
+ return Begin <= Offset && Offset <= End;
+ }
+
/// Gets the substring that this FileRange refers to.
llvm::StringRef text(const SourceManager &SM) const;