Hi djasper, revane,
Working on the C++11 Migrator I needed something similar to the tooling::Range
but with the added possibility to update the offset/length, so I made the fields
public.
I also added two methods getBegin()/getEnd() for convenience but I have no
strong opinion about their existance, it just makes my code slightly more
readable IMHO.
http://llvm-reviews.chandlerc.com/D1156
Files:
include/clang/Tooling/Refactoring.h
Index: include/clang/Tooling/Refactoring.h
===================================================================
--- include/clang/Tooling/Refactoring.h
+++ include/clang/Tooling/Refactoring.h
@@ -33,15 +33,15 @@
namespace tooling {
/// \brief A source range independent of the \c SourceManager.
-class Range {
-public:
+struct Range {
Range() : Offset(0), Length(0) {}
Range(unsigned Offset, unsigned Length) : Offset(Offset), Length(Length) {}
unsigned getOffset() const { return Offset; }
unsigned getLength() const { return Length; }
+ unsigned getBegin() const { return Offset; }
+ unsigned getEnd() const { return Offset + Length; }
-private:
unsigned Offset;
unsigned Length;
};
Index: include/clang/Tooling/Refactoring.h
===================================================================
--- include/clang/Tooling/Refactoring.h
+++ include/clang/Tooling/Refactoring.h
@@ -33,15 +33,15 @@
namespace tooling {
/// \brief A source range independent of the \c SourceManager.
-class Range {
-public:
+struct Range {
Range() : Offset(0), Length(0) {}
Range(unsigned Offset, unsigned Length) : Offset(Offset), Length(Length) {}
unsigned getOffset() const { return Offset; }
unsigned getLength() const { return Length; }
+ unsigned getBegin() const { return Offset; }
+ unsigned getEnd() const { return Offset + Length; }
-private:
unsigned Offset;
unsigned Length;
};
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits