Timm =?utf-8?q?Bäder?= <[email protected]>,
Timm =?utf-8?q?Bäder?= <[email protected]>,
Timm =?utf-8?q?Bäder?= <[email protected]>,
Timm =?utf-8?q?Bäder?= <[email protected]>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/[email protected]>
================
@@ -47,6 +47,43 @@ static constexpr raw_ostream::Colors CommentColor =
raw_ostream::YELLOW;
static constexpr raw_ostream::Colors LiteralColor = raw_ostream::GREEN;
static constexpr raw_ostream::Colors KeywordColor = raw_ostream::BLUE;
+namespace {
+template <typename Sub> class ColumnsOrBytes {
+public:
+ int V = 0;
+ ColumnsOrBytes(int V) : V(V) {}
+ bool isValid() const { return V != -1; }
+ Sub next() const { return Sub(V + 1); }
+ Sub prev() const { return Sub(V - 1); }
+
+ bool operator>(ColumnsOrBytes O) const { return V > O.V; }
+ bool operator<(ColumnsOrBytes O) const { return V < O.V; }
+ bool operator<=(ColumnsOrBytes B) const { return V <= B.V; }
+ bool operator!=(ColumnsOrBytes C) const { return C.V != V; }
+
+ Sub operator+(Sub B) const { return Sub(V + B.V); }
+ Sub &operator+=(Sub B) {
+ V += B.V;
+ return *(Sub *)this;
+ }
+ Sub operator-(Sub B) const { return Sub(V - B.V); }
+ Sub &operator-=(Sub B) {
+ V -= B.V;
+ return *(Sub *)this;
----------------
Sirraide wrote:
```suggestion
return *static_cast<Sub *>(this);
```
https://github.com/llvm/llvm-project/pull/165541
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits