[clang] [clang] Adjust TextDiagnostic style ranges for interesting source region (PR #164941)

via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 31 03:59:23 PDT 2025


================
@@ -349,14 +349,13 @@ struct SourceColumnMap {
 
 /// When the source code line we want to print is too long for
 /// the terminal, select the "interesting" region.
-static void selectInterestingSourceRegion(std::string &SourceLine,
-                                          std::string &CaretLine,
-                                          std::string &FixItInsertionLine,
-                                          Columns NonGutterColumns,
-                                          const SourceColumnMap &Map) {
-  Columns CaretColumns = Columns(CaretLine.size());
-  Columns FixItColumns =
-      Columns(llvm::sys::locale::columnWidth(FixItInsertionLine));
+static void selectInterestingSourceRegion(
+    std::string &SourceLine, std::string &CaretLine,
+    std::string &FixItInsertionLine, Columns NonGutterColumns,
+    const SourceColumnMap &Map,
+    SmallVector<clang::TextDiagnostic::StyleRange> &Styles) {
----------------
Sirraide wrote:

```suggestion
    SmallVectorImpl<TextDiagnostic::StyleRange> &Styles) {
```

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


More information about the cfe-commits mailing list