[clang] [clang] Add Bytes/Column types to TextDiagnostic (PR #165541)

Yanzuo Liu via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 29 05:39:16 PDT 2025


Timm =?utf-8?q?Bäder?= <tbaeder at redhat.com>,
Timm =?utf-8?q?Bäder?= <tbaeder at redhat.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/165541 at github.com>


================
@@ -47,6 +47,42 @@ 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;
 
+class ColumnsOrBytes {
+public:
+  int V = 0;
+  ColumnsOrBytes(int V) : V(V) {}
+  bool isValid() const { return V != -1; }
+
+  bool operator>(ColumnsOrBytes O) { return V > O.V; }
+  bool operator<(ColumnsOrBytes O) { return V < O.V; }
+  bool operator<=(ColumnsOrBytes B) { return V <= B.V; }
+  bool operator!=(ColumnsOrBytes C) { return C.V != V; }
----------------
zwuis wrote:

Missing `const` qualifiers? Ditto below (`operator+` and `operator-`).

https://github.com/llvm/llvm-project/pull/165541


More information about the cfe-commits mailing list